public AppContext(string appData, string vendorName, string productName, string[] args) { ShutdownMode = ShutdownMode.OnExplicitShutdown; Logger = LogManager.GetLogger(GetType()); _AppDataPath = appData; Directory.CreateDirectory(_AppDataPath); _CloseTimer = new Timer((state) => _TaskbarIcon.CloseBalloon()); var settingsProvider = new RegistrySettingsProvider(vendorName, productName); Settings.Default.Providers.Add(settingsProvider); foreach (SettingsProperty prop in Settings.Default.Properties) { prop.Provider = settingsProvider; } Settings.Default.Reload(); Settings.Default.PropertyChanged += (sender, e) => Settings.Default.Save(); var opts = new OptionSet() { { "startup", (opt) => _OnStartShowOptionsWindow = false } }; opts.Parse(args); }
private void OnReminder(string title, string informativeText) { if (_parentWindow.TryBeginInvoke(OnReminder, title, informativeText)) { return; } void StartButtonClick() { _taskbarIcon.CloseBalloon(); var guid = Toggl.Start("", "", 0, 0, "", "", true); _parentWindow.ShowOnTop(); if (guid != null) { Toggl.Edit(guid, true, Toggl.Description); } } var reminder = new ReminderNotification(_taskbarIcon.CloseBalloon, _parentWindow.ShowOnTop, StartButtonClick) { Title = title, Message = informativeText }; if (!_taskbarIcon.ShowNotification(reminder, PopupAnimation.Slide, TimeSpan.FromSeconds(10))) { _taskbarIcon.ShowBalloonTip(title, informativeText, Properties.Resources.toggl, largeIcon: true); } }
/* * Show message with random word from database */ private void OnMainTimerTick(object sender, EventArgs e) { logger.Trace("Main timer tick"); taskbarIcon.CloseBalloon(); //force close balloon if it's already open DictionaryItem randomWord = GetRandomWord(); if (randomWord != null) { FancyBalloon balloon = new FancyBalloon(mainTimer, randomWord, processAnswerFunction); //show balloon and close it after maxBalloonStayTime if (taskbarIcon != null) { taskbarIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, maxBalloonStayTime); } } else { ErrorBaloon balloon = new ErrorBaloon(); if (taskbarIcon != null) { taskbarIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, maxBalloonStayTime); } } timeLeftCounter = config.ShowInterval; deleteOldLogFiles(); //delete log files older than 10 days }
public void CloseBalloon() { if (_taskBarIcon != null) { _taskBarIcon.CloseBalloon(); } }
public void CloseBaloon() { //the tray icon assigned this attached property to simplify access TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); }
/// <summary> /// Handles the MouseLeftButtonUp event of the grid control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseButtonEventArgs" /> instance containing the event data.</param> private void grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon( ); e.Handled = true; }
public void CloseBalloon() { TaskbarIcon.CloseBalloon(); _lastTrayBalloon.Dispose(); _trayIsReady = true; ProcessNotificationQueue(); }
private void cmdCancel_Click(object sender, RoutedEventArgs e) { //the tray icon assigned this attached property to simplify access TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); }
private void Close_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); e.Handled = true; }
/// <summary> /// Resolves the <see cref="TaskbarIcon"/> that displayed /// the balloon and requests a close action. /// </summary> private void imgClose_MouseDown(object sender, MouseButtonEventArgs e) { //the tray icon assigned this attached property to simplify access TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); }
private void btnClosePopup_Click(object sender, RoutedEventArgs e) { TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); NotifyContent.Clear(); }
private void closeThisBalloon() { TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); if (taskbarIcon != null && taskbarIcon.CustomBalloon != null) { taskbarIcon.CloseBalloon(); } }
private void OnShowViewClicked(ShowTileViewModel obj) { if (ShowViewClicked != null) { ShowViewClicked(this, obj); } TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); }
/// <summary> /// 关闭托盘图标 /// </summary> public void CloseNotifyIcon() { if (_taskbarIcon == null) { return; } _taskbarIcon.CloseBalloon(); _taskbarIcon.Dispose(); _taskbarIcon = null; }
/// <summary> /// 关闭托盘图标 /// </summary> public void CloseNotifyIcon() { if (PART_TaskbarIcon == null) { return; } PART_TaskbarIcon.CloseBalloon(); PART_TaskbarIcon.Dispose(); PART_TaskbarIcon = null; }
private void BaloonLinkRun_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { //the tray icon assigned this attached property to simplify access TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); if (BaloonLinkClicked != null) { BaloonLinkClicked(this, new BaloonClickedEventArgs(Mode)); } }
private void notifiWindowCloseBUtton_Click(object sender, System.Windows.RoutedEventArgs e) { if (isClosing) { return; } TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.ResetBalloonCloseTimer(); taskbarIcon.CloseBalloon(); }
private void ShowNotifyMessage(string message, int second) { soundPlayer.PlaySync(); TaskbarMessage element = new TaskbarMessage() { Text = message, actionClick = () => taskbar.CloseBalloon() }; taskbar.ShowCustomBalloon(element, System.Windows.Controls.Primitives.PopupAnimation.Slide, second * 1000); }
private void Button_Click(object sender, RoutedEventArgs e) { //Process.Start(SiteUri); ResponseViewer rv = new ResponseViewer(); rv.SiteId = SiteId; rv.Show(); //the tray icon assigned this attached property to simplify access TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); }
public void CloseMessagesListLater(bool setAliveTime) { // Sync across threads by invoking it on the dispatcher _myDispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { if (setAliveTime) { _messageListAliveUntil = DateTime.Now + MessageListCloseDelay; } DispatcherInvokeLater(MessageListCloseDelay, () => { if (_messageListAliveUntil <= DateTime.Now) { _taskbarIcon.CloseBalloon(); } else if (_messageListAliveUntil != DateTime.MaxValue) { CloseMessagesListLater(false); } }); })); }
private void btnDelete_Click(object sender, RoutedEventArgs e) { var btn = (Button)sender; var notifyObject = (NotifyObject)btn.Tag; notifyObject.DeleteEvent(notifyObject); NotifyContent.Remove(notifyObject); if (NotifyContent.Count == 0) { //if we removed last item then we can close this popup TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); } }
//点击弹出通知列表 private void btnMessage_Click(object sender, RoutedEventArgs e) { try { TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); } catch (Exception ex) { MethodLb.CreateLog(this.GetType().FullName, "btnMessage_Click", ex.ToString(), sender, e); } finally { } }
private void BalloonContainer_OnClosing(object sender, RoutedEventArgs e) { var balloon = e.OriginalSource as AuctionAlertBalloon; var bMessage = balloon?.DataContext as IBalloonMessage; e.Handled = true; //suppresses the popup from being closed immediately if (bMessage != null) { var lst = this.BalloonList; lst.Remove(bMessage); if (lst.Count == 0) { TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); } } }
protected override async void OnContentRendered(EventArgs e) { base.OnContentRendered(e); Hide(); var notificationView = new NotificationView() { Title = "WPFApp", Message = "The application window has been minimized to tray." }; TaskbarIcon.ShowCustomBalloon(notificationView, PopupAnimation.Slide, 4000); await Task.Delay(4000); TaskbarIcon.CloseBalloon(); }
private bool ShowPopup(PerfGraphMessage perfMessage) { lock ( _syncRoot ) { var viewModel = _userInterface.DataContext as PerfGraphViewModel; if (viewModel != null) { PerfGraphPopup popup = null; if (_notifyIcon.CustomBalloon != null && _notifyIcon.CustomBalloon.Child != null) { popup = _notifyIcon.CustomBalloon.Child as PerfGraphPopup; } var popupViewModel = new PerfGraphPopupViewModel { Message = perfMessage.Content }; popupViewModel.ShowPerfLog += popupViewModel_ShowPerfLog; if (popup != null) { PopupViewModel = popupViewModel; popup.Closed += popup_Closed; _notifyIcon.CloseBalloon( ); return(true); } var perfGraphPopup = new PerfGraphPopup { DataContext = popupViewModel }; _notifyIcon.ShowCustomBalloon(perfGraphPopup, PopupAnimation.Scroll, _popupTimeout); return(true); } } return(false); }
public void ShowSnapPane(bool animate = true) { if (m_ConnectTask == null) { return; } if (m_ConnectTask.Status == TaskStatus.Running || m_ConnectTask.Status == TaskStatus.WaitingForActivation) { // wait for it to complete... Task.Run(async() => { while (m_ConnectTask.Status == TaskStatus.Running || m_ConnectTask.Status == TaskStatus.WaitingForActivation) { await Task.Delay(10); } await Current.Dispatcher.BeginInvoke(new Action <bool>(ShowSnapPane), animate); }).ConfigureAwait(false); return; } if (m_SnapcastClient.ServerData == null) { ShowNotification("Connection error", string.Format("Unable to connect to snapserver at {0}:{1}", SnapSettings.Server, SnapSettings.ControlPort)); return; } if (TaskbarIcon.CustomBalloon == null || TaskbarIcon.CustomBalloon.IsOpen == false) { Hardcodet.Wpf.TaskbarNotification.Interop.Point origin = TaskbarIcon.GetPopupTrayPosition(); origin.Y += 9; // spawn it as close to the taskbar as we can TaskbarIcon.CustomPopupPosition = () => { return(origin); }; SnapControl.SnapControl sc = new SnapControl.SnapControl(origin, m_SnapcastClient); PopupAnimation animation = animate ? PopupAnimation.Slide : PopupAnimation.None; TaskbarIcon.ShowCustomBalloon(sc, animation, null); } else { TaskbarIcon.CloseBalloon(); } }
private void btnMoreDetails_Click(object sender, RoutedEventArgs e) { //Process.Start(SiteUri); ResponseViewer rv = new ResponseViewer(); rv.SiteId = Model.SiteId; rv.Show(); //brings window to top rv.Activate(); rv.Topmost = true; // important rv.Topmost = false; // important rv.Focus(); // important //the tray icon assigned this attached property to simplify access TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); }
/// <summary> ///关闭通知 /// </summary> private void imgClose_MouseDown(object sender, MouseButtonEventArgs e) { try { var window = Common.CommonMethod.GetRootParent(30, this); if (window is Popup) { (window as Popup).IsOpen = false; } TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); } catch (Exception ex) { MethodLb.CreateLog(this.GetType().FullName, "imgClose_MouseDown", ex.ToString(), sender, e); } finally { } }
private void Close() { timer.Stop(); if (Application.Current == null) { return; } if (Application.Current.Dispatcher.CheckAccess()) { //the tray icon assigned this attached property to simplify access TaskbarIcon taskbarIcon = TaskbarIcon.GetParentTaskbarIcon(this); taskbarIcon.CloseBalloon(); } else { Application.Current.Dispatcher.Invoke(new Action(Close)); } }
/// <summary> /// Updated /// </summary> private void PrepareShutdown() { #if TRACE INFO("PrepareShutdown"); #endif // Refresh "Heute" WARNME_CONFIG.WORKINGDAYS[TODAY].EndZeit = NOW; // Commit Values NewDataAvailable(); // Close Forms WorkTable.window.Close(); // Clean up Taskbar Icon notifyWorkDay?.Close(); icon.CloseBalloon(); icon.Icon.Dispose(); icon.Icon = null; icon.Dispose(); }