Inheritance: MonoBehaviour
 private void OnClearPressed(CustomDialog dialog)
 {
     CommandsSelectorViewModel viewModel = dialog.DataContext as CommandsSelectorViewModel;
       if (viewModel != null)
       {
     viewModel.UsedItems.Clear();
       }
 }
 private void OnOkPressed(CustomDialog dialog)
 {
     CommandsSelectorViewModel viewModel = dialog.DataContext as CommandsSelectorViewModel;
       if (viewModel != null)
       {
     dialog.PersistenceData.SetValue<List<string>>("", UsedCommandsListKey, viewModel.GetUsedCommandsList());
       }
       dialog.Save();
       dialog.DialogResult = CustomDialogResult.Ok;
       dialog.Close();
 }
Exemplo n.º 3
0
 private void CheckConnection(object sender, ElapsedEventArgs e)
 {
     if (!_vm.NHMWSConnected && !nhmwsDialogShown)
     {
         try
         {
             Dispatcher.Invoke(() =>
             {
                 var dialog = new CustomDialog
                 {
                     Title            = Translations.Tr("NHMWS not connected"),
                     Description      = Translations.Tr("Not connected to NHMWS. Please check your internet connection."),
                     CancelVisible    = Visibility.Collapsed,
                     OkVisible        = Visibility.Collapsed,
                     AnimationVisible = Visibility.Collapsed,
                 };
                 CustomDialogManager.ShowModalDialog(dialog);
             });
             nhmwsDialogShown = true;
             _timer.Stop();
             _timer.Interval = 1000;
             _timer.Start();
         }
         catch (Exception ex)
         {
             Logger.Error("MainVM.IsNHMWSConnected", ex.Message);
         }
     }
     else if (_vm.NHMWSConnected && nhmwsDialogShown)
     {
         try
         {
             Dispatcher.Invoke(() => CustomDialogManager.HideCurrentModal());
             nhmwsDialogShown = false;
             _timer.Stop();
             _timer.Interval = 1000 * 60 * 2; //2min
             _timer.Start();
         }
         catch (Exception ex)
         {
             _timer.Stop();
             Logger.Error("MainVM.IsNHMWSConnected", ex.Message);
         }
     }
 }
Exemplo n.º 4
0
        public static async Task <MessageBoxResult> Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, MessageBoxImage icon, MessageBoxResult defaultResult, MessageBoxOptions options)
        {
            Debug.WriteLine(caption);
            Debug.WriteLine(messageBoxText);

            // TODO: message box
            var buttons = Buttons[button];
            var win     = new CustomDialog(caption, messageBoxText, AcceptButtonID[button], CancelButtonID[button], buttons);
            // TODO: add msgbox image
            var btnIndex = await win.ShowDialog <int?>(owner);

            if (btnIndex == null)
            {
                return(defaultResult);
            }
            return((MessageBoxResult)Enum.Parse(typeof(MessageBoxResult), buttons[btnIndex.Value]));
            // return Task.FromResult(defaultResult);
        }
Exemplo n.º 5
0
        private void CreateLogReportButton_Click(object sender, RoutedEventArgs e)
        {
            var nhmConfirmDialog = new CustomDialog()
            {
                Title            = Translations.Tr("Pack log files?"),
                Description      = Translations.Tr("This will restart your program and create a zip file on Desktop."),
                OkText           = Translations.Tr("Ok"),
                CancelText       = Translations.Tr("Cancel"),
                AnimationVisible = Visibility.Collapsed
            };

            nhmConfirmDialog.OKClick += (s, e1) =>
            {
                File.Create(Paths.RootPath("do.createLog"));
                Task.Run(() => ApplicationStateManager.RestartProgram());
            };
            CustomDialogManager.ShowModalDialog(nhmConfirmDialog);
        }
Exemplo n.º 6
0
        private async void TabItem_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MetroDialogOptions.ColorScheme = MetroDialogColorScheme.Accented;
            _customDialog = new CustomDialog();
            var mySettings = new MetroDialogSettings
            {
                AffirmativeButtonText    = "OK",
                AnimateShow              = true,
                NegativeButtonText       = "Go away!",
                FirstAuxiliaryButtonText = "Cancel"
            };

            //_loginwindow = new Login1();
            //_loginwindow.ButtonCancel.Click += ButtonCancelOnClick;
            //_loginwindow.ButtonLogin.Click += ButtonLoginOnClick;
            //_customDialog.Content = _loginwindow;
            await this.ShowMetroDialogAsync(_customDialog);
        }
Exemplo n.º 7
0
        async void DateTimePicker_Tapped(object sender, TappedRoutedEventArgs e)
        {
            if (CustomDialog != null)
            {
                CustomDialog.DateTimeModel = new DateTimeModel
                {
                    DateTime = Time,
                    Type     = TimeType,
                };
                var res = await CustomDialog.ShowAsync();

                if (res != null)
                {
                    TimeType = res.Type;
                    Time     = res.DateTime;
                }
            }
        }
Exemplo n.º 8
0
        private async Task ShowDialogAsync(ShowDialogEventPayload payload)
        {
            if (payload == null ||
                payload.DialogContent == null ||
                (!(payload.DialogContent is FrameworkElement)))
            {
                return;
            }

            var cnt = (FrameworkElement)payload.DialogContent;
            var dlg = new CustomDialog();

            dlg.Content = cnt;
            dlg.Title   = payload.Header;
            _shownDialogs.Add(dlg);

            await this.ShowMetroDialogAsync(dlg);
        }
        /// <summary>
        /// Opens the scan rocket media folder asynchronous. Creates a customDialog from RLScanMediaFolder view/viewmodel
        /// </summary>
        /// <param name="obj">The object.</param>
        private async void OpenScanRocketMediaFolderAsync(string obj)
        {
            customDialog = new CustomDialog()
            {
                Title = obj
            };

            customDialog.Content = new RlScanMediaFolderView();

            var rlScanFolderVm = new RlScanMediaFolderViewModel(
                _settings.HypermintSettings.RlMediaPath,
                _settings.HypermintSettings.HsPath, obj, _selectedService.CurrentSystem, _dialogService, customDialog,
                _hyperspinManager.CurrentSystemsGames.Select(x => x.Game), _rlScan);

            customDialog.DataContext = rlScanFolderVm;

            await _dialogService.ShowMetroDialogAsync(this, customDialog);
        }
Exemplo n.º 10
0
        private void Btn_default_Click(object sender, RoutedEventArgs e)
        {
            var nhmConfirmDialog = new CustomDialog()
            {
                Title            = Tr("Set default settings?"),
                Description      = Tr("Are you sure you would like to set everything back to defaults? This will restart NiceHash Miner automatically."),
                OkText           = Tr("Yes"),
                CancelText       = Tr("No"),
                AnimationVisible = Visibility.Collapsed
            };

            nhmConfirmDialog.OKClick += (s, e1) => {
                Translations.SelectedLanguage = "en";
                ConfigManager.SetDefaults();
                Task.Run(() => ApplicationStateManager.RestartProgram());
            };
            CustomDialogManager.ShowModalDialog(nhmConfirmDialog);
        }
Exemplo n.º 11
0
        private static void UpdateListItem(CustomDialog dialog, ListViewItem item)
        {
            item.Text = dialog.Id.ToString();

            if (item.SubItems.Count == 1)
            {
                item.SubItems.Add(dialog.Name);
                item.SubItems.Add(dialog.Topic);
                item.SubItems.Add(dialog.DLLName);
            }
            else
            {
                item.SubItems[1].Text = dialog.Name;
                item.SubItems[2].Text = dialog.Topic;
                item.SubItems[3].Text = dialog.DLLName;
            }
            item.Tag = dialog;
        }
Exemplo n.º 12
0
        private async void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            ThemeSetterManager.SetThemeSelectedThemes();
            UpdateHelpers.OnAutoUpdate = () =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    var nhmUpdaterDialog = new CustomDialog()
                    {
                        Title            = Translations.Tr("NiceHash Miner Starting Update"),
                        Description      = Translations.Tr("NiceHash Miner auto updater in progress."),
                        OkText           = Translations.Tr("OK"),
                        CancelVisible    = Visibility.Collapsed,
                        OkVisible        = Visibility.Collapsed,
                        AnimationVisible = Visibility.Visible,
                        ExitVisible      = Visibility.Collapsed
                    };
                    ShowContentAsModalDialog(nhmUpdaterDialog);
                });
            };
            await MainWindow_OnLoadedTask();

            _vm.GUISettings.PropertyChanged += GUISettings_PropertyChanged;
            NotificationsManager.Instance.PropertyChanged += Instance_PropertyChanged;
            MiningState.Instance.PropertyChanged          += MiningStateInstance_PropertyChanged;
            SetNotificationCount(NotificationsManager.Instance.NotificationNewCount);

            if (!HasWriteAccessToFolder(Paths.Root))
            {
                this.Dispatcher.Invoke(() =>
                {
                    var nhmNoPermissions = new CustomDialog()
                    {
                        Title            = Translations.Tr("Folder lacks permissions"),
                        Description      = Translations.Tr("NiceHash Miner folder doesn't have write access. This can prevent some features from working."),
                        OkText           = Translations.Tr("OK"),
                        CancelVisible    = Visibility.Collapsed,
                        OkVisible        = Visibility.Visible,
                        AnimationVisible = Visibility.Collapsed
                    };
                    ShowContentAsModalDialog(nhmNoPermissions);
                });
            }
        }
Exemplo n.º 13
0
        protected override void OnSizeAllocated(double width, double height)
        {
            base.OnSizeAllocated(width, height);

            if (!First)
            {
                ShadowSize = new ViewBounds
                {
                    Width  = width / 2 - 50,
                    Height = height / 2 - 50
                };

                ShadowPosition = new ViewBounds
                {
                    X = 0,
                    Y = height
                };

                // DialogShadow.BindingContext = ShadowPosition;
                // ImitationDialog.BindingContext = ShadowSize;

                // DialogShadow.LayoutTo(new Rectangle(0, height, width, height), 0);

                Shadow.LayoutTo(new Rectangle(0, height, width, height));
                Shadow.Opacity = 0;

                ImitationDialog.LayoutTo(new Rectangle(width / 2 - 50, height, 100, 100));
                ImitationDialog.Opacity = 0;

                System.Diagnostics.Debug.WriteLine("deg : " + height + ", ");

                var rc = CustomDialog.Bounds;
                rc.X = -1000;
                CustomDialog.LayoutTo(rc, 0);

                Dialog = new ImitationDialog
                {
                    Shadow = Shadow,
                    Dialog = CustomDialog,
                };

                Opacity = 1;
            }
        }
Exemplo n.º 14
0
        private async void PowerConfiguration()
        {
            var res = await CustomDialog.AskPowerOff();

            if (res == ContentDialogResult.Primary)
            {
                //Debug.WriteLine("Shutdown");
                ShutdownManager.BeginShutdown(ShutdownKind.Shutdown, TimeSpan.Zero);
            }
            else if (res == ContentDialogResult.Secondary)
            {
                //Debug.WriteLine("Reboot");
                ShutdownManager.BeginShutdown(ShutdownKind.Restart, TimeSpan.Zero);
            }
            else
            {
                //Debug.WriteLine("Cancel");
            }
        }
Exemplo n.º 15
0
        private void ButtonPopulationEditSources_OnClick(object sender, RoutedEventArgs e)
        {
            if (ActivePopulation == null)
            {
                return;
            }

            CustomDialog Dialog = new CustomDialog();

            Dialog.HorizontalContentAlignment = HorizontalAlignment.Center;

            DialogDataSources DialogContent = new DialogDataSources(ActivePopulation);

            DialogContent.MaxHeight = this.ActualHeight - 200;
            DialogContent.Close    += () => this.HideMetroDialogAsync(Dialog);

            Dialog.Content = DialogContent;
            this.ShowMetroDialogAsync(Dialog);
        }
Exemplo n.º 16
0
        private async void RunCustomFromVm()
        {
            var customDialog = new CustomDialog()
            {
                Title = "Custom Dialog"
            };

            var customDialogExampleContent = new CustomDialogExampleContent(instance =>
            {
                _dialogCoordinator.HideMetroDialogAsync(this, customDialog);
                System.Diagnostics.Debug.WriteLine(instance.FirstName);
            });

            customDialog.Content = new CustomDialogExample {
                DataContext = customDialogExampleContent
            };

            await _dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
        }
Exemplo n.º 17
0
        // just in case we add more awaits this signature will await all of them
        private async Task MainWindow_OnLoadedTask()
        {
            try
            {
                await _vm.InitializeNhm(LoadingBar.StartupLoader);
            }
            finally
            {
                LoadingBar.Visibility = Visibility.Collapsed;
                // Re-enable managed controls
                IsEnabled = true;
                SetTabButtonsEnabled();
                if (BuildOptions.SHOW_TDP_SETTINGS)
                {
                    var tdpWindow = new TDPSettingsWindow();
                    tdpWindow.DataContext = _vm;
                    tdpWindow.Show();
                }
                if (Launcher.IsUpdated)
                {
                    var nhmUpdatedDialog = new CustomDialog()
                    {
                        Title         = Translations.Tr("NiceHash Miner Updated"),
                        Description   = Translations.Tr("Completed NiceHash Miner auto update."),
                        OkText        = Translations.Tr("OK"),
                        CancelVisible = Visibility.Collapsed
                    };
                    ShowContentAsModalDialog(nhmUpdatedDialog);
                }

                if (Launcher.IsUpdatedFailed)
                {
                    var nhmUpdatedDialog = new CustomDialog()
                    {
                        Title         = Translations.Tr("NiceHash Miner Autoupdate Failed"),
                        Description   = Translations.Tr("NiceHash Miner auto update failed to complete. Autoupdates are disabled until next miner launch."),
                        OkText        = Translations.Tr("OK"),
                        CancelVisible = Visibility.Collapsed
                    };
                    ShowContentAsModalDialog(nhmUpdatedDialog);
                }
            }
        }
Exemplo n.º 18
0
        private async void LockApp()
        {
            var lockDialog = new CustomDialog()
            {
                Title = "程序已锁定,请输入密码"
            };
            var dataContext = new LockDialogContent(x =>
            {
                if (x.UserName == "admin" && x.Password == "password")
                {
                    _dialogCoordinator.HideMetroDialogAsync(this, lockDialog);
                }
            });

            lockDialog.Content = new LockDialog {
                DataContext = dataContext
            };
            await _dialogCoordinator.ShowMetroDialogAsync(this, lockDialog);
        }
Exemplo n.º 19
0
        int ShowAssertionDialog(string message, string detailMessage, string stackTrace)
        {
            message = message + Environment.NewLine + detailMessage + Environment.NewLine + stackTrace;
            string[]     buttonTexts = { "Throw", "Debug", "Ignore", "Ignore All" };
            CustomDialog inputBox    = new CustomDialog("Assertion Failed", message.TakeStartEllipsis(750), -1, 2, buttonTexts);

            inputBox.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            inputBox.ShowInTaskbar = true;             // make this window more visible, because it effectively interrupts the decompilation process.
            try
            {
                inputBox.ShowDialog();
                return(inputBox.Result);
            }
            finally
            {
                dialogIsOpen = false;
                inputBox.Dispose();
            }
        }
Exemplo n.º 20
0
        private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            StartProgressRing();

            documentList = new ObservableCollection <DocumentViewModel>();
            DocumentList = CollectionViewSource.GetDefaultView(documentList);
            DocumentListView.DataContext = DocumentList;

            userList = new List <UserViewModel>();
            UserList = CollectionViewSource.GetDefaultView(userList);

            startTaskWithDialog             = (CustomDialog)this.Resources["StartTaskWithDialog"];
            startTaskWithDialog.DataContext = UserList;

            await UpdateServerInfo();
            await Refresh();

            StopProgressRing();
        }
Exemplo n.º 21
0
        public void Application_Startup(object sender, StartupEventArgs e)
        {
            var previousVersion = "6.2.3";
            var currentVersion  = "7.0.0";
            var upgradeState    = InstallationModelTester.ValidPreflightChecks(s => s
                                                                               .Wix(current: "7.0.0", upgradeFrom: previousVersion)
                                                                               .Elasticsearch(es => es
                                                                                              .EsHomeMachineVariable($@"C:\elasticsearch\{previousVersion}")
                                                                                              .EsConfigMachineVariable($@"C:\ProgramData\{previousVersion}\config")
                                                                                              )
                                                                               .ServicePreviouslyInstalled()
                                                                               );

            var state = InstallationModelTester.ValidPreflightChecks(s => s
                                                                     .Wix(current: "7.0.0")
                                                                     );
            var model = state.InstallationModel;

            var window = new MainWindow(model, new ManualResetEvent(false));

            model.InstallUITask = async() =>
            {
                await Task.Delay(TimeSpan.FromSeconds(1));

                var customDialog = new CustomDialog {
                    Title = "Output"
                };
                var licenseModel = new LicenseModel();
                licenseModel.Close.Subscribe(async x => await window.HideMetroDialogAsync(customDialog));
                customDialog.Content = new LicenseDialog(model.ToMsiParamsString())
                {
                    DataContext = licenseModel
                };
                await window.ShowMetroDialogAsync(customDialog);

                return(Observable.Return(ClosingResult.Success));
            };
            model.AllSteps.Last().IsSelected = true;
            window.Show();

            RxApp.MainThreadScheduler = new DispatcherScheduler(Application.Current.Dispatcher);
            Application.Current.Resources["InstallerTitle"] = model.ClosingModel.CurrentVersion.ToString();
        }
Exemplo n.º 22
0
        public TestView()
        {
            InitializeComponent();

            this.WhenActivated(d =>
            {
                this.BindCommand(ViewModel, vm => vm.ShowDialog, view => view.ShowDialog).DisposeWith(d);

                new DialogParticipationRegistration(this).DisposeWith(d);

                this.ViewModel.Interaction.RegisterHandler(async interaction =>
                {
                    var dlg = new CustomDialog {
                        Title = interaction.Input
                    };

                    var dlgvm = new TestDialogViewModel((TestDialogViewModel vm, bool wasAccepted) =>
                    {
                        DialogCoordinator.Instance.HideMetroDialogAsync(this, dlg);

                        if (wasAccepted)
                        {
                            interaction.SetOutput(new DialogData {
                                Foo = vm.Foo, BarBaz = vm.BarBaz
                            });
                        }
                        else
                        {
                            interaction.SetOutput(null);
                        }
                    });

                    dlg.Content = new ViewModelViewHost {
                        ViewModel = dlgvm
                    };

                    await DialogCoordinator.Instance.ShowMetroDialogAsync(this, dlg);

                    await dlg.WaitUntilUnloadedAsync();
                }).DisposeWith(d);
            });
        }
Exemplo n.º 23
0
        /// <summary>
        /// Show Alert Dialog
        /// </summary>
        /// <param name="activity">Activity instance</param>
        /// <param name="title">title of alert dialog</param>
        /// <param name="messsage">message to show alert dialog</param>
        /// <returns>Dialog</returns>
        public Dialog ShowAlertDialog(string title, string messsage,
                                      string positivebtn, string negativeBtn)
        {
            try
            {
                Dialog dialog = null;
                dialog = new CustomDialog().CreateDialog(mActivity,
                                                         title,
                                                         messsage,
                                                         negativeBtn, positivebtn,
                                                         new EventHandler(async delegate(Object o, EventArgs a)
                {
                    if (dialog != null)
                    {
                        dialog.Dismiss();
                        dialog = null;
                    }
                    bool isDeleted = await DeleteCRMNotes();
                    if (isDeleted)
                    {
                        CallBackScreen();
                    }
                }),
                                                         new EventHandler(delegate(Object o, EventArgs a)
                {
                    if (dialog != null)
                    {
                        dialog.Dismiss();
                        dialog = null;
                    }
                }),
                                                         true, true);

                dialog.SetCancelable(true);
                dialog.Show();
                return(dialog);
            }
            catch (Exception e)
            {
                return(null);
            }
        }
Exemplo n.º 24
0
        private Task DoNewConnection(object o)
        {
            return(Task.Factory.StartNew(() =>
            {
                Parent.SyncContext.Post(c =>
                {
                    CustomDialog customDialog = new CustomDialog()
                    {
                        Title = "New Connection"
                    };

                    var dataContext = new NewConnectionDialogModel(obj =>
                    {
                        Parent.DialogCoordinator.HideMetroDialogAsync(Parent, customDialog);
                    },
                                                                   obj =>
                    {
                        Parent.DialogCoordinator.HideMetroDialogAsync(Parent, customDialog);
                        Parent.SyncContext.Post(d =>
                        {
                            Connection connection = new Connection()
                            {
                                Id = Guid.NewGuid(),
                                IpAddress = obj.IpAddress,
                                Port = obj.Port,
                                Username = obj.Username,
                                Password = obj.Password,
                                ExecutablePath = obj.ExecutablePath,
                                IsLocal = obj.IsLocal,
                                Hostname = obj.Hostname,
                            };
                            Connections.Add(connection);
                        }, null);
                    });
                    customDialog.Content = new NewConnectionDialog {
                        DataContext = dataContext
                    };

                    Parent.DialogCoordinator.ShowMetroDialogAsync(Parent, customDialog);
                }, null);
            }));
        }
Exemplo n.º 25
0
        private void clientsDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            _selectedClientId          = Convert.ToInt32(clientsDataGridView.Rows[e.RowIndex].Cells["clientId"].Value);
            _selectedClientFirstName   = clientsDataGridView.Rows[e.RowIndex].Cells["clientFirstName"].Value.ToString();
            _selectedClientLastName    = clientsDataGridView.Rows[e.RowIndex].Cells["clientLastName"].Value.ToString();
            _selectedClientAddress     = clientsDataGridView.Rows[e.RowIndex].Cells["clientAddress"].Value.ToString();
            _selectedClientType        = clientsDataGridView.Rows[e.RowIndex].Cells["clientType"].Value.ToString();
            _selectedClientCompanyName = clientsDataGridView.Rows[e.RowIndex].Cells["clientCompanyName"].Value.ToString();
            _selectedClientJMBG        = clientsDataGridView.Rows[e.RowIndex].Cells["clientJMBG"].Value.ToString();
            _selectedClientPIB         = clientsDataGridView.Rows[e.RowIndex].Cells["clientPIB"].Value.ToString();
            _selectedClientBPG         = clientsDataGridView.Rows[e.RowIndex].Cells["clientBPG"].Value.ToString();
            _selectedClientSPO         = clientsDataGridView.Rows[e.RowIndex].Cells["clientSPO"].Value.ToString();
            _selectedClientZipCode     = clientsDataGridView.Rows[e.RowIndex].Cells["clientZipCode"].Value.ToString();
            _selectedClientBankAccount = clientsDataGridView.Rows[e.RowIndex].Cells["clientBankAccount"].Value.ToString();
            _selectedClientPhone       = clientsDataGridView.Rows[e.RowIndex].Cells["clientPhone"].Value.ToString();

            if (e.ColumnIndex == 13)
            {
                Client client = new Client(_selectedClientId,
                                           _selectedClientFirstName, _selectedClientLastName, _selectedClientAddress, _selectedClientType,
                                           _selectedClientJMBG, _selectedClientBPG,
                                           _selectedClientZipCode, _selectedClientBankAccount, _selectedClientPhone,
                                           _selectedClientPIB, _selectedClientSPO, _selectedClientCompanyName
                                           );
                using EditClientForm editClientForm = new EditClientForm(client);
                editClientForm.ShowDialog(this);
            }
            if (e.ColumnIndex == 14)
            {
                DialogResult result = CustomDialog.ShowDialog(this, $"Da li ste sigurni da želite da obrišete klijenta?\nIme: {_selectedClientFirstName} {_selectedClientLastName}\nJMBG: {_selectedClientJMBG}\nTelefon: {_selectedClientPhone}");
                if (result == DialogResult.No || result == DialogResult.Cancel)
                {
                    return;
                }
                DbConnection.deleteFromDB("clients", "id_client", _selectedClientId);
                DbConnection.fillDGV(clientsDataGridView, _fillDGVQuery);
            }
        }
        /// <summary>
        /// Opens a custom dialog and adds the system asynchronous
        /// </summary>
        /// <returns></returns>
        private async Task AddSystemAsync()
        {
            try
            {
                customDialog = new CustomDialog()
                {
                    Title = "Add new system"
                };

                customDialog.Content = new Dialog.AddSystemDialog {
                    DataContext = new AddSystemDialogViewModel(_dialogService, customDialog, _hyperSpinManager, _eventAggregator, _fileFolderServic, _settings, _selected)
                };

                await _dialogService.ShowMetroDialogAsync(this, customDialog);
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void FillParameters(CustomDialog customDialog, DialogParameters dialogParameters)
        {
            customDialog.Background             = dialogParameters.DialogBackground;
            customDialog.IsAcceptCommandEnabled = dialogParameters.IsAcceptCommandEnabled;
            customDialog.AcceptCommandIcon      = dialogParameters.AcceptCommandIcon;
            customDialog.AcceptCommandText      = dialogParameters.AcceptCommandText;
            customDialog.IsVisibleAcceptCommand = dialogParameters.IsAcceptCommandVisible;

            customDialog.IsCancelCommandEnabled = dialogParameters.IsCancelCommandEnabled;
            customDialog.CancelCommandIcon      = dialogParameters.CancelCommandIcon;
            customDialog.CancelCommandText      = dialogParameters.CancelCommandText;
            customDialog.IsVisibleCancelCommand = dialogParameters.IsCancelCommandVisible;

            customDialog.ShowAllCommandButtons = dialogParameters.ShowAllButtons;

            customDialog.AcceptButtonBackground = dialogParameters.AcceptButtonBackground;
            customDialog.CancelButtonBackground = dialogParameters.CancelButtonBackground;
            customDialog.AcceptButtonForeground = dialogParameters.AcceptButtonForeground;
            customDialog.CancelButtonForeground = dialogParameters.CancelButtonForeground;
        }
Exemplo n.º 28
0
 public void SetBurnCalledAction()
 {
     ApplicationStateManager.BurnCalledAction = () =>
     {
         this.Dispatcher.Invoke(() =>
         {
             var nhmBurnDialog = new CustomDialog()
             {
                 Title         = Translations.Tr("Burn Error!"),
                 Description   = Translations.Tr("Error during burn"),
                 OkText        = Translations.Tr("OK"),
                 CancelVisible = Visibility.Collapsed
             };
             nhmBurnDialog.OnExit += (s, e) => {
                 ApplicationStateManager.ExecuteApplicationExit();
             };
             ShowContentAsModalDialog(nhmBurnDialog);
         });
     };
 }
Exemplo n.º 29
0
        protected override void SetOwnerDialog(CustomDialog value)
        {
            if (null != OwnerDialog)
            {
                OnOwnerDialogClosed(OwnerDialog, EventArgs.Empty);

                OwnerDialog.Opened -= OnOwnerDialogOpened;
                OwnerDialog.Closed -= OnOwnerDialogClosed;
                OwnerDialog.Loaded -= OnOwnerDialogLoaded;
            }

            base.SetOwnerDialog(value);

            if (null != OwnerDialog)
            {
                OwnerDialog.Opened += OnOwnerDialogOpened;
                OwnerDialog.Closed += OnOwnerDialogClosed;
                OwnerDialog.Loaded += OnOwnerDialogLoaded;
            }
        }
Exemplo n.º 30
0
        private void finishInsertBtn_Click(object sender, EventArgs e)
        {
            DialogResult result = CustomDialog.ShowDialog(this, "Da li ste sigurni da ste završili sa ubacivanjem artikala u komoru ?");

            if (result == DialogResult.No || result == DialogResult.Cancel)
            {
                return;
            }

            foreach (DataGridViewRow row in insertPalleteDataGridView.Rows)
            {
                int idPallete     = Convert.ToInt32(row.Cells["id_pallet"].Value);
                int numberPallete = Convert.ToInt32(row.Cells["pallet_number"].Value);

                Pallete item = new Pallete(idPallete, numberPallete);
                palletes.Add(item);
            }
            DbConnection.palleting(palletes, storageId, true);
            Close();
        }
        private async void RunSaveDialog()
        {
            var customDialog = new CustomDialog();

            var dialogViewModel = new SaveDialogViewModel(instanceCancel => _dialogCoordinator.HideMetroDialogAsync(this, customDialog), async instanceCompleted =>
            {
                PackagedSolution.Name = instanceCompleted.Input;
                OnPropertyChanged("PackagedSolution.Name");
                SaveCurrentPackagedSolution();

                await _dialogCoordinator.HideMetroDialogAsync(this, customDialog);
                DisplayTimedMessage("Succes", $"Pakkeløsningen \"{PackagedSolution.Name}\" blev gemt.", 2);
            });

            customDialog.Content = new SaveDialogView {
                DataContext = dialogViewModel
            };

            await _dialogCoordinator.ShowMetroDialogAsync(this, customDialog);
        }
        public SaveMultiSystemViewModel(IDialogCoordinator dialogService, CustomDialog customDialog, IEventAggregator ea,
                                        ISettingsHypermint settingsService, IHyperspinManager hyperspinManager, IFileDialogHelper fileService,
                                        ISelectedService selected, ILoggerFacade loggerFacade) : base(loggerFacade)
        {
            _dialogService     = dialogService;
            _customDialog      = customDialog;
            _eventAggregator   = ea;
            _settingsService   = settingsService;
            _fileFolderService = fileService;
            _hyperspinManager  = hyperspinManager;

            CloseCommand = new DelegateCommand(async() =>
            {
                await _dialogService.HideMetroDialogAsync(this, _customDialog);
            });

            SelectSettingsCommand = new DelegateCommand(SelectSettings);

            BuildMultiSystemCommand = new DelegateCommand(async() =>
            {
                try
                {
                    if (CheckValid())
                    {
                        await BuildMultiSystemAsync();

                        Log("Saving MS to xmls");
                        await _hyperspinManager.SaveCurrentSystemsListToXmlAsync(selected.CurrentMainMenu, true);

                        Log("Completed");
                        await _dialogService.HideMetroDialogAsync(this, _customDialog);
                    }
                }
                catch (Exception ex)
                {
                    Log(ex.Message, Category.Warn);
                    await _dialogService.HideMetroDialogAsync(this, _customDialog);
                }
            }
                                                          );
        }
Exemplo n.º 33
0
        private void Reformat(CustomDialog dialog)
        {
            ITextEditor editor = UttCodeEditor.GetActiveTextEditor();
              string selectedText = editor.SelectedText;
              string[] xmlLines = FormatXml(GetSelectedString()).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
              StringBuilder formattedText = new StringBuilder();
              foreach (string line in xmlLines)
              {
            formattedText.AppendLine("\""+line.Replace("\"", "\\\"")+"\"");
              }

              formattedText.Remove(formattedText.Length - Environment.NewLine.Length, Environment.NewLine.Length);

              if (!selectedText.StartsWith("\""))
              {
            formattedText.Insert(0, "\"" + Environment.NewLine);
              }

              if (!selectedText.EndsWith("\""))
              {
            formattedText.Append(Environment.NewLine+"\"");
              }

              editor.Document.Replace(editor.SelectionStart, editor.SelectionLength, formattedText.ToString());
              dialog.Close();
        }
Exemplo n.º 34
0
 private void ShowXmlDialog(string xml)
 {
     CustomDialog dialog = new CustomDialog();
       XmlViewSingleContent content = new XmlViewSingleContent();
       SingleDirectionData data = new SingleDirectionData();
       content.DataContext = data;
       XmlDocument doc = new XmlDocument();
       doc.LoadXml(xml);
       data.Document = doc;
       dialog.Content = content;
       dialog.MaxWidth = 800;
       dialog.AddOkButton();
       dialog.AddButton("reformat", Reformat, System.Windows.Input.Key.R, System.Windows.Input.ModifierKeys.Alt, "Reformat");
       dialog.Show();
 }
 private void OnCancelPressed(CustomDialog dialog)
 {
     dialog.DialogResult = CustomDialogResult.Cancel;
 }
Exemplo n.º 36
0
        private void Reformat(CustomDialog dialog)
        {
            ITextEditor editor = UttCodeEditor.GetActiveTextEditor();
              string selectedText = editor.SelectedText;
              string[] xmlLines = FormatXml(GetSelectedString()).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
              IDocumentLine documentLine = editor.Document.GetLineForOffset(editor.SelectionStart);
              string lineText = documentLine.Text;
              string indentation = lineText.Substring(0, lineText.Length - lineText.TrimStart().Length);

              StringBuilder formattedText = new StringBuilder();
              foreach (string line in xmlLines)
              {
            formattedText.AppendLine(indentation+"\""+line.Replace("\"", "\\\"")+"\"");
              }

              formattedText.Remove(formattedText.Length - Environment.NewLine.Length, Environment.NewLine.Length);

              if (!selectedText.TrimStart().StartsWith("\""))
              {
            formattedText.Insert(0, "\"" + Environment.NewLine);
              }

              if (!selectedText.TrimEnd().EndsWith("\""))
              {
            formattedText.Append(Environment.NewLine+indentation+"\"");
              }

              DocumentUtilitites.FindNextWordStart(editor.Document, documentLine.Offset);

              editor.Document.Replace(editor.SelectionStart, editor.SelectionLength, formattedText.ToString());
              dialog.Close();
        }
 private void OkAction(CustomDialog dialog)
 {
     this.DialogResult = CustomDialogResult.Ok;
     this.Close();
 }