Пример #1
0
        internal bool ConnectToDevice()
        {
            SettingsForm f = new SettingsForm(new MainForm());

            f.registerModelCombo.SelectedItem = settings.RegisterModel;
            f.portSpeedCombo.SelectedItem = settings.PortSpeed;
            objArtSoft.start(f.registerModelCombo.SelectedIndex);

            isDone = objArtSoft.openPort(settings.PortName, f.portSpeedCombo.SelectedIndex);

            if (isDone == false)
            {
                /*if (this.isConnectedToRegister)
                {
                    return true;
                }*/
                StringBuilder sp = new StringBuilder();

                sp.Append("Ошибка при подлкючении\r\n");
                sp.Append("LastErrorText = " + objArtSoft.LastErrorText + "\r\n");
                if (objArtSoft.LastErrorExText.Length > 0)
                {
                    sp.Append("LastErrorExText = " + objArtSoft.LastErrorExText + "\r\n");
                }

                string res = sp.ToString();
            }

            f = null;
            return isDone;
        }
Пример #2
0
        private void btnSettings_Click(object sender, EventArgs e)
        {
            SettingsForm frm = new SettingsForm(this);
            frm.SetValues();

            if (frm.ShowDialog() == DialogResult.Yes)
            {
                this.settings.Url = frm.urlFld.Text;
                this.settings.ApiKey = frm.apiKeyFld.Text;
                this.settings.PortName = frm.portNameCombo.SelectedItem.ToString();
                this.settings.PortSpeed = frm.portSpeedCombo.SelectedItem.ToString();
                this.settings.RegisterModel = frm.registerModelCombo.SelectedItem.ToString();
                this.settings.StartAfterRun = frm.checkStartAfterRun.Checked;

                if (SaveSettingsToFile())
                {
                    SetSettingsInfo();
                    this.AddToLog("Данные сохранены");
                }
            }
        }