private void ctrlBtnEventNew_Click(object sender, RoutedEventArgs e)
        {
            ClusterEventWindow Wnd = new ClusterEventWindow();

            Wnd.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            Wnd.Owner = this;

            Wnd.AvailableCategories = GetAvailableCategories();
            Wnd.AvailableTypes      = GetAvailableTypes();
            Wnd.AvailableNames      = GetAvailableNames();

            bool?RetVal = Wnd.ShowDialog();

            if (RetVal.HasValue && RetVal == true)
            {
                Dictionary <string, string> ArgMap = new Dictionary <string, string>();
                ClusterEvent NewEvt = new ClusterEvent(Wnd.SelectedCategory, Wnd.SelectedType, Wnd.SelectedName, Wnd.GetArgDictionary());
                NewEvt.RebuildJsonStringForGui();
                ClusterEvents.Add(NewEvt);

                RegistrySaver.AddRegistryValue(RegistrySaver.RegCategoryClusterEvents, NewEvt.SerializeToString());

                AppLogger.Log("New cluster event stored: " + NewEvt.ToString());
            }
            else
            {
                // Nothing to do
            }
        }
Esempio n. 2
0
        private void ctrlBtnKill_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlComboConfigs.SelectedIndex < 0)
            {
                AppLogger.Log("No config selected");
                return;
            }

            TheLauncher.ProcessCommand(Launcher.ClusterCommandType.KillApp);
        }
Esempio n. 3
0
        private void ctrlBtnRun_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlListApps.SelectedIndex < 0 || ctrlComboConfigs.SelectedIndex < 0)
            {
                AppLogger.Log("No application/config selected");
                return;
            }

            TheLauncher.ProcessCommand(Launcher.ClusterCommandType.RunApp);
        }
        private void ctrlBtnEventSend_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlListClusterEvents.SelectedItems.Count <= 0)
            {
                AppLogger.Log("No event selected");
                return;
            }

            TheLauncher.ProcessCommand(Launcher.ClusterCommandType.SendEvent, new object[] { ctrlListClusterEvents.SelectedItems.Cast <ClusterEvent>().ToList() });
        }
Esempio n. 5
0
        private void ctrlBtnRestartComputers_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlComboConfigs.SelectedIndex < 0)
            {
                AppLogger.Log("No config selected");
                return;
            }

            DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Are you sure?", "Restart cluster nodes", MessageBoxButtons.YesNo);

            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                TheLauncher.ProcessCommand(Launcher.ClusterCommandType.RestartComputers);
            }
        }
        private void ctrlBtnRun_Click(object sender, RoutedEventArgs e)
        {
            if (ctrlListApps.SelectedIndex < 0 || ctrlComboConfigs.SelectedIndex < 0)
            {
                AppLogger.Log("No application/config selected");
                return;
            }

            if (TheLauncher.SelectedConfig.Contains(" "))
            {
                System.Windows.Forms.MessageBox.Show("Paths with spaces currently not supported. Please make sure there is no spaces in the config path.");
                return;
            }

            TheLauncher.ProcessCommand(Launcher.ClusterCommandType.RunApp);
        }
Esempio n. 7
0
        private void UpgradeConfigIfNeeded(string file)
        {
            string Text = string.Empty;

            ConfigurationVersion Ver = Parser.GetVersion(TheLauncher.SelectedConfig);

            if (Ver < Launcher.CurrentVersion)
            {
                AppLogger.Log("An outdated config file selected.");
                Text += "Selected config file doesn't match the current version of the nDisplayLauncher. ";
                Text += "Would you like to convert this file automatically? A new file will be created and added to the list.";

                System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show(Text, "Wrong config file format", MessageBoxButtons.YesNo);
                if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                {
                    string NewFile = string.Empty;
                    if (PerformConfigUpgrade(TheLauncher.SelectedConfig, ref NewFile))
                    {
                        Text  = "Conversion successful. The newly created file was added to the list.\n";
                        Text += NewFile;
                        Text += "\nDon't forget to deploy the new config file to your remote machines.";
                        System.Windows.Forms.MessageBox.Show(Text, "Success", MessageBoxButtons.OK);
                    }
                    else
                    {
                        Text = "Conversion failed. Please try to upgrade the configuration file manually.";
                        System.Windows.Forms.MessageBox.Show(Text, "Failed", MessageBoxButtons.OK);
                    }
                }
                else
                {
                    AppLogger.Log("Config file upgrade skipped.");
                }
            }
            else if (Ver > Launcher.CurrentVersion)
            {
                Text = "Incompatible configuration file";
                System.Windows.Forms.MessageBox.Show(Text, "Failed", MessageBoxButtons.OK);
            }
        }
Esempio n. 8
0
        private bool PerformConfigUpgrade(string OldFile, ref string NewFile)
        {
            AppLogger.Log("Upgrading the config file...");
            ConfigConversion.ConversionResult result = ConfigConversion.Convert(TheLauncher.SelectedConfig, Launcher.CurrentVersion);
            if (result.Success == true)
            {
                AppLogger.Log("Upgraded successfully. Auto-generated file location: " + result.NewConfigFile);
                if (!TheLauncher.Configs.Exists(x => x == result.NewConfigFile))
                {
                    TheLauncher.AddConfig(result.NewConfigFile);
                    ctrlComboConfigs.Items.Refresh();
                }

                // Make this new file selected in the GUI
                TheLauncher.SelectedConfig = result.NewConfigFile;
            }
            else
            {
                AppLogger.Log("Upgrade failed.");
            }

            NewFile = result.NewConfigFile;
            return(result.Success);
        }