Exemple #1
0
        public MainWindow()
        {
            Notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new ControlPositionProvider(
                    parentWindow: this,
                    trackingElement: MainGrid,
                    corner: Corner.BottomRight,
                    offsetX: 5,
                    offsetY: 5);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(1.5),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));

                cfg.DisplayOptions.TopMost = false;

                cfg.DisplayOptions.Width = 230;

                cfg.Dispatcher = Application.Current.Dispatcher;
            });

            StartPage          = new StartPage();
            ServiceListPage    = new ServiceListPage(Notifier);
            ChangePasswordPage = new ChangePasswordPage(Notifier);

            InitializeComponent();
            ApplicationFrame.Content = StartPage;

            _timer          = new Timer(1000);
            _timer.Elapsed += _timer_Elapsed;
            _timer.Start();
        }
Exemple #2
0
 private static Notifier CreateNotifier(NotifyOptions opt)
 {
     return(new Notifier(cfg =>
     {
         if (opt.Parent == null)
         {
             cfg.PositionProvider = new PrimaryScreenPositionProvider(
                 (Corner)opt.Corner, opt.OffsetX, opt.OffsetY);
         }
         else
         {
             cfg.PositionProvider = new WindowPositionProvider(
                 opt.Parent, (Corner)opt.Corner, opt.OffsetX, opt.OffsetY);
         }
         if (opt.LifeTime.TotalMilliseconds < 100)
         {
             cfg.LifetimeSupervisor = new CountBasedLifetimeSupervisor(MaximumNotificationCount.FromCount(opt.MaxCount));
         }
         else
         {
             cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(opt.LifeTime,
                                                                              MaximumNotificationCount.FromCount(opt.MaxCount));
         }
         cfg.Dispatcher = dispatcher;
         cfg.DisplayOptions.Width = opt.With;
     }));
 }
Exemple #3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // Test translations
            //System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("zh-HANS");

            // upgrade assembly version of saved settings (if required)
            //Certify.Properties.Settings.Default.UpgradeSettingsVersion(); // deprecated
            //Certify.Management.SettingsManager.LoadAppSettings();

            var currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += CurrentDomain_UnhandledException;

            base.OnStartup(e);

            Log?.Information("UI Startup");

            // setup notifications toast handler
            _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;
            });
        }
Exemple #4
0
        public override void Configure(IExportRegistrationBlock block)
        {
            block.ExportModuleScope <SimpleEffectsMiddleware <GlobalState> >();
            block.ExportModuleScope <Storage>();
            block.ExportModuleScope <MainReducer>();
            block.ExportModuleScope <SerialUtil>();
            block.ExportModuleScope <StudentCardService>();
            block.ExportModuleScope <PhotoService>();
            block.ExportModuleScope <AudioService>();
            block.ExportModuleScope <ModuleActivator>();
            block.ExportModuleScope <WindowPageHost>().As <IPageHost>();
            block.ExportModuleScope <TimerService <LessonInterval, AlarmEvent> >();
            block.ExportModuleScope <DatabaseBackupService>();
            var notifier = new Notifier(configuration =>
            {
                configuration.PositionProvider   = new PrimaryScreenPositionProvider(Corner.BottomRight, 10, 10);
                configuration.LifetimeSupervisor =
                    new TimeAndCountBasedLifetimeSupervisor(
                        TimeSpan.FromMilliseconds(5000),
                        MaximumNotificationCount.FromCount(5));
                configuration.Dispatcher = Application.Current.Dispatcher;
            });

            block.ExportInstance(notifier);
        }
Exemple #5
0
        public App()
        {
            Window MainWindow = new Window();

            loger = new Loger(new List <Alert> {
                Alert.CONSOLE
            }, new List <Mode> {
                Mode.CONSOLE
            });
            loger.Log(TAG, this, "Mon test");

            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.ShowSuccess(TAG);
        }
Exemple #6
0
        public MainWindow()
        {
            _viewModel       = new ViewModels.MainWindow();
            this.DataContext = _viewModel;

            _notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new WindowPositionProvider(
                    parentWindow: this,
                    corner: Corner.BottomRight,
                    offsetX: 10, offsetY: 10);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(3),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));
                cfg.Dispatcher = this.Dispatcher;
            });

            InitializeComponent();

            CreateTimers();

            InputManager.Current.PostProcessInput += (sender, e) =>
            {
                if (e.StagingItem.Input is MouseButtonEventArgs)
                {
                    GlobalClickEventHandler(sender, (MouseButtonEventArgs)e.StagingItem.Input);
                }
            };
        }
 /// <summary>
 /// This method is used for show the toaster notification
 /// </summary>
 /// <param name="currentWindow"></param>
 /// <param name="notification"></param>
 public void ShowUINotification(Window currentWindow, NotificationUI notification)
 {
     try
     {
         notifier = new Notifier(cfg =>
         {
             cfg.PositionProvider = new WindowPositionProvider(parentWindow: currentWindow, corner: Corner.TopRight,
                                                               offsetX: Convert.ToInt32(ToasterSize.Ten), offsetY: Convert.ToInt32(ToasterSize.Ten));
             cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                 notificationLifetime: TimeSpan.FromSeconds(Convert.ToInt32(ToasterSize.Three)),
                 maximumNotificationCount: MaximumNotificationCount.FromCount(Convert.ToInt32(ToasterSize.Five)));
             cfg.Dispatcher = Application.Current.Dispatcher;
         });
         MessageOptions messageOptions = new MessageOptions();
         messageOptions.FontSize             = Convert.ToInt32(ToasterSize.Fourteen);
         messageOptions.UnfreezeOnMouseLeave = true;
         if (notification.MessageType == "warning")
         {
             notifier.ShowWarning(notification.Message, messageOptions);
         }
         else if (notification.MessageType == "success")
         {
             notifier.ShowSuccess(notification.Message, messageOptions);
         }
         else if (notification.MessageType == "error")
         {
             notifier.ShowError(notification.Message, messageOptions);
         }
     }
     catch
     {
         throw;
     }
 }
Exemple #8
0
        public static Notifier Startup(ILog log, ViewModel.AppViewModel mainViewModel, StartupEventArgs e)
        {
            log?.Information("UI Startup");

            mainViewModel.UISettings = Settings.UISettings.Load();

            // Apply translations if required
            if (mainViewModel.UISettings != null)
            {
                ChangeCulture(mainViewModel.UISettings.PreferredUICulture, false);
            }

            // setup notifications toast handler
            return(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;
            }));
        }
Exemple #9
0
        public MainUserControl()
        {
            InitializeComponent();

            using (ShopDB db = new ShopDB())
            {
                Devices = db.GetDevices();
            }
            deviceList.ItemsSource = Devices;

            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;
            });
          
        }
Exemple #10
0
        public PeachesEventViewModel(IEventAggregator eventAggregator)
        {
            DateTime t  = DateTime.Now;
            DateTime t2 = DateTime.Now;

            _eventAggregator   = eventAggregator;
            _dialogCoordinator = DialogCoordinator.Instance;
            Events             = new ObservableCollection <PeachesEvent>();
            Timers             = new List <Timer>();
            var license = new LicenseHelper();

            LicenseKey = license.GetLicenseInfo();
            Notifier   = new Notifier(cfg =>
            {
                cfg.PositionProvider = new PrimaryScreenPositionProvider(
                    corner: Corner.TopRight,
                    offsetX: 10,
                    offsetY: 10);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(6),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });
        }
        public IzmenaSoftvera(RacunarskiCentar racunarskiCentar, ObservableCollection <Softver> softveri, List <int> indeksi,
                              UndoRedoStack stek, OrderedDictionary prethodnaStanja, Notifier notifierMainWindow)
        {
            notifierError = new Notifier(cfg =>
            {
                cfg.PositionProvider = new WindowPositionProvider(
                    parentWindow: this,
                    corner: Corner.TopRight,
                    offsetX: 20,
                    offsetY: 10);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: System.TimeSpan.FromSeconds(5),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(1));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });

            InitializeComponent();
            this.potvrdaIzmena             = false;
            this.stekStanja                = stek;
            this.prethodnaStanjaAplikacije = prethodnaStanja;
            this.racunarskiCentar          = racunarskiCentar;
            this.indeksiZaIzmenu           = indeksi;
            this.notifierMainWindow        = notifierMainWindow;
            tabelaSoftvera = softveri;
            nazivSoftver.Focus();
        }
Exemple #12
0
        public Toaster()
        {
            _notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new PrimaryScreenPositionProvider(
                    corner: Corner.TopRight,
                    offsetX: 5,
                    offsetY: 5);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(5),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(6));

                cfg.Dispatcher = Application.Current.Dispatcher;

                cfg.DisplayOptions.TopMost = true;
                cfg.DisplayOptions.Width   = 250;
            });

            _notifier.ClearMessages();

            options = new MessageOptions
            {
                FreezeOnMouseEnter   = false,
                UnfreezeOnMouseLeave = false,
                ShowCloseButton      = true
            };
        }
        private void loginBtn_Click(object sender, RoutedEventArgs e)
        {
            if (usernameBox.Text == "" || passwordBox.Password == "")
            {
                Notifier n = new Notifier(cfg =>
                {
                    cfg.PositionProvider = new WindowPositionProvider(
                        parentWindow: this,
                        corner: Corner.BottomRight,
                        offsetX: 10,
                        offsetY: 10);

                    cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                        notificationLifetime: TimeSpan.FromSeconds(2),
                        maximumNotificationCount: MaximumNotificationCount.FromCount(1));

                    cfg.Dispatcher = Application.Current.Dispatcher;
                });

                n.ShowWarning("Please fill all required values.");
            }
            else
            {
                string hashPassword = ComputeHash(passwordBox.Password, new MD5CryptoServiceProvider());

                string data = "200";
                data += usernameBox.Text.Length.ToString().PadLeft(2, '0');
                data += SocketHandler.Encipher(usernameBox.Text, "cipher");
                data += hashPassword.Length.ToString().PadLeft(2, '0');
                data += SocketHandler.Encipher(hashPassword, "cipher");

                SocketHandler sh = new SocketHandler();
                try
                {
                    sh.sendData(data);
                    string result = sh.recvData();
                    if (result.Equals("1000"))
                    {
                        LoadingPage app = new LoadingPage();
                        this.Close();
                        app.Show();
                    }
                    else
                    {
                        Notifier n = AsyncBlockingSocket.initNotifier();
                        n.ShowWarning("Wrong username or password");
                    }
                }
                catch (SocketException ex)
                {
                    Notifier n = AsyncBlockingSocket.initNotifier();
                    n.ShowError(ex.Message);
                }
                catch (Exception ex)
                {
                    Notifier n = AsyncBlockingSocket.initNotifier();
                    n.ShowError(ex.Message);
                }
            }
        }
        public ConnectWindow()
        {
            InitializeComponent();
            TbIP.Text    = (string)Properties.Settings.Default["HostIP"];
            _application = (App)Application.Current;
            _application.melonPlayer.OnStateChange += OnStateChange;

            // test notifications
            _notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new WindowPositionProvider(
                    Application.Current.MainWindow,
                    Corner.BottomCenter,
                    0,
                    0
                    );

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    TimeSpan.FromSeconds(3),
                    MaximumNotificationCount.FromCount(5)
                    );

                cfg.Dispatcher = Application.Current.Dispatcher;
            });
        }
Exemple #15
0
        private void TokenButton_Click(object sender, RoutedEventArgs e)
        {
            UploadButton.IsEnabled = false;
            Task.Run(() =>
            {
                if (!string.IsNullOrEmpty(ViewModel.Token) && !string.IsNullOrEmpty(ViewModel.Path))
                {
                    string html = string.Empty;
                    string url  = @"https://ballchasing.com/api/";

                    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                    request.Headers.Add("Authorization", ViewModel.Token);
                    request.Timeout = 5000;
                    try
                    {
                        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                            using (Stream stream = response.GetResponseStream())
                            {
                                Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                                {
                                    NavigationService ns = NavigationService.GetNavigationService(this);
                                    UploadView page      = new UploadView(ViewModel.Token, ViewModel.Path);
                                    ns.Navigate(page);
                                }));
                            }
                    }
                    catch (WebException err)
                    {
                        if (((HttpWebResponse)err.Response).StatusCode == HttpStatusCode.Unauthorized)
                        {
                            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                            {
                                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.ShowError("Bad Token");
                            }));
                        }
                    }
                    finally
                    {
                        Application.Current.Dispatcher.BeginInvoke(new Action(() => { UploadButton.IsEnabled = true; }));
                    }
                }
            });
        }
        private static INotificationsLifetimeSupervisor CreateLifetimeSupervisor(NotificationLifetimeType lifetime)
        {
            if (lifetime == NotificationLifetimeType.Basic)
            {
                return(new CountBasedLifetimeSupervisor(MaximumNotificationCount.FromCount(5)));
            }

            return(new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(5), MaximumNotificationCount.UnlimitedNotifications()));
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DataGrid    dataGridVar = dataGrid;
            DataGridRow Row         = (DataGridRow)dataGridVar.ItemContainerGenerator.ContainerFromIndex(dataGridVar.SelectedIndex);

            DataGridCell atUserCol   = (DataGridCell)dataGridVar.Columns[2].GetCellContent(Row).Parent;
            DataGridCell fileNameCol = (DataGridCell)dataGridVar.Columns[0].GetCellContent(Row).Parent;
            string       atUser      = ((TextBlock)atUserCol.Content).Text;
            string       fileName    = ((TextBlock)fileNameCol.Content).Text;

            if (isUserConntected(atUser))
            {
                string data = "214";
                data += fileName.Length.ToString().PadLeft(2, '0');
                data += SocketHandler.Encipher(fileName, "cipher");
                data += atUser.Length.ToString().PadLeft(2, '0');
                data += SocketHandler.Encipher(atUser, "cipher");

                SocketHandler sh = new SocketHandler();
                try
                {
                    sh.sendData(data);
                }
                catch (SocketException ex)
                {
                    Notifier n = AsyncBlockingSocket.initNotifier();
                    n.ShowError(ex.ToString());
                }
                catch (Exception ex)
                {
                    Notifier n = AsyncBlockingSocket.initNotifier();
                    n.ShowError(ex.ToString());
                }
            }
            else
            {
                Notifier n = 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(2),
                        maximumNotificationCount: MaximumNotificationCount.FromCount(1));

                    cfg.Dispatcher = Application.Current.Dispatcher;
                });

                n.ShowError("The user is not connected.");
            }
        }
Exemple #18
0
        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);
            }

            //Notifications.Wpf.NotificationType nt = Notifications.Wpf.NotificationType.Information;
            //nt = (Notifications.Wpf.NotificationType)Enum.Parse(typeof(Notifications.Wpf.NotificationType), notificationType);
            //GenericTools.notificationManager.Show(new NotificationContent
            //{
            //    Title = title,
            //    Message = message,
            //    Type = nt
            //}, expirationTime: duration);
        }
        public TimerPageNew(IChangeableIcon parentWindow, Window _parentWindow)
        {
            InitializeComponent();
            this.parentWindow = parentWindow;

            // UI updating timer
            updateTimer          = new DispatcherTimer();
            updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 100);
            updateTimer.Tick    += delegate(object sender, EventArgs e)
            {
                UpdateTime();
                if (timerLogic.IsFininshed)
                {
                    TimerFinished();
                }
            };

            // For events
            _parentWindow.KeyUp += delegate(object sender, KeyEventArgs e)
            {
                if (e.Key == Key.Enter)
                {
                    if (_BtnStart.IsEnabled)
                    {
                        _BtnStart.Focus();
                        _BtnStart_Click(sender, e);
                    }
                    else
                    {
                        _BtnStop_Click(sender, e);
                    }
                }
            };

            // For Windows toast notifications
            notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 0, 0);

                //cfg.LifetimeSupervisor = new CountBasedLifetimeSupervisor(
                //    MaximumNotificationCount.FromCount(5));

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(10000),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });

            // Done initializing UI
            didInit = true;
        }
Exemple #20
0
        public static void ShowNotification(string body, ToastLogLevel customLogLevel,
                                            Corner corner = Corner.BottomRight, double secondsViewable = 3)
        {
            var notificationWindow = Application.Current?.Windows?.Cast <Window>()
                                     .FirstOrDefault(window => window != null && window.IsActive);

            // App either hasn't started or doesn't have a main window
            if (notificationWindow == null)
            {
                LogManager.GetCurrentClassLogger().Log(LogLevel.Error, $"Failed to log message: \"{body}\"");
                return;
            }

#pragma warning disable CA2000 // Dispose objects before losing scope
            var notifier = new Notifier(configuration =>
            {
                configuration.PositionProvider = new WindowPositionProvider(
                    parentWindow: notificationWindow,
                    corner: corner,
                    offsetX: 10,
                    offsetY: 10);

                configuration.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(secondsViewable),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(1));

                configuration.Dispatcher = Application.Current.Dispatcher;
            });
#pragma warning restore CA2000 // Dispose objects before losing scope

            switch (customLogLevel)
            {
            case ToastLogLevel.Information:
                notifier.ShowInformation(body);
                break;

            case ToastLogLevel.Success:
                notifier.ShowSuccess(body);
                break;

            case ToastLogLevel.Warning:
                notifier.ShowWarning(body);
                break;

            case ToastLogLevel.Error:
                notifier.ShowError(body);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(customLogLevel), customLogLevel, null);
            }
        }
        public DodavanjeUcionice(RacunarskiCentar racunarskiCentar, ObservableCollection <Ucionica> ucionice, bool izmena, string oznaka,
                                 Notifier notifierMainWindow, UndoRedoStack stack, OrderedDictionary prethodnaStanja)
        {
            notifierError = new Notifier(cfg =>
            {
                cfg.PositionProvider = new WindowPositionProvider(
                    parentWindow: this,
                    corner: Corner.TopRight,
                    offsetX: 20,
                    offsetY: 10);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: System.TimeSpan.FromSeconds(5),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(1));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });

            this.prethodnaStanjaAplikacije = prethodnaStanja;
            this.staroStanje        = null;
            this.potvrdio           = false;
            this.stekStanja         = stack;
            this.notifierMainWindow = notifierMainWindow;
            this.inicijalizacija    = false;
            InitializeComponent();
            this.inicijalizacija = true;
            this.dodavanjeUcioniceIzborStarogUnosa = false;
            novaUcionica                = new Ucionica();
            this.racunarskiCentar       = racunarskiCentar;
            this.izmena                 = izmena;
            this.unosPrviPut            = true;
            this.oznakaUcioniceZaIzmenu = oznaka;
            List <Softver> softveri = new List <Softver>();

            foreach (Softver s in racunarskiCentar.Softveri.Values)
            {
                if (!s.Obrisan)
                {
                    s.Instaliran = false;
                    softveri.Add(s);
                }
            }
            softverTabela.ItemsSource = softveri;
            softverTabela.IsSynchronizedWithCurrentItem = true;
            tabelaUcionica = ucionice;
            if (!izmena)
            {
                oznakaUcionica.Focus();
            }
            BackStepMenuItem.IsEnabled = false;
        }
        public ToastService()
        {
            _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;
        }
Exemple #23
0
        public ViewProvider()
        {
            _notifier = new Notifier(configuration =>
            {
                configuration.PositionProvider = new PrimaryScreenPositionProvider(
                    corner: Corner.BottomRight,
                    offsetX: 10,
                    offsetY: 10);
                configuration.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(3),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));

                configuration.Dispatcher = Application.Current.Dispatcher;
            });
        }
Exemple #24
0
        public ToastNotificationService()
        {
            _notifier = new Notifier(config =>
            {
                config.PositionProvider =
                    new WindowPositionProvider(Application.Current.MainWindow, Corner.BottomRight, 20, 20);

                config.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(4),
                                                                                    MaximumNotificationCount.FromCount(5));

                config.Dispatcher = Dispatcher.CurrentDispatcher;

                config.DisplayOptions.TopMost = true;
            });
        }
        public CustomerWindow()
        {
            Instance = this;
            InitializeComponent();

            ControlPositionProvider displayRegion = new ControlPositionProvider
                                                        (this, this.toastNotificationArea, Corner.TopRight, 5, 5);

            this.notifier = new Notifier(x => {
                x.PositionProvider   = displayRegion;
                x.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(5),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));
                x.Dispatcher = Application.Current.Dispatcher;
            });
        }
        private static Notifier CreateNotifier() =>
        new Notifier(
            configuration =>
        {
            configuration.PositionProvider = new WindowPositionProvider(
                parentWindow: Application.Current.MainWindow,
                corner: Corner.TopRight,
                offsetX: 10,
                offsetY: 50);

            configuration.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                notificationLifetime: TimeSpan.FromSeconds(5),
                maximumNotificationCount: MaximumNotificationCount.FromCount(3));

            configuration.Dispatcher = Application.Current.Dispatcher;
        });
        private NotificationManager()
        {
            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;
            });
        }
Exemple #28
0
        public static void CreateNotifier()
        {
            _notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new WindowPositionProvider(
                    parentWindow: Application.Current.MainWindow,
                    corner: Corner.BottomLeft,
                    offsetX: 3,
                    offsetY: 167);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(3),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(3));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });
        }
        private void MainWindow_OnLoaded(object sender, RoutedEventArgs e)
        {
            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;
            });
        }
Exemple #30
0
        public DialogService()
        {
            notifier = new Notifier(cfg =>
            {
                cfg.PositionProvider = new WindowPositionProvider(
                    parentWindow: Application.Current.MainWindow,
                    corner: Corner.TopRight,
                    offsetX: 40,
                    offsetY: 40);

                cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(
                    notificationLifetime: TimeSpan.FromSeconds(3),
                    maximumNotificationCount: MaximumNotificationCount.FromCount(5));

                cfg.Dispatcher = Application.Current.Dispatcher;
            });
        }