Exemple #1
0
 private async void Start()
 {
     _temperatureStepDetermined = false;
     _currentStatus             = null;
     _currentScreenMode         = ScreenMode.MainScreen;
     _client         = new NefitClient(Settings.Default.serial, Settings.Default.accessKey, Settings.Default.password);
     _client.XmlLog += Log;
     if (await _client.ConnectAsync())
     {
         tmrUpdate.Enabled = true;
         tmrUpdate_Tick(this, new EventArgs());
     }
     else if (_client.ConnectionStatus == NefitConnectionStatus.InvalidSerialAccessKey)
     {
         MessageBox.Show(@"Authentication error: serial or accesskey invalid, please recheck your credentials", @"Authentication error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         settingsToolStripMenuItem_Click(this, new EventArgs());
     }
     else if (_client.ConnectionStatus == NefitConnectionStatus.InvalidPassword)
     {
         MessageBox.Show(@"Authentication error: password invalid, please recheck your credentials", @"Authentication error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         settingsToolStripMenuItem_Click(this, new EventArgs());
     }
 }
Exemple #2
0
 private async void Start()
 {
     _temperatureStepDetermined = false;
     _currentStatus = null;            
     _currentScreenMode = ScreenMode.MainScreen;
     _client = new NefitClient(Settings.Default.serial, Settings.Default.accessKey, Settings.Default.password);
     _client.XmlLog += Log;
     if (await _client.ConnectAsync())
     {
         tmrUpdate.Enabled = true;
         tmrUpdate_Tick(this,new EventArgs());
     }
     else if (_client.ConnectionStatus == NefitConnectionStatus.InvalidSerialAccessKey)
     {               
         MessageBox.Show(@"Authentication error: serial or accesskey invalid, please recheck your credentials", @"Authentication error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         settingsToolStripMenuItem_Click(this, new EventArgs());
     }
     else if (_client.ConnectionStatus == NefitConnectionStatus.InvalidPassword)
     {
         MessageBox.Show(@"Authentication error: password invalid, please recheck your credentials", @"Authentication error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         settingsToolStripMenuItem_Click(this, new EventArgs());
     }
 }
Exemple #3
0
 private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     tmrUpdate.Enabled = false;
     if (_client != null)
     {
         _client.Disconnect();
     }
     _client.XmlLog -= Log;
     _client = null;
     FrmSettings settings = new FrmSettings();
     settings.ShowDialog();
     Rescale();
     Start();
 }