public bool Show()
        {
            var messageBox = new MessageBoxModel {
                Text    = "Baza danych już istnieje. Czy chcesz ją usunąć?",
                Caption = "Info",
                Icon    = MessageBoxImage.Question,
                Buttons = new[] {
                    MessageBoxButtons.Yes("Tak"),
                    MessageBoxButtons.No("Nie")
                },
                IsSoundEnabled = false
            };
            var buttons = messageBox.Buttons.ToArray();

            buttons[0].IsDefault = false;
            buttons[1].IsDefault = true;
            MessageBox.Show(messageBox);

            switch (messageBox.Result)
            {
            case MessageBoxResult.No:
                return(false);

            case MessageBoxResult.Yes:
                return(true);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public bool Show()
        {
            var messageBox = new MessageBoxModel {
                Text    = "Czy na pewno chcesz usunąć książkę?",
                Caption = "Info",
                Icon    = MessageBoxImage.Warning,
                Buttons = new[] {
                    MessageBoxButtons.Yes("Tak"),
                    MessageBoxButtons.No("Nie")
                },
                IsSoundEnabled = false
            };

            MessageBox.Show(messageBox);

            switch (messageBox.Result)
            {
            case MessageBoxResult.No:
                return(false);

            case MessageBoxResult.Yes:
                return(true);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 3
0
        public MainWindow()
        {
            ToolTipService.InitialShowDelayProperty.OverrideMetadata(
                typeof(FrameworkElement), new FrameworkPropertyMetadata(250));
            ToolTipService.ShowDurationProperty.OverrideMetadata(
                typeof(FrameworkElement), new FrameworkPropertyMetadata(int.MaxValue));

            InitializeComponent();

            DataContext = _vm;

            if (ApplicationConfiguration.Instance.HasAcknowledgedDonationDialog)
            {
                return;
            }

            var messageBox = new MessageBoxModel
            {
                Text =
                    "Hello, Gamer! \r\n\r\nDid you know this project was only possible with years of dedication and enthusiasm? " +
                    "You're receiving this work for absolutely free. If it brings you joy please consider giving back to the "
                    + "author's efforts and show your appreciation through a donation. \r\n\r\nThanks for your attention ❤️",
                Caption = "May I have your attention",
                Icon    = MessageBoxImage.Question,
                Buttons = new[]
                {
                    MessageBoxButtons.Cancel("Acknowledged"),
                    MessageBoxButtons.Yes("Sure, show me how!")
                },
                CheckBoxes = new[]
                {
                    new MessageBoxCheckBoxModel("I've already donated or will consider it")
                    {
                        IsChecked = false,
                        Placement = MessageBoxCheckBoxPlacement.BelowText
                    }
                },
                IsSoundEnabled = false
            };

            MessageBox.Show(messageBox);

            switch (messageBox.Result)
            {
            case MessageBoxResult.Yes:
                Process.Start("https://vigem.org/Donations/");
                break;
            }

            ApplicationConfiguration.Instance.HasAcknowledgedDonationDialog =
                messageBox.CheckBoxes.First().IsChecked;
        }
Exemplo n.º 4
0
        private async void OnStartup(object sender, StartupEventArgs e)
        {
            RxApp.MainThreadScheduler.Schedule(async() =>
            {
                var settings = Locator.Current.GetService <SettingsViewModel>();

                settings.Restore();
            });

#if !DO_NOT_INCLUDE_UPDATER
            InstallerRunner.CleanUpInstaller();

            var generalSettings = Locator.Current.GetService <IEnumerable <SettingsGroupViewModelBase> >()
                                  .OfType <GeneralSettingsGroupViewModel>()
                                  .Single();

            if (!generalSettings.CheckForUpdatesOnStartup)
            {
                return;
            }

            var ghubClient    = new GitHubClient(new ProductHeaderValue("Image-Sort"));
            var updateFetcher = new GitHubUpdateFetcher(ghubClient);
            (var success, var release) =
                await updateFetcher.TryGetLatestReleaseAsync(generalSettings.InstallPrereleaseBuilds).ConfigureAwait(true);

            if (success)
            {
                var messageBox = new MessageBoxModel
                {
                    Caption = Text.UpdateAvailablePromptTitle,
                    Text    = Text.UpdateAvailablePromptText.Replace("{TagName}", release.TagName ?? "NO TAG INFORMATION AVAILABLE", StringComparison.OrdinalIgnoreCase),
                    Buttons = new[]
                    {
                        MessageBoxButtons.Yes(Text.Update),
                        MessageBoxButtons.No(Text.DoNotUpdate)
                    },
                    Icon = AdonisUI.Controls.MessageBoxImage.Question
                };

                if (AdonisUI.Controls.MessageBox.Show(messageBox) == AdonisUI.Controls.MessageBoxResult.Yes && updateFetcher.TryGetInstallerFromRelease(release, out var installerAsset))
                {
                    var installer = await updateFetcher.GetStreamFromAssetAsync(installerAsset).ConfigureAwait(false);

                    InstallerRunner.RunAsync(installer).ConfigureAwait(false);
                }
            }
#endif
        }