Exemplo n.º 1
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     clsControl   = new Controller();
     clsProfile   = new TemperatureProfile();
     clsLog       = new Log(Log.GenerateFilename("log", true));
     frmInfo      = new Info();
     frmTerm      = new Terminal();
     frmSet       = new Settings();
     frmAbout     = new AboutBox();
     frmProfile   = new Profile();
     frmGpioTools = new GpioTools(clsControl.GpioState);
     Application.Run(frmInfo);
 }
Exemplo n.º 2
0
        private bool ParseProfile()
        {
            _profile = new TemperatureProfile();
            TextReader reader = new StringReader(txtProfile.Text);
            string     line   = reader.ReadLine();

            try
            {
                while (line != null)
                {
                    string[] split = line.Split(' ');
                    int      time;
                    if (split[0][0] == '+')
                    {
                        time = int.Parse(split[0].Remove(0, 1)) + _profile.Last().Key;
                    }
                    else
                    {
                        time = int.Parse(split[0]);
                    }
                    if (split[1][0] == '"')
                    {
                        _profile.CustomCommands.Add(time, split[1].Trim('"'));
                    }
                    else
                    {
                        _profile.Add(time, float.Parse(split[1], CultureInfo.InvariantCulture));
                    }
                    line = reader.ReadLine();
                }
                _profile.Name = txtName.Text;
                _profile.DelaySegmentStart = chkSegmentMode.Checked;
                _profile.DelayTolerance    = int.Parse(txtTolerance.Text);
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Неверный формат профиля:" + Environment.NewLine + ex.ToString(),
                                "PID Profile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return(false);
        }