Example #1
0
 private void BtnStartPause_Click(object sender, EventArgs e)
 {
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
     if (IsRunning)
     {
         BtnStartPause.Text = "Start";
         AutoSaveTimer_Tick(null, null);
         TrayIcon.Icon = Properties.Resources.iconStopped;
         NotifiyFrm.ShowNotify("Timely Tracking Is Paused", Color.Red);
         TrayIcon.Text = "Timely Tracking Is Paused";
     }
     else
     {
         var WorkPeriod = new WorkPeriod();
         WorkPeriod.From = DateTime.Now;
         Session.ActiveWorkTask.WorkPeriods.Add(WorkPeriod);
         Session.ActiveProfile.Save();
         BtnStartPause.Text = "Pause";
         NotifiyFrm.ShowNotify("Timely Tracking Is Running", Color.Green);
         TrayIcon.Text = "Timely Tracking Is Running";
         TrayIcon.Icon = Properties.Resources.iconRunning;
         DisplayWorkTasks(Session.ActiveWorkTask);
     }
     IsRunning             = !IsRunning;
     AutoSaveTimer.Enabled = IsRunning;
 }
Example #2
0
        public static void ShowNotify(string Message, Color MessageColor)
        {
            var frm = new NotifiyFrm();

            foreach (var openFroms in Application.OpenForms)
            {
                if (openFroms is NotifiyFrm)
                {
                    frm = openFroms as NotifiyFrm;
                }
            }
            frm.label1.Text      = Message;
            frm.label1.ForeColor = MessageColor;
            Task.Run(() =>
            {
                frm.TopMost           = true;
                Rectangle workingArea = Screen.GetWorkingArea(frm);
                frm.Location          = new Point(workingArea.Right - frm.Size.Width,
                                                  workingArea.Bottom - frm.Size.Height);
                frm.CloseTimer.Enabled = true;
                frm.ShowDialog();
            });
        }