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/Applet | |
| 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/Applet')
| -rw-r--r-- | Ryujinx.Ava/Ui/Applet/AvaHostUiHandler.cs | 6 | ||||
| -rw-r--r-- | Ryujinx.Ava/Ui/Applet/ErrorAppletWindow.axaml.cs | 10 | ||||
| -rw-r--r-- | Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs | 22 |
3 files changed, 10 insertions, 28 deletions
diff --git a/Ryujinx.Ava/Ui/Applet/AvaHostUiHandler.cs b/Ryujinx.Ava/Ui/Applet/AvaHostUiHandler.cs index f129cd71..133bcc03 100644 --- a/Ryujinx.Ava/Ui/Applet/AvaHostUiHandler.cs +++ b/Ryujinx.Ava/Ui/Applet/AvaHostUiHandler.cs @@ -92,7 +92,7 @@ namespace Ryujinx.Ava.Ui.Applet } catch (Exception ex) { - await ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogMessageDialogErrorExceptionMessage"], ex)); + await ContentDialogHelper.CreateErrorDialog(string.Format(LocaleManager.Instance["DialogMessageDialogErrorExceptionMessage"], ex)); dialogCloseEvent.Set(); } @@ -126,7 +126,7 @@ namespace Ryujinx.Ava.Ui.Applet catch (Exception ex) { error = true; - await ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogSoftwareKeyboardErrorExceptionMessage"], ex)); + await ContentDialogHelper.CreateErrorDialog(string.Format(LocaleManager.Instance["DialogSoftwareKeyboardErrorExceptionMessage"], ex)); } finally { @@ -181,7 +181,7 @@ namespace Ryujinx.Ava.Ui.Applet catch (Exception ex) { dialogCloseEvent.Set(); - await ContentDialogHelper.CreateErrorDialog(_parent, string.Format(LocaleManager.Instance["DialogErrorAppletErrorExceptionMessage"], ex)); + await ContentDialogHelper.CreateErrorDialog(string.Format(LocaleManager.Instance["DialogErrorAppletErrorExceptionMessage"], ex)); } }); diff --git a/Ryujinx.Ava/Ui/Applet/ErrorAppletWindow.axaml.cs b/Ryujinx.Ava/Ui/Applet/ErrorAppletWindow.axaml.cs index 12fb8b0f..b4acd155 100644 --- a/Ryujinx.Ava/Ui/Applet/ErrorAppletWindow.axaml.cs +++ b/Ryujinx.Ava/Ui/Applet/ErrorAppletWindow.axaml.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; namespace Ryujinx.Ava.Ui.Applet { - internal class ErrorAppletWindow : StyleableWindow + internal partial class ErrorAppletWindow : StyleableWindow { private readonly Window _owner; private object _buttonResponse; @@ -50,8 +50,6 @@ namespace Ryujinx.Ava.Ui.Applet public string Message { get; set; } - public StackPanel ButtonStack { get; set; } - private void AddButton(string label, object tag) { Dispatcher.UIThread.InvokeAsync(() => @@ -79,11 +77,5 @@ namespace Ryujinx.Ava.Ui.Applet return _buttonResponse; } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - ButtonStack = this.FindControl<StackPanel>("ButtonStack"); - } } }
\ No newline at end of file diff --git a/Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs b/Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs index 2d56c0b5..d7bb4b74 100644 --- a/Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs +++ b/Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs @@ -13,7 +13,7 @@ using System.Threading.Tasks; namespace Ryujinx.Ava.Ui.Controls { - internal class SwkbdAppletDialog : UserControl + internal partial class SwkbdAppletDialog : UserControl { private Predicate<int> _checkLength; private int _inputMax; @@ -30,6 +30,10 @@ namespace Ryujinx.Ava.Ui.Controls _placeholder = placeholder; InitializeComponent(); + Input.Watermark = _placeholder; + + Input.AddHandler(TextInputEvent, Message_TextInput, RoutingStrategies.Tunnel, true); + SetInputLengthValidation(0, int.MaxValue); // Disable by default. } @@ -43,23 +47,9 @@ namespace Ryujinx.Ava.Ui.Controls public string MainText { get; set; } = ""; public string SecondaryText { get; set; } = ""; - public TextBlock Error { get; private set; } - public TextBox Input { get; set; } - - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - Error = this.FindControl<TextBlock>("Error"); - Input = this.FindControl<TextBox>("Input"); - - Input.Watermark = _placeholder; - - Input.AddHandler(TextInputEvent, Message_TextInput, RoutingStrategies.Tunnel, true); - } - public static async Task<(UserResult Result, string Input)> ShowInputDialog(StyleableWindow window, string title, SoftwareKeyboardUiArgs args) { - ContentDialog contentDialog = window.ContentDialog; + ContentDialog contentDialog = new ContentDialog(); UserResult result = UserResult.Cancel; |
