public static void WriteLine(string line) { try { line = $"{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") } | { line }"; lock (logLock) { File.AppendAllLines(LogFile, new string[] { line }); } if (WriteToConsole) { Console.WriteLine(line); } if (Debugger.IsAttached) { Debug.WriteLine(line); } LogLineAdded?.Invoke(line); } catch (Exception ex) { ShowNotification?.Invoke(ex.ToString()); } }
public void ShowNotificationMessage(string message, string title) { ShowNotification?.Invoke(this, new NotificationEventArgs { Message = message, Title = title }); }
public WorkTimeGui() { showNotification = ShowNotification.not; WorkTime = new TimeCalc(); InitializeComponent(); SetBalloonTip(); this.Text = this.ProductName; this.Icon = (Icon)global::WorkingTimeObserver.Properties.Resources.Worktime_Black; bSmall = false; GuiUpdateTimer_Tick(null, null); WorkTimeGui_Deactivate(null, null); GuiUpdateTimer.Enabled = true; SetGuiPos(); }
public void Process(ShowNotification message) { var notificationId = Guid.NewGuid(); var notificationViewModel = new NotificationViewModel(message.NotificationMessage, notificationId, viewModelCommunication); if (message.SecondsToShow > 0) { Application.Current.Dispatcher.DelayInvoke( () => viewModelCommunication.Send(new HideNotification(notificationId)), TimeSpan.FromSeconds(message.SecondsToShow) ); } notifications.Add(notificationId, notificationViewModel); CurrentVisibleNotifications.Add(notificationViewModel); }
public void Process(ShowNotification message) { }
public void ShowNotificationTest() { ShowNotification request = new ShowNotification("ShowNotificationTest", "Test ShowNotification", KodiJSON.GUI.Params.ShowNotificationParams.images.warning); var result = JsonConvert.DeserializeObject <KodiJSON.GUI.Response.ShowNotificationResponse>(ExecuteTest.GetResponse(request)); }
public ProjectChangeSubscriberBalloonInformant(ShowNotification notificationDelegate) { showBalloon = notificationDelegate; }
public StorageExceptionBalloonInformant(ShowNotification notificationDelegate) { showBalloon = notificationDelegate; }
private void GuiUpdateTimer_Tick(object sender, EventArgs e) { if (WorkTime.update()) { this.Enabled = true; } else { this.Enabled = false; } labelWorkingTime.Text = WorkTime.getWorkTime(); if (WorkTime.isDailyWorkTotalLimit()) { if (showNotification != ShowNotification.Alarmtime) { labelWorkingTime.ForeColor = Color.Red; notifyIcon.BalloonTipIcon = ToolTipIcon.Warning; notifyIcon.Icon = (Icon)global::WorkingTimeObserver.Properties.Resources.Worktime_Red; notifyIcon.BalloonTipText = "Working time is too high! " + WorkTime.getWorkTime(); notifyIcon.Visible = true; notifyIcon.ShowBalloonTip(30); showNotification = ShowNotification.Alarmtime; } } else if (WorkTime.isDailyWorkDone()) { if ((showNotification != ShowNotification.worktime)) { labelWorkingTime.ForeColor = Color.Green; notifyIcon.BalloonTipIcon = ToolTipIcon.Info; notifyIcon.Icon = (Icon)global::WorkingTimeObserver.Properties.Resources.Worktime_Green; notifyIcon.BalloonTipText = "Daily working time limit reached! " + WorkTime.getWorkTime(); notifyIcon.Visible = true; notifyIcon.ShowBalloonTip(30); showNotification = ShowNotification.worktime; } } else { if ((showNotification != ShowNotification.not)) { labelWorkingTime.ForeColor = SystemColors.ControlText; notifyIcon.Icon = (Icon)global::WorkingTimeObserver.Properties.Resources.Worktime_Black; } } notifyIcon.BalloonTipText = "Working Time: " + WorkTime.getWorkTime(); notifyIcon.Text = notifyIcon.BalloonTipText; labelDate.Text = WorkTime.getStartDate(); labelStartTime.Text = WorkTime.getStartTime.ToShortTimeString(); labelCorrection.Text = WorkTime.getCorrectionTime(); labelCoffeeBreak.Enabled = WorkTime.isCoffeeBreak(); labelLunchBreak.Enabled = WorkTime.isLunchBreak(); }