Exemplo n.º 1
0
        /// <summary>
        /// Updates all dir lists from combobox list
        /// Из элемента формы обновляются данные в XML и в переменных
        /// </summary>
        private void IQP_SaveDirList()
        {
            //1. Empty current lists
            //Monitoring list
            IQP_FileMonitorPath.Clear();
            //Config
            //ConfigManagement.ClearSection("monitorPath"); //clear entire section

            //2. Make new lists
            for (int i = 0; i < cmbIQPMonitorPath.Items.Count; i++)
            {
                string curDir = cmbIQPMonitorPath.GetItemText(cmbIQPMonitorPath.Items[i]);

                //Add to monitor list
                IQP_FileMonitorPath.Add(curDir);
                //Add to config list
                ConfigManagement.UpdateConfigValue("monitorPath", "Dir" + (i + 1), curDir);
            }

            //3. Save config
            ConfigManagement.Save();

            //4. Обновить инфо о количестве подакаталогов
            lblDirsMonitoringCount.Text = cmbIQPMonitorPath.Items.Count.ToString();
        }
Exemplo n.º 2
0
        private void SaveXMLSettingsToConfigFile()
        {
            //1. Update ConfigXML
            ConfigManagement.UpdateConfigValue("Options", "lastsettemp", ObsControl.objMaxim.CameraSetPoint.ToString());

            ConfigManagement.UpdateConfigValue("Devices", "FocuserDriverName", ObsControl.ASCOMFocuser.DRIVER_NAME);         //focuser driver name
            ConfigManagement.UpdateConfigValue("Devices", "FocuserAutoConnect", ObsControl.ASCOMFocuser.Enabled.ToString()); //auto connect focuser

            //IQP_SaveSettingsToConfigFile();

            //2. Save ConfigXML to disk
            ConfigManagement.Save();

            //3. Load config from disk
            ConfigManagement.Load();
            LoadOtherParamsFromXML();

            //4. Side settings
        }
Exemplo n.º 3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
/*
 *              ParentMainForm.ObsControl.MaximDLPath = Properties.Settings.Default.MaximDLPath;
 *              ParentMainForm.ObsControl.CCDAPPath = Properties.Settings.Default.CCDAPPath;
 *              ParentMainForm.ObsControl.PlanetariumPath = Properties.Settings.Default.CartesPath;
 *
 *              //driver id
 *              ParentMainForm.ObsControl.DOME_DRIVER_NAME = Properties.Settings.Default.DomeDriverId;
 *              ParentMainForm.ObsControl.TELESCOPE_DRIVER_NAME = Properties.Settings.Default.TelescopeDriverId;
 *              ParentMainForm.ObsControl.SWITCH_DRIVER_NAME = Properties.Settings.Default.SwitchDriverId;
 *
 *              //switch settings
 *              ParentMainForm.ObsControl.POWER_MOUNT_PORT = Convert.ToByte(Properties.Settings.Default.SwitchMountPort);
 *              ParentMainForm.ObsControl.POWER_CAMERA_PORT = Convert.ToByte(Properties.Settings.Default.SwitchCameraPort);
 *              ParentMainForm.ObsControl.POWER_FOCUSER_PORT = Convert.ToByte(Properties.Settings.Default.SwitchFocuserPort);
 *              ParentMainForm.ObsControl.POWER_ROOFPOWER_PORT = Convert.ToByte(Properties.Settings.Default.SwitchRoofPowerPort);
 *              ParentMainForm.ObsControl.POWER_ROOFSWITCH_PORT = Convert.ToByte(Properties.Settings.Default.SwitchRoofSwitchPort);
 *
 *              ParentMainForm.RoofDuration = Convert.ToInt16(Properties.Settings.Default.RoofDuration);
 */

                if (txtSwitchDriverId.Text != ParentMainForm.ObsControl.ASCOMSwitch.DRIVER_NAME)
                {
                    ParentMainForm.ObsControl.ASCOMSwitch.DRIVER_NAME = txtSwitchDriverId.Text;
                    ParentMainForm.ObsControl.ASCOMSwitch.Reset();
                }

                if (txtDomeDriverId.Text != ParentMainForm.ObsControl.ASCOMDome.DRIVER_NAME)
                {
                    ParentMainForm.ObsControl.ASCOMDome.DRIVER_NAME = txtDomeDriverId.Text;
                    ParentMainForm.ObsControl.ASCOMDome.Reset();
                }

                if (txtTelescopeDriverId.Text != ParentMainForm.ObsControl.ASCOMTelescope.DRIVER_NAME)
                {
                    ParentMainForm.ObsControl.ASCOMTelescope.DRIVER_NAME = txtTelescopeDriverId.Text;
                    ParentMainForm.ObsControl.ASCOMTelescope.Reset();
                }

                //reset automatic duration count if duration was manually changed
                if (TempRoofDuration != ParentMainForm.RoofDuration)
                {
                    Properties.Settings.Default.RoofDurationMeasurementsCount = 1;
                }

                //Commit changes
                Properties.Settings.Default.Save();

                //Load params into vars
                ParentMainForm.LoadParams();


                //Update XML
                SaveDataFromGrid();
                //Write config file to disk
                ConfigManagement.Save();

                this.Close();
            }
            catch (FormatException ex)
            {
                StackTrace   st      = new StackTrace(ex, true);
                StackFrame[] frames  = st.GetFrames();
                string       messstr = "";

                // Iterate over the frames extracting the information you need
                foreach (StackFrame frame in frames)
                {
                    messstr += String.Format("{0}:{1}({2},{3})", frame.GetFileName(), frame.GetMethod().Name, frame.GetFileLineNumber(), frame.GetFileColumnNumber());
                }

                string FullMessage = "Some of the fields has invalid values" + Environment.NewLine;
                FullMessage += Environment.NewLine + "Hint: look for incorrect decimal point ( \".\" instead of \",\" ) or a accidential letter in textbox";
                FullMessage += Environment.NewLine + "Hint 2: clicking in every field could help";
                FullMessage += Environment.NewLine + Environment.NewLine + "Debug information:" + Environment.NewLine + "IOException source: " + ex.Data + " " + ex.Message
                               + Environment.NewLine + Environment.NewLine + messstr;
                MessageBox.Show(this, FullMessage, "Invalid value", MessageBoxButtons.OK);

                Logging.AddLog(FullMessage, LogLevel.Important, Highlight.Error);
            }
        }