private MaintenanceViewModel()
        {
            foreach (var fb in EnumHelper.GetNames(Enum.GetNames(typeof(eBaudRate))))
            {
                _flashBaudrateList.Add(fb.TrimStart(new char[] { 'B', 'a', 'u', 'd' }));
            }

            _serial_programmer_parameters = new iniFile(iniPath);
            // section, key, value, _iniFile
            pathFWtemp    = _serial_programmer_parameters.Read("Firmware Path", "Programmer");
            PathFW        = ShortenPath(pathFWtemp);
            FlashBaudRate = _serial_programmer_parameters.Read("FlashBaud", "Programmer");
            if (String.IsNullOrWhiteSpace(FlashBaudRate))
            {
                FlashBaudRate = "230400";
            }
        }
Esempio n. 2
0
        private string lData(string kname, string dlocal)
        {
            try
            {
                //utf8Bytes = Encoding.UTF8.GetBytes(gVars.ovs_local);
                //path = Encoding.Unicode.GetString(utf8Bytes);
                iF_S = new iniFile(gVars.ovs_local);

                return iF_S.Read(kname, dlocal);

                //MessageBox.Show(null, sClasses, "Test", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);                    
            }

            catch (NullReferenceException err)
            {
                MessageBox.Show(null, err.ToString(), "No File Loaded", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return "";
            }

            catch (FileNotFoundException err)
            {
                MessageBox.Show(null, err.ToString(), "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return "";
            }
        }
Esempio n. 3
0
        private void saveWizardParams()
        {
            string path = "\\MotorController\\Wizard\\";

            path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + path;
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string  _file_name = "WizardParameters.ini";
            iniFile _wizard_parameters_file = new iniFile(path + _file_name);


            string _section = "Wizard";

            #region Save_Parameters
            _wizard_parameters_file.Write("Motor Type", MotorType, _section);

            #endregion Save_Parameters
            #region Advanced_Configuration

            #endregion Advanced_Configuration
            for (int i = 0; i < GetInstance.OperationList.Count; i++)
            {
                if (GetInstance.OperationList.ElementAt(i).Value.CommandName != "Load Default" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Save" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Reset" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Synchronisation Command")
                {
                    _wizard_parameters_file.Write(GetInstance.OperationList.ElementAt(i).Value.CommandName, GetInstance.OperationList.ElementAt(i).Value.CommandValue, _section);
                }
            }
            for (int i = 0; i < GetInstance.OperationList.Count; i++)
            {
                if (GetInstance.OperationList.ElementAt(i).Value.CommandName != "Load Default" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Save" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Reset" &&
                    GetInstance.OperationList.ElementAt(i).Value.CommandName != "Synchronisation Command")
                {
                    Debug.WriteLine(GetInstance.OperationList.ElementAt(i).Value.CommandName + ": " + _wizard_parameters_file.Read(GetInstance.OperationList.ElementAt(i).Value.CommandName, _section));
                }
            }
        }