diff options
| author | Emmanuel Hansen <emmausssss@gmail.com> | 2022-07-24 17:38:38 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-24 14:38:38 -0300 |
| commit | 6e02cac952f1a9a34d2777199dde657eba0784e6 (patch) | |
| tree | bfdf6ebc5c5fb062910ffb2feaec56e1240c0596 /Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs | |
| parent | 3a3380fa2578bf1731c6cd7cebdca7b7cc5681b0 (diff) | |
Avalonia - Use content dialog for user profile manager (#3455)
* remove content dialog placeholder from all windows
* remove redundant window argument
* redesign user profile window
* wip
* use avalonia auto name generator
* add edit and new user options
* move profile image selection to content dialog
* remove usings
* fix updater
* address review
* adjust avatar dialog size
* add validation for user editor
* fix typo
* Shorten some labels
Diffstat (limited to 'Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs')
| -rw-r--r-- | Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs b/Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs index b9bbb66d..e4b37dec 100644 --- a/Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs +++ b/Ryujinx.Ava/Ui/Controls/InputDialog.axaml.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace Ryujinx.Ava.Ui.Controls { - public class InputDialog : UserControl + public partial class InputDialog : UserControl { public string Message { get; set; } public string Input { get; set; } @@ -24,8 +24,6 @@ namespace Ryujinx.Ava.Ui.Controls MaxLength = maxLength; DataContext = this; - - InitializeComponent(); } public InputDialog() @@ -33,33 +31,26 @@ namespace Ryujinx.Ava.Ui.Controls InitializeComponent(); } - private void InitializeComponent() + public static async Task<(UserResult Result, string Input)> ShowInputDialog(string title, string message, + string input = "", string subMessage = "", uint maxLength = int.MaxValue) { - AvaloniaXamlLoader.Load(this); - } - - public static async Task<(UserResult Result, string Input)> ShowInputDialog(StyleableWindow window, string title, string message, string input = "", string subMessage = "", uint maxLength = int.MaxValue) - { - ContentDialog contentDialog = window.ContentDialog; - UserResult result = UserResult.Cancel; - InputDialog content = new InputDialog(message, input = "", subMessage = "", maxLength); - - if (contentDialog != null) + InputDialog content = new InputDialog(message, input, subMessage, maxLength); + ContentDialog contentDialog = new ContentDialog { - contentDialog.Title = title; - contentDialog.PrimaryButtonText = LocaleManager.Instance["InputDialogOk"]; - contentDialog.SecondaryButtonText = ""; - contentDialog.CloseButtonText = LocaleManager.Instance["InputDialogCancel"]; - contentDialog.Content = content; - contentDialog.PrimaryButtonCommand = MiniCommand.Create(() => + Title = title, + PrimaryButtonText = LocaleManager.Instance["InputDialogOk"], + SecondaryButtonText = "", + CloseButtonText = LocaleManager.Instance["InputDialogCancel"], + Content = content, + PrimaryButtonCommand = MiniCommand.Create(() => { result = UserResult.Ok; input = content.Input; - }); - await contentDialog.ShowAsync(); - } + }) + }; + await contentDialog.ShowAsync(); return (result, input); } |
