private void ConfigNotifier(NotifierConfiguration cfg) { #if DEBUG System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); #endif cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.TopRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }
public MainWindow() { InitializeComponent(); BrowserControl.LinkClicked += HtmlPanel_LinkClicked; _notifier = new Notifier(cfg => { //place the notifications approximately inside the main editing area //(not over the toolbar area) on the top-right hand side cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.TopRight, offsetX: 15, offsetY: 90); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(5), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); _urlsByHash = new Dictionary <string, string>(); _bookmarkManager = new BookmarkManager(this, BrowserControl); AppInit.UpgradeSettings(); AppInit.CopyAssets(); _bookmarkManager.RefreshBookmarkMenu(); var launchUri = _settings.HomeUrl; string[] args = App.Args; if (args != null) { launchUri = App.Args[0]; } Navigate(launchUri); BuildThemeMenu(); TickSelectedThemeMenu(); }
protected override void Execute(CodeActivityContext context) { var message = Message.Get(context); //var title = Title.Get(context); //var duration = Duration.Get(context); var notificationType = NotificationType.Get(context); if (notifier == null) { notifier = new Notifier(cfg => { //cfg.PositionProvider = new WindowPositionProvider( // parentWindow: GenericTools.mainWindow, // corner: Corner.TopRight, // offsetX: 10, // offsetY: 10); cfg.PositionProvider = new PrimaryScreenPositionProvider( corner: Corner.BottomRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = System.Windows.Application.Current.Dispatcher; }); } if (notificationType == "Information") { notifier.ShowInformation(message); } if (notificationType == "Success") { notifier.ShowSuccess(message); } if (notificationType == "Warning") { notifier.ShowWarning(message); } if (notificationType == "Error") { notifier.ShowError(message); } }
private void TestTimer_Click(object sender, EventArgs e) { DateTime now; now = DateTime.Now.Date; TimeSpan dif; foreach (Subscription sub in SubList.subscriptions.ToList()) { TimeSpan zero = new TimeSpan(0, 0, 0); if (sub.dateOfReminder - DateTime.Now >= zero) { dif = sub.dateOfReminder - DateTime.Now; } else { dif = new TimeSpan(0, 0, 0); } if (DateTime.Now.Date == sub.dateOfReminder.Date && dif.Seconds == 0) { Notifier notifier = new Notifier(cfg => { // Sound alert, and remove feature possible removed int added cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(250), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); string message = "ATTENTION! Here is your reminder for your " + sub.name + " " + "subscription!"; notifier.ShowWarning(message); sub.deleted = 1; SubList.subscriptions.Remove(sub); System.Media.SystemSounds.Exclamation.Play(); } } }
private static void ShowToastInformation(string message, bool autoClear, Corner position) { if (notifier == null) { notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: DesktopApplication.MainWindow, corner: position, offsetX: 75, offsetY: 100); if (autoClear) { cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(6)); } else { cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromHours(1), maximumNotificationCount: MaximumNotificationCount.FromCount(6)); } cfg.DisplayOptions.TopMost = true; cfg.DisplayOptions.Width = 400; cfg.Dispatcher = DesktopApplication.Dispatcher; }); } var options = new MessageOptions { CloseClickAction = CloseAction, FontSize = 14, // set notification font size FreezeOnMouseEnter = true, UnfreezeOnMouseLeave = true, ShowCloseButton = true }; notifier.ShowInformation(message, options); }
public notify(Window window, Corner corner) { sock = App.socketController; notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: window, corner: corner, offsetX: 0, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(2)); cfg.DisplayOptions.Width = 300; cfg.Dispatcher = App.Current.Dispatcher; }); }
private void CreateNotifier(Akka.Configuration.Config config) { var uiNotificationWidth = config.GetInt("ui.notification.width"); var uiNotificationLifetime = config.GetTimeSpan("ui.notification.lifetime"); var uiNotificationMax = config.GetInt("ui.notification.maximum-count"); Notifier = new Notifier(cfg => { cfg.DisplayOptions.Width = uiNotificationWidth; cfg.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 0, 0); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: uiNotificationLifetime, maximumNotificationCount: MaximumNotificationCount.FromCount(uiNotificationMax)); cfg.Dispatcher = Application.Current.Dispatcher; }); }
/// <summary> /// Creates notifier used for sending toast notifs; in top-right /// </summary> private void CreateNotifier() { // Create notifier for use with toast notifications _notifier = new Notifier(cfg => { cfg.PositionProvider = new PrimaryScreenPositionProvider( corner: Corner.TopRight, offsetX: 8, offsetY: 23); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(5), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.DisplayOptions.TopMost = true; cfg.Dispatcher = Application.Current.Dispatcher; }); }
public void Info(string message) { Notifier notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.TopRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); notifier.ShowInformation(message); }
public Notifier GetNotifier() { Notifier notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.TopRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); return(notifier); }
public AddDeviceWindow() { InitializeComponent(); notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomRight, offsetX: 5, offsetY: 5); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); }
public Notifiercs() { notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomCenter, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = false; }); }
public Logger(List <Alert> alerts, List <Mode> modes) { this.Alerts = alerts; this.Modes = modes; notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.TopRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); }
public void ReinitializeToast() { if (_isInitialzed) { return; } _notificationManager = new Notifier(cfg => { cfg.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 5, 65); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(5), MaximumNotificationCount.FromCount(3)); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = true; cfg.DisplayOptions.Width = 250; }); _isInitialzed = true; }
public AllTodosViewModel(TodoItemService service) { IsLoading = true; _service = service; _notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.TopRight, offsetX: 10, offsetY: 40); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(3)); cfg.Dispatcher = Application.Current.Dispatcher; }); }
public MainViewModelNotificacao() { _notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomRight, offsetX: 25, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(10), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = true; cfg.DisplayOptions.Width = 250; }); }
public VisualizerWindow(IRLVCore core) { InitializeComponent(); this.core = core; this.visualizer = new RLVOutputVisualizer(this); IRLVScaleSelectionVM scaleVM = new RLVScaleSelectionVM(); detailsScalePanel = rlv.DetailsControl.ScalePanel; chartScalePanel = rlv.ChartControl.ScalePanel; detailsScalePanel.SetViewModel(scaleVM); chartScalePanel.SetViewModel(scaleVM); scaleVM.DefaultScale = 100; core.SetupVisualizer(new List <IRLVPanel> { rlv.DetailsControl, rlv.ChartControl, chartScalePanel, detailsScalePanel }, visualizer); this.Closing += VisualizerWindow_Closing; notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: this, corner: Corner.TopRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); }
private void sendBtn_Click(object sender, RoutedEventArgs e) { Notifier notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: this, corner: Corner.BottomRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(8), maximumNotificationCount: MaximumNotificationCount.FromCount(4)); cfg.Dispatcher = Application.Current.Dispatcher; }); string toEmail = emailBox.Text; string subject = "Password-Nuvola:no-reply"; string message = "Your password is 123456"; string myEmailPass = ""; // Insert my password try { MailMessage mail = new MailMessage("*****@*****.**", toEmail); mail.Subject = subject; mail.Body = message; SmtpClient client = new SmtpClient(); client.Host = "smtp.googlemail.com"; client.Port = 587; client.UseDefaultCredentials = false; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.EnableSsl = true; client.Credentials = new System.Net.NetworkCredential("*****@*****.**", myEmailPass); client.Send(mail); } catch (Exception ex) { notifier.ShowError(ex.Message); } }
private static void InitNotifier() { if (isInit) { return; } _notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(2), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); }
public judgeStateToast() { notifier = new Notifier(cfg => { if (cfg.PositionProvider == null) { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.TopRight, offsetX: 80, offsetY: 110); } if (cfg.LifetimeSupervisor == null) { cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(5), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); } cfg.Dispatcher = Application.Current.Dispatcher; }); }
private Notifier NotifierOutWindow() { return(_notifier = new Notifier(cfg => { cfg.PositionProvider = new PrimaryScreenPositionProvider( corner: Corner.BottomRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromDays(99), maximumNotificationCount: MaximumNotificationCount.FromCount(6)); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = true; cfg.DisplayOptions.Width = 250; })); _notifier.ClearMessages(new ClearAll()); }
public Notifier GetNotifier(Window targetWindow, Dispatcher dis) { var notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: targetWindow, corner: Corner.TopRight, offsetX: 0, offsetY: 0 ); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5) ); cfg.Dispatcher = dis; }); return(notifier); }
public static Notifier initPrecentageNotifier() { Notifier notifier = new Notifier(cfg => { cfg.DisplayOptions.TopMost = true; cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(4), maximumNotificationCount: MaximumNotificationCount.FromCount(1)); cfg.Dispatcher = Application.Current.Dispatcher; }); return(notifier); }
private void Window_Loaded(object sender, RoutedEventArgs e) { MyServer.GetInstance().Start(); ResetFont(); notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomCenter, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); }
public ToastViewModel() { _notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomLeft, offsetX: 25, offsetY: 100); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(4), maximumNotificationCount: MaximumNotificationCount.FromCount(4)); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = false; cfg.DisplayOptions.Width = 245; }); _notifier.ClearMessages(new ClearAll()); }
public MainWindow() { InitializeComponent(); notifier_ = new Notifier( config => { config.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 5, 5); config.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( TimeSpan.FromSeconds(5), MaximumNotificationCount.FromCount(5)); //config.Dispatcher = Dispatcher.CurrentDispatcher; config.DisplayOptions.TopMost = true; config.DisplayOptions.Width = 420; }); Application.Current.MainWindow.Closing += MainWindow_Closing; FetchNetworkAdapterStatus(); eventWatcher = new NetworkAdapterEventWatcher(); eventWatcher.NetworkAdapterEventArrived += EventWatcher_NetworkAdapterEventArrived; }
private Notifier NotifierInWindow() { return(_notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomCenter, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(6)); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = true; cfg.DisplayOptions.Width = 250; })); _notifier.ClearMessages(new ClearAll()); }
public ToastInstance() { _notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomRight, offsetX: 20, offsetY: 30); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(6), maximumNotificationCount: MaximumNotificationCount.FromCount(6)); cfg.Dispatcher = Application.Current.Dispatcher; cfg.DisplayOptions.TopMost = true; cfg.DisplayOptions.Width = 250; }); _notifier.ClearMessages(); }
public CartUserControl() { InitializeComponent(); deviceList.ItemsSource = Devices; Text_ItemCount.Text = Devices.Count.ToString(); Text_OverallPrice.Text = (Devices.Count == 0 ? "0" : Devices.Sum(d => d.Price).ToString()) + "$"; notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: Application.Current.MainWindow, corner: Corner.BottomRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(5)); cfg.Dispatcher = Application.Current.Dispatcher; }); }
/// <summary> /// IndividualAddEdit constructor /// </summary> /// <param name="IndividualViewModel"></param> public IndividualAddEdit(IndividualViewModel IndividualViewModel) { // Initialize service this.individualService = DependencyResolver.Kernel.Get <IIndividualService>(); // Draw all components InitializeComponent(); this.DataContext = this; // Initialize notifications notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider( parentWindow: System.Windows.Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(), corner: Corner.TopRight, offsetX: 10, offsetY: 10); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(3), maximumNotificationCount: MaximumNotificationCount.FromCount(3)); cfg.Dispatcher = Application.Current.Dispatcher; }); CurrentIndividual = IndividualViewModel; if (CurrentIndividual.Code <= 0) { CurrentIndividual.Code = individualService.GetNewCodeValue().Code; } // Add handler for keyboard shortcuts AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleKeyDownEvent); txtName.Focus(); }