Ejemplo n.º 1
0
        private void PInfoListItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            ListBoxItem senderItem = sender as ListBoxItem;
            string      toDownload = senderItem.Tag.ToString();

            MessageBoxModel downloadMsg = new MessageBoxModel
            {
                Text    = "Downloading file from this url: " + toDownload,
                Caption = "Confirm download",
                Icon    = AdonisUI.Controls.MessageBoxImage.Information,
                Buttons = new[]
                {
                    MessageBoxButtons.Ok(),
                            MessageBoxButtons.Cancel(),
                },
            };

            MessageBox.Show(downloadMsg);

            if (downloadMsg.Result == AdonisUI.Controls.MessageBoxResult.OK)
            {
                new WebClient().DownloadFile(new Uri(toDownload), Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\FLauncher\Plugins\" + senderItem.Content + ".dll");
                MessageBox.Show("Plugin download complete, restart FLauncher to use it", "Download Complete");
            }
        }
Ejemplo n.º 2
0
        public void ShowErrorBox(string errorMessage)
        {
            var messageBox = new MessageBoxModel
            {
                Text    = $"Unfortunately an error occurred: {errorMessage}",
                Caption = "Ups?",
                Icon    = MessageBoxImage.Error,
                Buttons = new [] { MessageBoxButtons.Ok() }
            };

            MessageBox.Show(messageBox);
        }
Ejemplo n.º 3
0
        public ActionsView()
        {
            InitializeComponent();

            this.WhenActivated(disposableRegistration =>
            {
                this.BindCommand(ViewModel,
                                 vm => vm.Undo,
                                 view => view.Undo)
                .DisposeWith(disposableRegistration);

                this.BindCommand(ViewModel,
                                 vm => vm.Redo,
                                 view => view.Redo)
                .DisposeWith(disposableRegistration);

                this.OneWayBind(ViewModel,
                                vm => vm.LastDone,
                                view => view.Undo.ToolTip)
                .DisposeWith(disposableRegistration);

                this.OneWayBind(ViewModel,
                                vm => vm.LastUndone,
                                view => view.Redo.ToolTip)
                .DisposeWith(disposableRegistration);

                ViewModel.NotifyUserOfError.RegisterHandler(ic =>
                {
                    var messageBox = new MessageBoxModel
                    {
                        Caption = Text.Error,
                        Text    = ic.Input,
                        Icon    = MessageBoxImage.Error,
                        Buttons = new[] { MessageBoxButtons.Ok(Text.OK) }
                    };

                    MessageBox.Show(messageBox);

                    ic.SetOutput(Unit.Default);
                });
            });
        }
Ejemplo n.º 4
0
        public void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args)
        {
            if (args.Error == null)
            {
                Init(args);

                if (MainWindow.Self.UserInvokedUpdate || args.IsUpdateAvailable)
                {
                    Owner = MainWindow.Self;
                    Show();
                    MainWindow.Self.UserInvokedUpdate = false;
                }
            }
            else
            {
                if (args.Error is System.Net.WebException)
                {
                    MessageBox.Show(new MessageBoxModel
                    {
                        Caption = "Update Check Failed",
                        Text    = "There is a problem reaching update server. Please check your internet connection and try again later.",
                        Icon    = MessageBoxImage.Error,
                        Buttons = new IMessageBoxButtonModel[1] {
                            MessageBoxButtons.Ok()
                        },
                    });
                }
                else
                {
                    MessageBox.Show(new MessageBoxModel
                    {
                        Caption = args.Error.GetType().ToString(),
                        Text    = args.Error.Message,
                        Icon    = MessageBoxImage.Error,
                        Buttons = new IMessageBoxButtonModel[1] {
                            MessageBoxButtons.Ok()
                        },
                    });
                }
            }
        }
Ejemplo n.º 5
0
        public AppUpdateWindow()
        {
            InitializeComponent();

            var obj = TryFindResource("DefaultMarkdown");

            if (obj != null && obj is Markdown markdown)
            {
                _defaultMarkdown = markdown;
            }

            ConfirmButton.Click += (o, e) =>
            {
                try
                {
                    if (AutoUpdater.DownloadUpdate(UpdateArgs))
                    {
                        System.Windows.Application.Current.Shutdown();
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(new MessageBoxModel
                    {
                        Caption = exception.GetType().ToString(),
                        Text    = exception.Message,
                        Icon    = MessageBoxImage.Error,
                        Buttons = new IMessageBoxButtonModel[1] {
                            MessageBoxButtons.Ok()
                        },
                    });
                    Hide();
                }
            };

            SkipButton.Click += (o, e) =>
            {
                Hide();
            };
        }
Ejemplo n.º 6
0
        public ImagesView()
        {
            InitializeComponent();

            this.WhenActivated(disposableRegistration =>
            {
                this.OneWayBind(ViewModel,
                                vm => vm.SelectedImage,
                                view => view.SelectedImage.Source,
                                PathToImage)
                .DisposeWith(disposableRegistration);

                this.OneWayBind(ViewModel,
                                vm => vm.Images,
                                view => view.Images.ItemsSource)
                .DisposeWith(disposableRegistration);

                this.Bind(ViewModel,
                          vm => vm.SelectedIndex,
                          view => view.Images.SelectedIndex)
                .DisposeWith(disposableRegistration);

                this.Bind(ViewModel,
                          vm => vm.SearchTerm,
                          view => view.SearchTerm.Text)
                .DisposeWith(disposableRegistration);

                this.BindCommand(ViewModel,
                                 vm => vm.GoLeft,
                                 view => view.GoLeft)
                .DisposeWith(disposableRegistration);

                this.BindCommand(ViewModel,
                                 vm => vm.GoRight,
                                 view => view.GoRight)
                .DisposeWith(disposableRegistration);

                this.BindCommand(ViewModel,
                                 vm => vm.RenameImage,
                                 view => view.Rename)
                .DisposeWith(disposableRegistration);

                ViewModel.PromptForNewFileName.RegisterHandler(ic =>
                {
                    var inputBox = new InputBox(Text.RenameImagePromptText, Text.RenameImagePromptTitle);

                    if (inputBox.ShowDialog() == true)
                    {
                        ic.SetOutput(inputBox.Answer);
                    }
                    else
                    {
                        ic.SetOutput(null);
                    }
                });

                ViewModel.NotifyUserOfError.RegisterHandler(ic =>
                {
                    var messageBox = new MessageBoxModel
                    {
                        Caption = Text.Error,
                        Text    = ic.Input,
                        Buttons = new[] { MessageBoxButtons.Ok(Text.OK) },
                        Icon    = MessageBoxImage.Error
                    };

                    MessageBox.Show(messageBox);

                    ic.SetOutput(Unit.Default);
                });

                ViewModel.GoLeft
                .Merge(ViewModel.GoRight)
                .Subscribe(_ =>
                {
                    if (Images.ItemContainerGenerator.ContainerFromItem(Images.SelectedItem) is ListBoxItem item)
                    {
                        item.Focus();
                    }
                })
                .DisposeWith(disposableRegistration);
            });
        }