private async void PlayerIndexBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (ViewModel.IsModified && !_dialogOpen)
            {
                _dialogOpen = true;

                var result = await ContentDialogHelper.CreateConfirmationDialog(
                    this.GetVisualRoot() as StyleableWindow,
                    LocaleManager.Instance["DialogControllerSettingsModifiedConfirmMessage"],
                    LocaleManager.Instance["DialogControllerSettingsModifiedConfirmSubMessage"],
                    LocaleManager.Instance["InputDialogYes"],
                    LocaleManager.Instance["InputDialogNo"],
                    LocaleManager.Instance["RyujinxConfirm"]);

                if (result == UserResult.Yes)
                {
                    ViewModel.Save();
                }

                _dialogOpen = false;

                ViewModel.IsModified = false;

                if (e.AddedItems.Count > 0)
                {
                    var player = (PlayerModel)e.AddedItems[0];
                    ViewModel.PlayerId = player.Id;
                }
            }
        }
Example #2
0
        private void ShowRestartDialog()
        {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            Dispatcher.UIThread.InvokeAsync(async() =>
            {
                if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
                {
                    var result = await ContentDialogHelper.CreateConfirmationDialog(
                        LocaleManager.Instance["DialogThemeRestartMessage"],
                        LocaleManager.Instance["DialogThemeRestartSubMessage"],
                        LocaleManager.Instance["InputDialogYes"],
                        LocaleManager.Instance["InputDialogNo"],
                        LocaleManager.Instance["DialogRestartRequiredMessage"]);

                    if (result == UserResult.Yes)
                    {
                        var path = Process.GetCurrentProcess().MainModule.FileName;
                        var info = new ProcessStartInfo()
                        {
                            FileName = path, UseShellExecute = false
                        };
                        var proc = Process.Start(info);
                        desktop.Shutdown();
                        Environment.Exit(0);
                    }
                }
            });
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }