Skip to content

Commit

Permalink
My changes to InputBox
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Feb 25, 2024
1 parent 6261b4e commit 65d1de6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace iNKORE.UI.WPF.Modern.Controls
{
public static class InputBox
{
public static async Task<string> ShowAsync(string title, string prompt, string defaultResponse = "")
public static async Task<string> ShowAsync(object title, object prompt, string defaultResponse = "")
{
ContentDialog dialog = BuildDialog(title, prompt, defaultResponse);
ContentDialogResult result = await dialog.ShowAsync();
Expand All @@ -21,7 +21,7 @@ public static async Task<string> ShowAsync(string title, string prompt, string d
return response;
}

public static async Task<string> ShowAsync(Window owner, string title, string prompt, string defaultResponse = "")
public static async Task<string> ShowAsync(Window owner, object title, object prompt, string defaultResponse = "")
{
ContentDialog dialog = BuildDialog(title, prompt, defaultResponse);
ContentDialogResult result = await dialog.ShowAsync(owner);
Expand All @@ -36,7 +36,7 @@ public static async Task<string> ShowAsync(Window owner, string title, string pr
return response;
}

public static async Task<string> ShowAsync(ContentDialogPlacement placement, string title, string prompt, string defaultResponse = "")
public static async Task<string> ShowAsync(ContentDialogPlacement placement, object title, object prompt, string defaultResponse = "")
{
ContentDialog dialog = BuildDialog(title, prompt, defaultResponse);
ContentDialogResult result = await dialog.ShowAsync(placement);
Expand All @@ -51,7 +51,7 @@ public static async Task<string> ShowAsync(ContentDialogPlacement placement, str
return response;
}

private static ContentDialog BuildDialog(string title, string prompt, string defaultResponse)
private static ContentDialog BuildDialog(object title, object prompt, string defaultResponse)
{
ContentDialog dialog = new()
{
Expand All @@ -64,7 +64,7 @@ private static ContentDialog BuildDialog(string title, string prompt, string def
dialog.Content = content;

dialog.Title = title;
content.promptTextControl.Text = prompt;
content.promptTextControl.Content = prompt;
content.responseTextControl.Text = defaultResponse;

return dialog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:iNKORE.UI.WPF.Modern.Controls"
xmlns:local="clr-namespace:iNKORE.UI.WPF.Modern.Controls" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d"
d:DesignHeight="200"
d:DesignWidth="400">
<UniformGrid Columns="1"
<ui:SimpleStackPanel Spacing="16"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<TextBlock x:Name="promptTextControl"
Text=""
TextWrapping="Wrap" />
<ui:ContentPresenterEx x:Name="promptTextControl" TextWrapping="Wrap"/>
<TextBox x:Name="responseTextControl"
Text="" />
</UniformGrid>
</ui:SimpleStackPanel>
</UserControl>
5 changes: 3 additions & 2 deletions source/samples/WpfApp1/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ private void AppBarButton_Click(object sender, RoutedEventArgs e)
//naview.SelectedItem = sgsac;
}

private void ToggleButton_Click(object sender, RoutedEventArgs e)
private async void ToggleButton_Click(object sender, RoutedEventArgs e)
{
//AppBarToggleButton1.IsChecked = false;
AppBarToggleButton1.IsEnabled = false;
//AppBarToggleButton1.IsEnabled = false;
//MicaHelper.RemoveTitleBar(this);
MicaHelper.Apply(this, BackdropType.Mica, false);
await InputBox.ShowAsync("promptssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssok", "promptssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssok", "test");
}

private void Button_MessageBox_Click(object sender, RoutedEventArgs e)
Expand Down

0 comments on commit 65d1de6

Please sign in to comment.