void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { DateTime currentTime = DateTime.Now; DateTime userTime = dateTimePicker.Value; if (currentTime.Hour == userTime.Hour && currentTime.Minute == userTime.Minute && currentTime.Second == userTime.Second) { timer.Stop(); try { UpdateLabel upd = UpdateDataLable; if (lblStatus.InvokeRequired) { Invoke(upd, lblStatus, "Stop"); } SoundPlayer player = new SoundPlayer(); player.SoundLocation = @"D:\mine\Rob Zombie - Living Dead Girl.wav"; player.PlayLooping(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
//Compares current time with saved time so we know when the alarm goes off private void compareCurrentTime(object sender, System.Timers.ElapsedEventArgs e) { //Gets the current time DateTime currentTime = DateTime.Now; //Gets the saved time from the model DateTime userTime = model.getAlarmTime(); if (currentTime.Hour == userTime.Hour && currentTime.Minute == userTime.Minute && currentTime.Second == userTime.Second) { timer.Stop(); try { UpdateLabel update = updateDataLabel; controller.setFormStatus(3); if (lbl_status.InvokeRequired) { Invoke(update, lbl_status, "Alarm Went Off"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Timer_Elapsed(object sender, EventArgs e) { DateTime currentTime = DateTime.Now; DateTime userTime = dateTimePicker.Value; if (currentTime.Hour == userTime.Hour && currentTime.Minute == userTime.Minute && currentTime.Second == userTime.Second) { timer.Stop(); try { UpdateLabel upd = UpdateDataLabel; if (lblStatus.InvokeRequired) { Invoke(upd, lblStatus, "Stop"); } SoundPlayer player = new SoundPlayer(); player.SoundLocation = @"C:\Windows\Media\Alarm01.wav"; player.PlayLooping(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { DateTime currentTime = DateTime.Now; DateTime userTimer = dateTimePicker.Value; if (currentTime.Hour == userTimer.Hour && currentTime.Minute == userTimer.Minute && currentTime.Second == userTimer.Second) { timer.Stop(); try { UpdateLabel updateDataLabel = UpdateDataLabel; if (alarmst.InvokeRequired) { Invoke(updateDataLabel, alarmst, "Stop"); } player.SoundLocation = @"C:\Windows\media\Alarm01.wav"; player.PlayLooping(); } catch (Exception message) { MessageBox.Show(message.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Timer_Elapsed(object sender, ElapsedEventArgs e) { DateTime currentTime = DateTime.Now; DateTime userTime = dateTimePicker1.Value; if (currentTime.Hour == userTime.Hour && currentTime.Minute == userTime.Minute && currentTime.Second == userTime.Second) { timer.Stop(); try { UpdateLabel upd = UpdateDataLabel; if (bunifuCustomLabel1.InvokeRequired) { Invoke(upd, bunifuCustomLabel1, "Alarm is Finished."); } SoundPlayer player = new SoundPlayer(); player.SoundLocation = @"C:\TTP_Ringtone\alarm1.wav"; player.Play(); } catch (Exception ex) { MessageBox.Show(ex.Message, "System Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void UpdateLabelText() { UpdateLabel updateLabel = UpdatDataLabel; if (lbStatus.InvokeRequired) { Invoke(updateLabel, lbStatus, _stop); } }
public void countDown() { currentTime = DateTime.Now - DateTime.Now.Date; userTimer = userTimer.Subtract(new TimeSpan(0, 0, 1)); UpdateLabel upd = UpdateDataLabel; if (timeRemaining.InvokeRequired) { string display = string.Format("{0:D2}:{1:D2}:{2:D2}", userTimer.Hours, userTimer.Minutes, userTimer.Seconds); Invoke(upd, timeRemaining, display); } else { string display = string.Format("{0:D2}:{1:D2}:{2:D2}", userTimer.Hours, userTimer.Minutes, userTimer.Seconds); timeRemaining.Text = display; } //if (userTimer.Equals(currentTime)) if (userTimer.Equals(new TimeSpan(0, 0, 0))) { //Form1 parentForm = (Form1)this.FindForm(); parentForm.removeAlarm(this); //timer.Stop(); try { if (desktopNot) { SoundPlayer player = new SoundPlayer(); player.SoundLocation = @"C:\WINDOWS\MEDIA\Alarm01.wav"; player.PlayLooping(); alarmNotification notifier = new alarmNotification(player); notifier.Message("Part " + this.partType + " will enter Line " + this.lineNumber + " in " + this.alarmT + " minutes."); notifier.Show(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (emailNot) { sendEmail(); } } }
/// <summary> /// Initialized the debug form /// </summary> /// <param name="parent">The parent chooser form</param> public frmDisplay(frmChoose parent) { InitializeComponent(); chooserForm = parent; updateLabel = new UpdateLabel(this.UpdateLabelFunction); displayText = new DisplayText(this.UpdateDisplayTextFunction); spBuffer = new BufferedReader(this); string[] serialPorts = System.IO.Ports.SerialPort.GetPortNames(); cmbPort.Items.AddRange(serialPorts); cmbPort.SelectedIndex = 0; cmbBaudRate.SelectedIndex = 1; serialPort.PortName = cmbPort.Text; }
private void Form1_Load(object sender, EventArgs e) { //delegate to update from from data recieved method _updateLabel = new UpdateLabel(Update_Label); _updateTextBox = new UpdateTextBox(Update_Textbox); _DelegateDataReceived = new DelegateDataReceived(DataReceived); _threadStressTest = null; //_DelegateStressTest = new DelegateStressTest(StressTest); kickoffRead = delegate { try { this.serialPort1.BaseStream.BeginRead(_serialReadBuffer, 0, _serialReadBuffer.Length, delegate(IAsyncResult ar) { try { if (serialPort1.IsOpen) { int actualLength = serialPort1.BaseStream.EndRead(ar); byte[] received = new byte[actualLength]; Buffer.BlockCopy(_serialReadBuffer, 0, received, 0, actualLength); if (actualLength > 0) { DataReceived(received); } } kickoffRead(); } catch (Exception ie)//ie for internql exceeption { MessageBox.Show(ie.Message, "Serial issue"); } }, null); } catch (IOException exc) { if (serialPort1.IsOpen) { serialPort1.Close(); } } }; NewFile(); }
private void cancelSearchOrConvert() { try { searchCancelTokenSource?.Cancel(); } catch (ObjectDisposedException ex) { System.Diagnostics.Debug.WriteLine(ex); } try { convertCancelTokenSource?.Cancel(); } catch (ObjectDisposedException ex) { System.Diagnostics.Debug.WriteLine(ex); } try { UpdateLabel = UpdateLabel.Equals("Operation cancelled") ? "" : "Operation cancelled"; if (null == Files) { Files = new ObservableCollection <CockleFile>(); } else { Files.Clear(); } if (null == FilesConvertedToPdf) { FilesConvertedToPdf = new ObservableCollection <CockleFilePdf>(); } else { FilesConvertedToPdf.Clear(); } DestinationFolderConvertedFiles = string.Empty; SearchText = string.Empty; } catch (ObjectDisposedException ex) { System.Diagnostics.Debug.WriteLine(ex); } }
private void UnHideMainComp() { dataGridView1.Show(); LoggedInfLabel.Show(); LoggedEmailInf.Show(); LogoutButton.Show(); UpdateLabel.Show(); SubjectLabel.Show(); SubjectTextB.Show(); RecipientLabel.Show(); RecipientTextBox.Show(); BodyLabel.Show(); BodyTextBox.Show(); SendButton.Show(); MailSaveButton.Show(); DeserializeButton.Show(); RefreshButton.Show(); }
void ReleaseDesignerOutlets() { if (BackgroundEnabler != null) { BackgroundEnabler.Dispose(); BackgroundEnabler = null; } if (BackgroundTypeButton != null) { BackgroundTypeButton.Dispose(); BackgroundTypeButton = null; } if (DHTSwitcher != null) { DHTSwitcher.Dispose(); DHTSwitcher = null; } if (FTPBackgroundSwitcher != null) { FTPBackgroundSwitcher.Dispose(); FTPBackgroundSwitcher = null; } if (FTPSwitcher != null) { FTPSwitcher.Dispose(); FTPSwitcher = null; } if (UpdateLabel != null) { UpdateLabel.Dispose(); UpdateLabel = null; } if (UpdateLoading != null) { UpdateLoading.Dispose(); UpdateLoading = null; } }
private void getMails() { try { List <Mail> mails = handler.ReadMails(); if (dataGridView1.InvokeRequired) { dataGridView1.Invoke(new tableDelInvoke(deleteTable)); } else { dataGridView1.Rows.Clear(); } foreach (Mail mail in mails) { if (dataGridView1.InvokeRequired) { dataGridView1.Invoke(new tableRowInsInvoke(InsertRowsToTable), mail); } else { dataGridView1.Rows.Add(mail.Date, mail.From, mail.Subject); } } if (UpdateLabel.InvokeRequired) { UpdateLabel.Invoke(new updateTime(UpdateLoggedLabel)); } else { UpdateLabel.Text = "Update on: " + DateTime.Now; } } catch (ImapResponseException ex) { MessageBox.Show(ex.Message); } }
public static void UpdateLabelText(string UIName, string Message) { Label lbTemp; Form form; try { form = Application.OpenForms["FormTerminal"]; if (form == null) { return; } lbTemp = form.Controls.Find(UIName, true).FirstOrDefault() as Label; if (lbTemp == null) { return; } if (lbTemp.InvokeRequired) { UpdateLabel ph = new UpdateLabel(UpdateLabelText); lbTemp.BeginInvoke(ph, UIName, Message); } else { lbTemp.Text = Message; } } catch (Exception e) { logger.Error("UpdateLabelText: Update fail." + e.Message + "\n" + e.StackTrace); } }
/// <summary> /// 修改标签 /// </summary> /// <param name="updateLabel"></param> /// <returns></returns> public Task <HttpResponseMessage> UpdateLabelName(UpdateLabel updateLabel) { ResponseBase response = new ResponseBase(); try { micromsg.UserLabelInfo[] userLabels = new micromsg.UserLabelInfo[1]; userLabels[0] = new micromsg.UserLabelInfo(); userLabels[0].LabelIDList = updateLabel.LabelIDList; userLabels[0].UserName = updateLabel.ToWxId; var result = wechat.ModifyContactLabelList(updateLabel.WxId, userLabels); if (result == null || result.BaseResponse.Ret != (int)MMPro.MM.RetConst.MM_OK) { response.Success = false; response.Code = "501"; response.Message = result.BaseResponse.ErrMsg.String ?? "修改失败"; } else { response.Message = "修改成功"; } } catch (ExpiredException ex) { response.Success = false; response.Code = "401"; response.Message = ex.Message; } catch (Exception ex) { response.Success = false; response.Code = "500"; response.Message = ex.Message; } return(response.ToHttpResponseAsync()); }
public void UpdeteElementLabel(int id, string name) { GetModel.GetElement(id).LabelName = name; UpdateLabel?.Invoke(id, name); }
public Message() { MsgUpdateLabel = new UpdateLabel(); }
public planTime() { InitializeComponent(); mTime = new Time(); updateLabel = new UpdateLabel(UpdateTime);//实例化一个委托对象 }