/// <summary> /// Starts to take asynchronous readings from the Laser /// </summary> public override void Start() { if ((mainThread != null) && mainThread.IsAlive) { return; } mainThread = new Thread(new ThreadStart(MainThreadTask)); mainThread.IsBackground = true; mainThread.Start(); running = true; status = LaserStatus.Running; }
public void SetLaserDisconnected() { // Ustaw status lasera laserStatus = LaserStatus.Disconnected; // Odbierz uzytkownikowi kontrole setControlPanelDisabled(); // System informuje o rozlaczeniu setStatusBarMessage(DateTime.Now + " Rozlaczono z urzadzeniem"); setStatusBoxStatus(StatusBoxStatus.Disconnected, null); // Przycisk goConnect.Text = "Polacz"; }
public void SetLaserConnected(string portNameFound) { // Ustaw status lasera laserStatus = LaserStatus.Connected; // Pozwol uzytkownikowi na dostep do panelu setControlPanelEnabled(); // System informuje o polaczeniu setStatusBoxStatus(StatusBoxStatus.Connected, portNameFound); setStatusBarMessage(DateTime.Now + " Polaczono pomyslnie z " + portNameFound); listBoxTerminal.Items.Add("[" + DateTime.Now + "] Connected at " + portNameFound); // Przycisk goConnect.Text = "Rozlacz"; }
/// <summary> /// Stops the Laser /// </summary> public override void Stop() { if ((mainThread == null) || !mainThread.IsAlive) { return; } running = false; mainThread.Join(100); if (mainThread.IsAlive) { mainThread.Abort(); mainThread.Join(); } status = LaserStatus.Stoped; }
//================================================================================================================================================ TERMINAL #endregion Terminal private void MainForm_Load(object sender, EventArgs e) { //Schowaj sideMenu + Schowaj wszystie podopcje w sideMenu sidePanelHide(); listBoxTerminal.Items.Add("AOGL 1.0"); // Sprawdź stan sterownika checkDriverInstalled(); // Laser disconnected laserStatus = LaserStatus.Disconnected; SetLaserDisconnected(); setStatusBarMessage(DateTime.Now + " Witamy w aplikacji obsługi grawera laserowego."); __laserPowerValue = (int)laserPower.Value; __sliderFeedrateValue = (int)sliderFeedrate.Value * __sliderFeedrateRate; __sliderStepValue = (int)sliderStep.Value * __sliderStepRate; labelSliderFeedRateValue.Text = (sliderFeedrate.Value * __sliderFeedrateRate).ToString(); labelSliderStepValue.Text = (sliderStep.Value * __sliderStepRate).ToString(); welcomeForm = new WelcomeForm(this) { Dock = DockStyle.Fill, TopLevel = false, TopMost = true, }; tabControl.TabPages[0].Controls.Add(welcomeForm); welcomeForm.Show(); // Load Latest Files if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\last.aogl")) { Debug.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\last.aogl"); loadFilesToWelcome(); } else { Debug.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\last.aogl doesnt exist"); File.Create(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\last.aogl"); } }