Exemplo n.º 1
0
        private void HandleOptionsUpdated(ObjMessage obj)
        {
            if (obj.Notification.Equals("MainView"))
            {
                switch (obj.PayLoad.ToString())
                {
                case ("UpdateSavedCommandsPath"):
                    SavedCommandsLoc = Settings.Instance.SavedCommandsPath;
                    break;

                case ("UpdateExePath"):
                    ExeFileName = Settings.Instance.ExePath;
                    break;

                case ("ResetSettings"):
                    ExeFileName      = Settings.Instance.ExePath;
                    SavedCommandsLoc = Settings.Instance.SavedCommandsPath;
                    ConfirmBeforeRun = Settings.Instance.ConfirmBeforeRun;
                    break;

                case ("ConfirmBeforeRun"):
                    ConfirmBeforeRun = Settings.Instance.ConfirmBeforeRun;
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 2
0
        private void ExecResetSettingsCmd(object obj)
        {
            //Perfom ResetSettingsCmd Activity
            Settings.Instance.Reset();
            Settings.Instance.Save();
            SavedCommandsPath = Settings.Instance.SavedCommandsPath;
            ExePath           = Settings.Instance.ExePath;
            StatusMessage     = "Settings were reset to default!";
            ObjMessage message = new ObjMessage("MainView", "ResetSettings");

            EventAggregator.Publish(message);
        }
Exemplo n.º 3
0
        private void ExecChangeSavedCommandsLoc(object obj)
        {
            // Configure open file dialog box
            var dlg = new System.Windows.Forms.FolderBrowserDialog();

            // Show open file dialog box
            System.Windows.Forms.DialogResult result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                // Open document
                SavedCommandsPath = dlg.SelectedPath;
                Settings.Instance.SavedCommandsPath = SavedCommandsPath;
                Settings.Instance.Save();
                StatusMessage = "Saved Commands Path Updated!";
                ObjMessage message = new ObjMessage("MainView", "UpdateSavedCommandsPath");
                EventAggregator.Publish(message);
            }
        }
Exemplo n.º 4
0
        private void ExecChangeExePath(object obj)
        {
            // Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.DefaultExt = ".txt";                                                   // Default file extension
            dlg.Filter     = "Executable Files (.exe)|*.exe|Batch Files (.bat)|*.bat"; // Filter files by extension

            // Show open file dialog box
            Nullable <bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                ExePath = dlg.FileName;
                Settings.Instance.ExePath = ExePath;
                Settings.Instance.Save();
                StatusMessage = "Exe Path Updated!";
                ObjMessage message = new ObjMessage("MainView", "UpdateExePath");
                EventAggregator.Publish(message);
            }
        }