private void Apply_Click(object sender, EventArgs e)
        {
            int check = FieldCheck();

            if (check != 1)
            {
                int type = -1;
                CommonData.Preferences.PluginConfigList.Clear();
                foreach (ListViewItem item in ToolbarPlugins.Items)
                {
                    if (String.IsNullOrEmpty(item.Text) || item.Text == "Empty_Slot")
                    {
                        type = -1;
                    }
                    else
                    {
                        type = CustomUserInterface.StringToPluginType(item.Text);
                    }
                    CommonData.Preferences.PluginConfigList.Add(type);
                }
                if (ToolbarPlugins.Items.Count < 10)
                {
                    while (CommonData.Preferences.PluginConfigList.Count < 10)
                    {
                        CommonData.Preferences.PluginConfigList.Add(-1);
                    }
                }
                CommonData.Preferences.UdlUrl              = UdlAddress.Text;
                CommonData.Preferences.SatCatLocation      = SatCatPath.Text;
                CommonData.Preferences.SatDatabaseLocation = SatDataPath.Text;
                CommonData.Preferences.AoiLocation         = AreaTargetPath.Text;
                CommonData.Preferences.TemplatesDirectory  = TemplatesPath.Text;
                CommonData.PanelHeight = Int32.Parse(PanelHeightPixels.Text);
                ReadWrite.WritePrefs(Path.Combine(@CommonData.InstallDir, "PluginPreferences.pref"));
                ReadWrite.ReadPrefs(Path.Combine(@CommonData.InstallDir, "PluginPreferences.pref"));
                this.DialogResult = DialogResult.Yes;
                this.Close();
            }
        }
Example #2
0
        private void Apply_Click(object sender, EventArgs e)
        {
            int check = FieldCheck();

            if (check != 1)
            {
                int type = -1;
                CommonData.Preferences.PluginConfigList.Clear();
                foreach (ListViewItem item in ToolbarPlugins.Items)
                {
                    if (String.IsNullOrEmpty(item.Text) || item.Text == "Empty_Slot")
                    {
                        type = -1;
                    }
                    else
                    {
                        type = CustomUserInterface.StringToPluginType(item.Text);
                    }
                    CommonData.Preferences.PluginConfigList.Add(type);
                }
                if (ToolbarPlugins.Items.Count < 10)
                {
                    while (CommonData.Preferences.PluginConfigList.Count < 10)
                    {
                        CommonData.Preferences.PluginConfigList.Add(-1);
                    }
                }
                CommonData.Preferences.UdlUrl              = UdlAddress.Text;
                CommonData.Preferences.SatCatLocation      = SatCatPath.Text;
                CommonData.Preferences.SatDatabaseLocation = SatDataPath.Text;
                CommonData.Preferences.AoiLocation         = AreaTargetPath.Text;
                CommonData.Preferences.TemplatesDirectory  = TemplatesPath.Text;
                CommonData.PanelHeight = Int32.Parse(PanelHeightPixels.Text);

                if (ActiveSave.Checked)
                {
                    CommonData.Preferences.ActiveSaveScript = true;
                    CommonData.Preferences.SaveScriptPath   = OnStkSaveText.Text;
                    if (!String.IsNullOrEmpty(SaveArgText.Text))
                    {
                        CommonData.Preferences.SaveScriptArgs = SaveArgText.Text;
                    }
                    else
                    {
                        CommonData.Preferences.SaveScriptArgs = null;
                    }
                }
                else
                {
                    CommonData.Preferences.ActiveSaveScript = false;
                    CommonData.Preferences.SaveScriptPath   = OnStkSaveText.Text;
                    CommonData.Preferences.SaveScriptArgs   = SaveArgText.Text;
                }

                if (ActiveClose.Checked)
                {
                    CommonData.Preferences.ActiveCloseScript = true;
                    CommonData.Preferences.CloseScriptPath   = OnStkCloseText.Text;
                    if (!String.IsNullOrEmpty(CloseArgsText.Text))
                    {
                        CommonData.Preferences.CloseScriptArgs = CloseArgsText.Text;
                    }
                    else
                    {
                        CommonData.Preferences.CloseScriptArgs = null;
                    }
                }
                else
                {
                    CommonData.Preferences.ActiveCloseScript = false;
                    CommonData.Preferences.CloseScriptPath   = OnStkCloseText.Text;
                    CommonData.Preferences.CloseScriptArgs   = CloseArgsText.Text;
                }
                if (ActiveAdded.Checked)
                {
                    CommonData.Preferences.ActiveObjAddedScript = true;
                    CommonData.Preferences.ObjAddedScriptPath   = OnObjAddedText.Text;
                }
                else
                {
                    CommonData.Preferences.ActiveObjAddedScript = false;
                    CommonData.Preferences.ObjAddedScriptPath   = OnObjAddedText.Text;
                }
                if (ActiveDelete.Checked)
                {
                    CommonData.Preferences.ActiveObjDeletedScript = true;
                    CommonData.Preferences.ObjDeletedScriptPath   = OnObjDeletedText.Text;
                }
                else
                {
                    CommonData.Preferences.ActiveObjDeletedScript = false;
                    CommonData.Preferences.ObjDeletedScriptPath   = OnObjDeletedText.Text;
                }
                if (ActivePlayback.Checked)
                {
                    CommonData.Preferences.ActivePlaybackScript = true;
                    CommonData.Preferences.PlaybackScriptPath   = OnAnimationText.Text;
                    if (!String.IsNullOrEmpty(PlaybackArgsText.Text))
                    {
                        CommonData.Preferences.PlaybackScriptArgs = PlaybackArgsText.Text;
                    }
                    else
                    {
                        CommonData.Preferences.PlaybackScriptArgs = null;
                    }
                }
                else
                {
                    CommonData.Preferences.ActivePlaybackScript = false;
                    CommonData.Preferences.PlaybackScriptPath   = OnAnimationText.Text;
                    CommonData.Preferences.PlaybackScriptArgs   = PlaybackArgsText.Text;
                }
                if (ActivePause.Checked)
                {
                    CommonData.Preferences.ActivePauseScript = true;
                    CommonData.Preferences.PauseScriptPath   = OnPauseText.Text;
                    if (!String.IsNullOrEmpty(PauseArgsText.Text))
                    {
                        CommonData.Preferences.PauseScriptArgs = PauseArgsText.Text;
                    }
                    else
                    {
                        CommonData.Preferences.PauseScriptArgs = null;
                    }
                }
                else
                {
                    CommonData.Preferences.ActivePauseScript = false;
                    CommonData.Preferences.PauseScriptPath   = OnPauseText.Text;
                    CommonData.Preferences.PauseScriptArgs   = PauseArgsText.Text;
                }

                ReadWrite.WritePrefs(Path.Combine(@CommonData.InstallDir, "PluginPreferences.pref"));
                ReadWrite.ReadPrefs(Path.Combine(@CommonData.InstallDir, "PluginPreferences.pref"));
                this.DialogResult = DialogResult.Yes;
                this.Close();
            }
        }