public formMain() { InitializeComponent(); //stop = false; trackBar1.Enabled = false; trackBar1.Visible = false; trackBar2.Enabled = false; trackBar2.Visible = false; trackBar3.Enabled = false; trackBar3.Visible = false; trackBar4.Enabled = false; trackBar4.Visible = false; trackBar5.Enabled = false; trackBar5.Visible = false; _actionsQueued = 0; //setup db context try { _dbContext = new LutronControlModelsContainer(); } catch (Exception) { throw; } //setup sensor/batleth controllers try { _batlethController = new BatlethController(_dbContext); } catch (Exception) { this.tabControl.TabPages.Remove(this.tabBatleth); } finally { if (_batlethController != null) { _batlethController.OnSensorReadingsTaken += batlethController_OnSensorReadingsTaken; timerSensors.Enabled = true; } } try { _fixtureController = new FixtureController(); } catch (Exception) { this.tabControl.TabPages.Remove(this.tabSkyWall); } finally { } /// /// calibration worker not impl. /// //try //{ // calibrationWorker = new CalibrationWorker(fixtureController, batlethController); //} //catch (Exception) //{ } //finally //{ //} }
private async void SlideFixture(IFixtureController controller, IOrderedEnumerable <Fixture> fixtures, int panelNum) { int level = 0; if (panelNum == 0) { this.Invoke((MethodInvoker) delegate { // runs on UI thread level = int.Parse(textBox3.Text); }); try { await Task.Run(() => controller.setWallLevelByPanel((ushort)level, panelNum)); } catch (Exception ex) { MessageBox.Show(@"problem during transmission of command to lutron panel/area: " + ex.ToString()); } finally { this.Invoke((MethodInvoker) delegate { label1.Text = level.ToString() + "%"; }); } } if (panelNum == 1) { this.Invoke((MethodInvoker) delegate { level = int.Parse(textBox4.Text); }); try { await Task.Run(() => controller.setWallLevelByPanel((ushort)level, panelNum)); } catch (Exception ex) { MessageBox.Show(@"problem during transmission of command to lutron panel/area: " + ex.ToString()); } finally { this.Invoke((MethodInvoker) delegate { label2.Text = level.ToString() + "%"; }); } } if (panelNum == 2) { this.Invoke((MethodInvoker) delegate { // runs on UI thread level = int.Parse(textBox5.Text);; }); try { await Task.Run(() => controller.setWallLevelByPanel((ushort)level, panelNum)); } catch (Exception ex) { MessageBox.Show(@"problem during transmission of command to lutron panel/area: " + ex.ToString()); } finally { this.Invoke((MethodInvoker) delegate { label3.Text = level.ToString() + "%"; }); } } if (panelNum == 3) { this.Invoke((MethodInvoker) delegate { // runs on UI thread level = int.Parse(textBox6.Text); }); try { await Task.Run(() => controller.setWallLevelByPanel((ushort)level, panelNum)); } catch (Exception ex) { MessageBox.Show(@"problem during transmission of command to lutron panel/area: " + ex.ToString()); } finally { this.Invoke((MethodInvoker) delegate { label4.Text = level.ToString() + "%"; }); } } if (panelNum == 4) { this.Invoke((MethodInvoker) delegate { // runs on UI thread level = int.Parse(textBox7.Text); }); try { await Task.Run(() => controller.setWallLevelByPanel((ushort)level, panelNum)); } catch (Exception ex) { MessageBox.Show(@"problem during transmission of command to lutron panel/area: " + ex.ToString()); } finally { this.Invoke((MethodInvoker) delegate { label5.Text = level.ToString() + "%"; }); } } }
public PersistenceController(IClientConnector client, ISpecFileWatcher watcher, IFixtureController fixtures) { _client = client; _watcher = watcher; _fixtures = fixtures; }