public void DecreaseDuration(object stateInfo, EventArgs e) { leftTime -= TimeSpan.FromSeconds(1); if (leftTime.ToString() == "00:03:00") { TaskbarNotifier tbn = new TaskbarNotifier(); tbn.SetBackgroundBitmap((Image)(global::ManadgementApplication.Properties.Resources.skin), Color.FromArgb(255, 0, 255)); tbn.SetCloseBitmap((Image) (global::ManadgementApplication.Properties.Resources.shutdown),Color.FromArgb(255, 0, 255),new Point(300,74)); tbn.TitleRectangle = new Rectangle(123, 80, 176, 16); tbn.ContentRectangle = new Rectangle(116, 97, 197, 22); tbn.CloseClickable = false; tbn.TitleClickable = true; tbn.ContentClickable = false; tbn.EnableSelectionRectangle = true; string msg = "Devam etmek istiyorsanız lütfen makinaya para atınız."; tbn.Show("Süre Dolmak Üzere !",msg,500,4000,500); } }
private void ThreadMoneyCase() { while (true) { if (machineState.MoneyCount > 0) { //For test purpose only u have 2 change it later //You have 2 close Machine State thread coz it's still running if (isFulscreen) { //if (fullscreenForm == null) // fullscreenForm = new Fulscreen(); try { //lock (fullscreenForm) //{ this.Invoke((MethodInvoker)delegate { fullscreenForm.Hide(); fullscreenForm.StopTheTimer(); }); this.isFulscreen = false; //} } catch (Exception ex) { MessageBox.Show("Error : " + ex.Message); } } //MessageBox.Show("Money Came Here " + machineState.MoneyCount.ToString()); //and the time is not finished yet } if ((machineState.MoneyCount == 0) && !isFulscreen) { try { //lock (fullscreenForm) //{ this.Invoke((MethodInvoker)delegate { fullscreenForm.Show(); }); this.isFulscreen = true; //} } catch (Exception e) { MessageBox.Show("isFulscreen & machineState.MoneyCount " + e.Message); } } //One Second Sleeping .. 4 CPU this.Invoke((MethodInvoker)delegate { digitalDisplayControl1.DigitText = machineState.GetDuration().Hours.ToString() + " : " + machineState.GetDuration().Minutes.ToString() + " : " + machineState.GetDuration().Seconds.ToString(); }); //digitalDisplayControl2.DigitText = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString(); //digitalDisplayControl3.DigitText = String.Format("{}:{}",1); if (machineState.GetDuration().ToString() == "00:02:00") { this.Invoke(new MethodInvoker(delegate() { if (tbn == null) { tbn = new TaskbarNotifier(); } tbn.SetBackgroundBitmap((Image)(global::ManadgementApplication.Properties.Resources.skin), Color.FromArgb(52, 249, 7)); tbn.TitleRectangle = new Rectangle(123, 80, 176, 16); tbn.ContentRectangle = new Rectangle(116, 97, 197, 22); tbn.CloseClickable = false; tbn.TitleClickable = false; tbn.ContentClickable = false; tbn.EnableSelectionRectangle = false; string msg = ""; tbn.Show("", msg, 500, 4000, 500); })); } Thread.Sleep(1000); } }