Exemplo n.º 1
0
        private void Save_cfg(string CFG_tag)
        {
            string CFG_name = "Config_" + CFG_tag + ".xml";

            IC_Control.SaveDeviceStateToFile(CFG_name);
            Device_state = IC_Control.SaveDeviceState();
        }
Exemplo n.º 2
0
        private void Load_cfg(string CFG_tag, bool Open_dev = true)
        {
            string CFG_name    = "Config_" + CFG_tag + ".xml";
            bool   isDataSaved = true;

            try { IC_Control.SaveDeviceStateToFile("data.xml"); } catch { isDataSaved = false; }

            if (System.IO.File.Exists(CFG_name))
            {
                try
                {
                    IC_Control.LoadDeviceStateFromFile(CFG_name, Open_dev);
                    Init_Properties(IC_Control);
                    Device_state = IC_Control.SaveDeviceState();
                }
                catch (Exception e)
                {
                    IC_Control.ShowDeviceSettingsDialog();
                    Init_Properties(IC_Control);
                    Device_state = IC_Control.SaveDeviceState();
                    if (isDataSaved)
                    {
                        IC_Control.LoadDeviceStateFromFile("data.xml", Open_dev);
                    }
                }
            }
            else
            {
                // do nothing
            }
            System.IO.File.Delete("data.xml");
        }