public void Show(AppointmentGroup appointments) { Trace.WriteLine("Show " + appointments); if (appointments == null || !appointments.Next.Any()) { return; } var distinctTimes = 1; var prev = appointments.Next.First(); var first = prev; var prevWindow = this; Show(prev); foreach (var appointment in appointments.Next.Skip(1)) { if (appointment.Start > prev.Start) { if (distinctTimes++ > 2 && appointment.Start.Subtract(first.Start).TotalMinutes > 15) { break; } } var child = new NotificationWindow(this); children.Add(child); child.Top = prevWindow.Top + prevWindow.Height + 5; child.Left = Left; child.Show(appointment); prevWindow = child; } EnsureChildrenOnScreen(); }
public MainWindow(Staff inStaff,int Power) { InitializeComponent(); curStaff=inStaff; if (Power == 1) { } if (Power == 2) { //StockManger: Show cái j lên thì bỏ vào đây btnStaff.IsEnabled = false; btnPayment.IsEnabled = false; btnCustomer.IsEnabled = false; btnDiscount.IsEnabled = false; btnReport.IsEnabled = false; } if (Power == 3) { //Dealer: Show cái j lên thì bỏ vào đây btnStaff.IsEnabled = false; btnDiscount.IsEnabled = false; btnReport.IsEnabled = false; } NotificationWindow noti = new NotificationWindow(); noti.Owner = Window.GetWindow(this); noti.Show(); }
public MainWindow() { InitializeComponent(); var configurationDictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(File.ReadAllText("configuration.json")); var configurationReader = new ToastrConfigurationReader(); var configuration = configurationReader.Get(configurationDictionary); var actionsExecutor = new ActionsExecutor(Dispatcher); _controller = new NotificationsController( (uint)SystemParameters.PrimaryScreenWidth, (uint)SystemParameters.PrimaryScreenHeight, actionsExecutor, configuration, (notification, config) => { var notificationWindow = new NotificationWindow(notification, config); notificationWindow.Show(); return notificationWindow; }); Closing += (sender, args) => { actionsExecutor.Dispose(); }; }
private void ReadInConfigXML() { XmlDocument lXMLConfig = new XmlDocument(); string lConfigLocation = @"C:\POS\Config\config.xml"; if ( File.Exists( lConfigLocation ) ) { int lDepartments = 0; //Load File FileStream lFileStream = new FileStream( lConfigLocation, FileMode.Open, FileAccess.Read ); lXMLConfig.Load( lFileStream ); XmlNodeList lXMLNodeList; lXMLNodeList = lXMLConfig.GetElementsByTagName( "Setup" ); for ( int i = 0; i < lXMLNodeList.Count; i++ ) { if ( lXMLNodeList[ i ].Attributes.GetNamedItem( "departments" ).Name == "departments" ) { lDepartments = Convert.ToInt16( lXMLNodeList[ i ].Attributes.GetNamedItem( "departments" ).Value.ToString() ); } } lFileStream.Close(); } else { //Show error message NotificationWindow lNotify = new NotificationWindow( "Configuration Not Found!", "The configuration file for this system was not found, please contact support!\r\n\r\nThe system will now exit", "OKOnly" ); lNotify.Show(); } }
internal void ProcessMessages() { try { MessagingFactory factory = MessagingFactory.Create( ServiceBusEnvironment.CreateServiceUri("sb", Properties.Settings.Default.SBNamespace, String.Empty), TokenProvider.CreateSharedSecretTokenProvider("wpfsample", Properties.Settings.Default.SBListenerCredentials)); MessageReceiver theQueue = factory.CreateMessageReceiver("thequeue"); while (isProcessing) { BrokeredMessage message = theQueue.Receive(new TimeSpan(0, 0, 0, 5)); if (message != null) { Dispatcher.Invoke((System.Action)(() => { NotificationWindow w; try { w = new NotificationWindow( message.Properties["Sender"].ToString(), message.GetBody<String>(), message.Properties["Color"].ToString()); } catch (KeyNotFoundException) { w = new NotificationWindow( "system", String.Format("Invalid message:\n{0}", message.GetBody<String>()), "Red" ); } WindowRegistry.Add(w); w.Show(); message.Complete(); })); } } } catch (Exception ex) { Dispatcher.Invoke((System.Action)(() => { btnServiceControl.Content = "Start Responding"; this.Background = new SolidColorBrush(Colors.Orange); this.isProcessing = false; })); MessageBox.Show(ex.Message, "Processing halted", MessageBoxButton.OK, MessageBoxImage.Stop); } }
private void ShowNotification(string message) { var thread = new Thread(new ParameterizedThreadStart(param => { var window = new NotificationWindow(message); window.ShowDialog(); })); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
public void SetValue(ExecutionContext context, string value) { switch (value) { case "ОК": NotificationWindow.SoundNotify(); return; case "Принять": NotificationWindow.SoundNotifyAccept(); return; case "Отмена": NotificationWindow.SoundNotifyDisallow(); return; } }
public ToasterNotifier(ISoundNotifier soundNotifier) { _soundNotifier = soundNotifier; _notified = false; _stopwatch = new Stopwatch(); _notificationWindow = new NotificationWindow(); _notificationWindow.Left = SystemParameters.WorkArea.Right - _notificationWindow.Width - BorderOffset; _notificationWindow.Top = SystemParameters.WorkArea.Bottom - _notificationWindow.Height - BorderOffset; _notificationWindow.Height = 0; _notificationWindow.Show(); }
public Toaster(long showDuration) { notified = false; stopwatch = new Stopwatch(); notificationWindow = new NotificationWindow(); notificationWindow.Left = SystemParameters.WorkArea.Right - notificationWindow.Width - BORDER_OFFSET; notificationWindow.Top = SystemParameters.WorkArea.Bottom - notificationWindow.Height - BORDER_OFFSET; notificationWindow.Height = 0; notificationWindow.Show(); this.showDuration = showDuration; }
private async void CreatePopupWindow(string crypto, string condition) { await Task.Delay(10000); SystemSounds.Beep.Play(); Application.Current.Dispatcher.Invoke((Action) delegate { var notificationWindow = new NotificationWindow(crypto, condition); notificationWindow.Show(); }); }
public NotificationWindow(NotificationWindow parent) { this.parent = parent; InitializeComponent(); if (this.parent == null) { hideTimer.Tick += HideTimerOnTick; updateTimer.Tick += UpdateTimerOnTick; new PositionPersister().Persist(this); } }
public void FireNotification(object obj) { Application.Current.Dispatcher.Invoke((Action) delegate { NotificationWindow nw = new NotificationWindow(); nw.DescriptionText = ((Task)obj).Description; nw.ExtraDetailText = ((Task)obj).ExtraDetail; nw.Topmost = true; nw.Show(); SystemSounds.Hand.Play(); }); }
private void AddNotificationToQueue(NotificationWindow notification) { if (toastWindow == null) { toastWindow = notification; notification.Show((int)ConfigurationSettings.NotificationTimer); } else { _notifyQueue.Enqueue(notification); } }
public static void Show(string tile, string msg) { i++; NotificationWindow dialog = new NotificationWindow();//new 一个通知 dialog.TopFrom = GetTopFrom(); dialog.Tile.Text = tile; dialog.msg.Text = msg; _dialogs.Add(dialog); dialog.Show(); }
private static void NotificationHandler(object obj, Exception exc) { var notificationWindow = new NotificationWindow() { DataContext = new NotificationViewModel() { Message = exc.ToString() } }; notificationWindow.Owner = _mainWindow; notificationWindow.Show(); }
private void Initialize() { _trayIcon = new System.Windows.Forms.NotifyIcon(); _trayIcon.BalloonTipText = Constants.Application.BaloonTip; _trayIcon.BalloonTipTitle = Constants.Application.Title; _trayIcon.Text = Constants.Application.Description; SwitchTrayIcon(_workerService.Progress); _trayIcon.Visible = true; _notificationWindow = SimpleIoc.Default.GetInstance<NotificationWindow>(); _workerService.IncomingChangesDetected += OnIncomingChangesDetected; _workerService.ProgressChanged += OnWorkerServiceProgressChanged; }
private void Initialize() { _trayIcon = new System.Windows.Forms.NotifyIcon(); _trayIcon.BalloonTipText = Constants.Application.BaloonTip; _trayIcon.BalloonTipTitle = Constants.Application.Title; _trayIcon.Text = Constants.Application.Description; SwitchTrayIcon(_workerService.Progress); _trayIcon.Visible = true; _notificationWindow = SimpleIoc.Default.GetInstance <NotificationWindow>(); _workerService.IncomingChangesDetected += OnIncomingChangesDetected; _workerService.ProgressChanged += OnWorkerServiceProgressChanged; }
public void Open(string title, string content) { App.Current.Dispatcher.Invoke((Action)(() => { NotifyData data = new NotifyData(); data.Title = title; data.Content = content; NotificationWindow dialog = new NotificationWindow();//new 一个通知 dialog.Closed += Dialog_Closed; dialog.TopFrom = GetTopFrom(); _dialogs.Add(dialog); dialog.DataContext = data;//设置通知里要显示的数据 dialog.Show(); })); }
// If valid, save and close program // If invalid (file already exists in directory), then notify user void Submit(object sender, RoutedEventArgs e) { if (FileManagementWindowsHelper.IsSaveDirectoryUnique(FileName.Text) && Item != null) { FileManagement.FileManagement.WriteGameStatusObjectToFile(FileName.Text + XML_TAG, Item); Close(); } // because we want to do nothing if Item is null // informs the user if the file already exists else if (Item != null) { NotificationWindow window = new NotificationWindow("A file with this name already exists."); window.ShowDialog(); } }
private void MessageAdded(AppMessage msg) { NotificationWindow nw = new NotificationWindow(msg.Caption, msg.Message, msg.FadeOut); nw.Owner = Window.GetWindow(this); nw.WindowStartupLocation = WindowStartupLocation.CenterOwner; if (msg.FadeOut) { nw.Show(); } else { nw.ShowDialog(); } }
public void WriteConfigurationXML(ConfigurationFile aCF, string aPath) { List<CFCategories> lCats = aCF.Categories; int lAmountCats = lCats.Count(); List<XElement> lXMLCats = new List<XElement>(); int lCount = 0; foreach (CFCategories lCat in lCats) { lCount++; lXMLCats.Add(new XElement("d"+lCount, new XAttribute("Name", lCat.name), new XAttribute("Colour", lCat.colour), new XAttribute("Command", lCat.command) )); } XElement lConfigFile = new XElement("Setup", new XAttribute("POSID", aCF.POSID), new XAttribute("departments", lAmountCats.ToString()), new XAttribute("DebugEnabled", "true") ); foreach (XElement lXMLElement in lXMLCats) { lConfigFile.Add(lXMLElement); } if (aPath != null) { try { lConfigFile.Save(aPath); } catch (SystemException ex) { NotificationWindow lNotify = new NotificationWindow("System Error", "The system encountered an error whilst processing the configuration file. The error is: \r\n" + ex.Message.ToString(), "OKOnly"); lNotify.ShowDialog(); AppErr.Log(ex.Message.ToString(), false); Environment.Exit(0); } } else { NotificationWindow lNotify = new NotificationWindow("System Error", "Failure writing to configuration file.\r\n\r\nSystem will now exit." , "OKOnly"); lNotify.ShowDialog(); AppErr.Log("Path was not set for XML configuration file. System failure", false); Environment.Exit(0); } }
internal void NextInstance(ReadOnlyCollection <string> argv) { try { Dictionary <string, string> pars = ProcessHelper.ParseParameters(argv); int pid = int.Parse(pars["pid"]); int threadid = int.Parse(pars["threadid"]); string currentTarget = pars["ip"]; int currentTargetPort = int.Parse(pars["port"]); int currentProtocol = int.Parse(pars["protocol"]); int currentLocalPort = int.Parse(pars["localport"]); string currentPath = pars["path"]; pars = null; //Release memory for GC LogHelper.Debug("Initializing exclusions..."); initExclusions(); LogHelper.Debug("Adding item..."); if (!AddItem(pid, threadid, currentPath, currentTarget, currentProtocol, currentTargetPort, currentLocalPort)) { //This connection is blocked. No action necessary. LogHelper.Info("Connection is blocked."); if (window == null) { LogHelper.Debug("No notification window loaded; shutting down..."); this.Shutdown(); } return; } LogHelper.Debug("Displaying notification window..."); if (window == null) { LogHelper.Debug("No notification window loaded; creating a new one..."); window = new NotificationWindow(); //this.Run(window); } if (window.WindowState == WindowState.Minimized) { window.WindowState = WindowState.Normal; } } catch (Exception e) { LogHelper.Error("Error in NextInstance", e); } }
private void SelectTytpe(string url, string name = null) { NotificationWindow window = new NotificationWindow(); if (window.ShowDialog() == true) { if (window.NewTab == true) { StaticAnyWhere.Rootclass.GoTo(url, name); } else { this.NavigationService.Navigate(new Uri(url, UriKind.Relative)); } } }
public Library_MainWindow() { Main.SetBooksIcon(this); InitializeComponent(); this.Show(); Main.SetBooksIcon(this); if (Main.Library.GetLoggedUser().Role == ERole.Admin) { LibraryContent_MainWindow.Content = new UserAdmin_Page(); } else { LibraryContent_MainWindow.Content = new UserClient_Page(); } NotificationWindow notificationWindow = new NotificationWindow(); }
private async void OnChangeNotificationReceived(object sender, EventArgs e) { try { var messages = await Task.Run(() => SyncMessagesAsync()); if (messages.Count <= 0) { return; } var notification = new NotificationWindow(messages); notification.Show(); } catch (Exception ex) { Logger.Error(ex); } }
private void CustomNotificationButton_Click(object sender, RoutedEventArgs e) { // create the nofitication window API NotificationWindow notify = new NotificationWindow(); // creating the content to be in the window CustomNotification custom = new CustomNotification(); custom.Header = "Header Text"; custom.Text = "Ipsum dolorem didey up thealmian! Isten ein er falomn"; // set the window content notify.Content = custom; // displaying the notification notify.Show(8000); }
public NotificationService() { Notifications = new GroupNotificationCollection(); _growlNotifications = new NotificationWindow(); _growlNotifications.SetResourceReference(FrameworkElement.StyleProperty, "NotificationWindowStyle"); _growlNotifications.ItemClick += (s, e) => { if (e.NotificationInfo.NavigationParameter == null) { return; } NavigationExecuter.Execute(e.NotificationInfo.NavigationParameter, DefaultNavigationCallback); Notifications.Remove(e.NotificationInfo); }; }
private static void Main(string[] args) { Logger.InitLog((string)null, "Agent", true); HDAgent.InitExceptionHandlers(); ProcessUtils.LogProcessContextDetails(); if (ProcessUtils.CheckAlreadyRunningAndTakeLock("Global\\BlueStacks_HDAgent_Lockbgp", out HDAgent.s_HDAgentLock)) { HDAgent.HandleAlreadyRunning(); } NotificationWindow.Init(); NotificationPopup.SettingsImageClickedHandle(new EventHandler(HTTPHandler.SettingsImageMouseUp), (object)null); HDAgent.sPowerValues.Add("4", "Entering Suspend"); HDAgent.sPowerValues.Add("7", "Resume from Suspend"); HDAgent.sPowerValues.Add("10", "Power Status Change"); HDAgent.sPowerValues.Add("18", "Resume Automatic"); HDAgent.InitPowerEvents(); MemoryManager.TrimMemory(true); HDAgent.s_InstallDir = RegistryStrings.InstallDir; Directory.SetCurrentDirectory(HDAgent.s_InstallDir); Logger.Info("HDAgent: CurrentDirectory: {0}", (object)Directory.GetCurrentDirectory()); LocaleStrings.InitLocalization((string)null, "Android", false); ServicePointManager.DefaultConnectionLimit = 10; ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(HDAgent.ValidateRemoteCertificate); Application.EnableVisualStyles(); new Thread(new ThreadStart(HDAgent.SetupHTTPServer)) { IsBackground = true }.Start(); try { EventLog eventLog1 = new EventLog("Application"); eventLog1.EntryWritten += new EntryWrittenEventHandler(HDAgent.EventLogWritten); eventLog1.EnableRaisingEvents = true; EventLog eventLog2 = new EventLog("System"); eventLog2.EntryWritten += new EntryWrittenEventHandler(HDAgent.EventLogWritten); eventLog2.EnableRaisingEvents = true; } catch (Exception ex) { Logger.Warning("Got excecption while hooking to event log ex:{0}", (object)ex.ToString()); } Stats.SendMiscellaneousStatsAsyncForDMM(Stats.DMMEvent.agent_launched.ToString(), RegistryManager.Instance.AgentServerPort.ToString(), (string)null, (string)null, (string)null, "Android", 0); Application.Run((ApplicationContext) new HDAgent()); Logger.Info("Exiting HDAgent PID {0}", (object)Process.GetCurrentProcess().Id); }
private void ShowNotificationExecute(string message) { App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action( () => { foreach (Window window in System.Windows.Application.Current.Windows) { string windowName = window.GetType().Name; if (windowName.Equals("NotificationWindow")) { return; } } var notify = new NotificationWindow(); notify.Show(message); })); }
protected override LayoutManager GetLayoutManager(NotificationWindow win) { PlainWindow pw = (PlainWindow)win; switch (pw.DisplayLocation) { case Location.TopLeft: return(tllm); case Location.BottomLeft: return(bllm); case Location.TopRight: return(trlm); default: return(brlm); } }
protected override LayoutManager GetLayoutManager(NotificationWindow nw) { DegreeWindow win = (DegreeWindow)nw; switch (win.DisplayLocation) { case Location.TopLeft: return(tllm); case Location.BottomLeft: return(bllm); case Location.TopRight: return(trlm); default: return(brlm); } }
public void DisplayNotification(StreamsInfo sInfo, int displayTime) { if (windowThread != null && windowThread.IsAlive) windowThread.Abort(); windowThread = new Thread(new ThreadStart(() => { NotificationWindow w = new NotificationWindow(); // Try and set display monitor try { var testArrayOutOfBounds = System.Windows.Forms.Screen.AllScreens[ConfigMgnr.I.DisplayMonitor]; w.MonitorIndex = ConfigMgnr.I.DisplayMonitor; } catch (IndexOutOfRangeException) { w.MonitorIndex = 0; } // Check if there's valid information to display if (sInfo != null && sInfo.Streams != null && sInfo.Streams.Count > 0) w.listDataBinding.ItemsSource = sInfo.Streams; else w.ErrorPanel.Visibility = System.Windows.Visibility.Visible; w.ShowInTaskbar = false; w.WindowTimeOnScreen.KeyTime = new TimeSpan(0, 0, displayTime); w.WindowTimeOnScreen2.KeyTime = new TimeSpan(0, 0, displayTime + 2); w.Closed += (s, e) => System.Windows.Threading.Dispatcher.CurrentDispatcher.BeginInvokeShutdown(System.Windows.Threading.DispatcherPriority.Background); w.Show(); System.Windows.Threading.Dispatcher.Run(); })); windowThread.SetApartmentState(ApartmentState.STA); windowThread.IsBackground = true; windowThread.Start(); }
private void ShowWindow(ITweetItem tweet) { if (_window == null) { _window = new NotificationWindow { Width = 400, Height = 100, Content = new NotificationControl() }; } if (_appInfo.IsNotificationsEnabled) { _window.Content.DataContext = tweet; _window.Close(); _window.Show(5000); } }
public async Task <string> ShowWithInput(string title, string text, int?timeShow = null) { var w = new NotificationWindow(); w.DataContext = new NotificationWindowViewModel(title, text, w, NotificationType.Input); w.Closed += delegate { Reposition(); }; w.Show(); Add(w); if (timeShow != null) { await Task.Run(async() => { for (int i = 0; i < timeShow / 100; i++) { await Task.Delay(100); if (w.IsClosed) { break; } } }); if (!w.IsClosed) { w.Close(); } } else { while (true) { await Task.Delay(100); if (w.IsClosed) { break; } } } return(w.TextResult); }
public NotificationWindowViewModel CreateNotificationWindow() { var window = new NotificationWindow(); var viewModel = createNotificationWindowViewModel(); EventHandler <RequestShowEventArgs> requestShowHandler = (sender, args) => window.ShowOnMonitor(args.TargetMonitor); EventHandler requestCloseHandler = (sender, args) => window.Close(); viewModel.RequestClose += requestCloseHandler; viewModel.RequestShow += requestShowHandler; window.DataContext = viewModel; window.Closed += (sender, args) => { viewModel.RequestClose -= requestCloseHandler; viewModel.RequestShow -= requestShowHandler; }; return(viewModel); }
public void Startup() { _appApplicationEnvironment = new ApplicationEnvironment(); _appApplicationEnvironment.SetupApplicationEnvironment(); _appApplicationEnvironment.EventHub.Subscribe <AppExitMessage>(OnAppShutdownHandler); Logger.Log.Info("Init data models"); _entryModel = new EntryViewModel(_appApplicationEnvironment); _appViewModel = new ApplicationViewModel(_appApplicationEnvironment); _timersViewModel = new TimersViewModel(_appApplicationEnvironment); _reportsViewModel = new ReportsViewModel(_appApplicationEnvironment); _settingsViewModel = new SettingsViewModel(_appApplicationEnvironment); _notificationViewModel = new NotificationViewModel(_appApplicationEnvironment); _profileSettingsViewModel = new ProfileSettingsViewModel(_appApplicationEnvironment); Logger.Log.Info("Init dialog service"); _dialogService = new DialogService(); _dialogService.RegisterDialog <ConfirmationDialogModel, ConfirmationDialog>(); Logger.Log.Info("Init views"); _mainView = new MainWindow(_dialogService, _appViewModel); _entryWindow = new EntryWindow(_entryModel); _activityDetailsWindow = new ActivityDetailsWindow(_mainView, _timersViewModel); _notificationWindow = new NotificationWindow(_mainView, _notificationViewModel); _profileSettingsWindow = new ProfileSettingsWindow(_mainView, _profileSettingsViewModel); _timersViewPage = new TimersViewPage(_timersViewModel); _mainView.AddPage(_timersViewPage); _reportsViewPage = new ReportsViewPage(_reportsViewModel); _mainView.AddPage(_reportsViewPage); _settingsViewPage = new SettingsViewPage(_settingsViewModel); _mainView.AddPage(_settingsViewPage); _mainView.Run(); }
private static void dispatcherTimer_Tick(object sender, EventArgs e, ApplicationContext db, DispatcherTimer dispatcherTimer) { ArrayList listMaterials = new ArrayList(); Logger logger = LogManager.GetCurrentClassLogger(); try { db.Materials.ToList().Where(x => x.DateOfTerm == DateTime.Today.AddDays(1) && x.ExecutedOrNotExecuted != true).ToList().ForEach(x => listMaterials.Add(x)); } catch (Exception ex) { logger.Error(ex, "Ошибка загрузки БД в таймере"); } if (listMaterials.Count != 0) { NotificationWindow notificationWindow = new NotificationWindow(db, true); notificationWindow.ShowDialog(); } dispatcherTimer.Interval = new TimeSpan(2, 0, 0); }
private void ConductThinkTest() { if (gMainWindowInstance != null ) { if ( gMainWindowInstance.PerformAgeCheck( "21" ) == true ) { gMainWindowInstance.UpdateKeyHeaderMessage( "Test Age Check Passed" ); } else { gMainWindowInstance.UpdateKeyHeaderMessage( "Test Age Check Failed" ); } } else { NotificationWindow lNotify = new NotificationWindow( "API Not Set", "The POS Main Window Instance has not been set. Contact technical support", "OKOnly" ); lNotify.ShowDialog(); } this.Close(); }
private static IDisposable ShowDesktopWindow(int index) { var vmodel = new NotificationWindowViewModel { Title = ProductInfo.Title, Header = "Virtual Desktop Switched", Body = "Current Desktop: Desktop " + index, }; var source = new CancellationTokenSource(); var window = new NotificationWindow() { DataContext = vmodel, }; window.Show(); Task.Delay(TimeSpan.FromMilliseconds(Settings.General.NotificationDuration), source.Token) .ContinueWith(_ => window.Close(), TaskScheduler.FromCurrentSynchronizationContext()); return(Disposable.Create(() => source.Cancel())); }
private static void dispatcherTimer_Tick(object sender, EventArgs e, DispatcherTimer dispatcherTimer, HttpClient client) { ArrayList listMaterials = new ArrayList(); Logger logger = LogManager.GetCurrentClassLogger(); try { GetMaterialsWhereTermTomorrowAsync(); } catch (Exception ex) { logger.Error(ex, "Ошибка загрузки БД в таймере"); } //if (listMaterials.Count != 0) //{ // NotificationWindow notificationWindow = new NotificationWindow(db, true, client); // notificationWindow.ShowDialog(); //} //dispatcherTimer.Interval = new TimeSpan(2, 0, 0); async void GetMaterialsWhereTermTomorrowAsync() { HttpResponseMessage response = await client.GetAsync("Materials/GetMaterialsWhereTermTomorrow"); if (response.IsSuccessStatusCode) { var materialsTerm = await response.Content.ReadAsAsync <List <Material> >(); materialsTerm.ForEach(x => listMaterials.Add(x)); if (listMaterials.Count != 0) { dispatcherTimer.Interval = new TimeSpan(4, 0, 0); NotificationWindow notificationWindow = new NotificationWindow(true, client); notificationWindow.ShowDialog(); } dispatcherTimer.Interval = new TimeSpan(2, 0, 0); } } }
private void NotificationEvent(object sender, string msg, bool isError) { NotificationWindow notificationWindow = new NotificationWindow(); if (this.IsActive) { notificationWindow.Owner = this; } notificationWindow.Message = msg; notificationWindow.ShowTitleBar = false; if (isError) { notificationWindow.BorderBrush = new SolidColorBrush(Colors.Red); notificationWindow.Background = new SolidColorBrush(Colors.Pink); } else { notificationWindow.BorderBrush = new SolidColorBrush(Colors.Yellow); notificationWindow.Background = new SolidColorBrush(Colors.LightYellow); } notificationWindow.ShowDialog(); }
/// <summary> /// Initializes a new instance of the /// <see cref="ShellNotificationListener"/> class. /// </summary> public ShellNotificationListener() { m_Window = new NotificationWindow(this); }
protected NotificationWindowWrapper(NotificationWindow notificationWindow) { _notificationWindow = notificationWindow; }
public static void ShowNotification(string Title, string Message, Contact contact) { NotificationWindow wnd = new NotificationWindow(); wnd.Left = (SystemParameters.FullPrimaryScreenWidth - wnd.Width) - 10; wnd.Top = 10; wnd.txt_notificationtitle.Content = Title; wnd.txt_notificationcontent.Text = Message; wnd.Show(); Windows.Add(wnd); ReDraw(); }
public static void ShowCallNotification(Contact contact, string UDPAddress, int Port) { SoundManager.VoiceRingingSound.PlayLooping(); NotificationWindow wnd = new NotificationWindow(true); wnd.Left = (SystemParameters.FullPrimaryScreenWidth - wnd.Width) - 10; wnd.Top = 10; wnd.txt_notificationtitle.Content = "Incoming Call From " + contact.NickName; wnd.txt_notificationcontent.Text = ""; wnd.btn_call_accept.Visibility = Visibility.Visible; wnd.btn_call_deny.Visibility = Visibility.Visible; wnd.profile_image.Visibility = Visibility.Visible; wnd.profile_image_source.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri("https://blaze-games.com/api/image/nocompress/?nickname=" + contact.NickName)); wnd.UDPAddress = UDPAddress; wnd.Port = Port; wnd.contact = contact; wnd.Show(); Windows.Add(wnd); ReDraw(); }
internal static void Add(NotificationWindow w) { Windows.Add(w); }
public void ShowWindow(NotificationWindow ex) { ex.Show(); }
private void TestSQLDatabases() { DatabaseManager lDBM = new DatabaseManager(); bool lStatus = lDBM.CreateNewLocalDatabase("posconfig"); if (lStatus) { bool lTest = lDBM.InitialiseConfigDatabase(); if (lTest) { NotificationWindow lNotify = new NotificationWindow("DB Init & Create OK", "Database creation and init passed!", "OKOnly"); lNotify.ShowDialog(); } else { NotificationWindow lNotify = new NotificationWindow("DB Test Failed", "Database init test failed", "OKOnly"); lNotify.ShowDialog(); } } else { NotificationWindow lNotify = new NotificationWindow("DB Create Failed", "Database creation test failed", "OKOnly"); lNotify.ShowDialog(); } }
public void AddNotification(string text) { var nw = new NotificationWindow(this.FindAncestor<Window>(), NotificationTime, NotificationTemplate, _notificationsWindows, text); _notificationsWindows.Add(nw); nw.Closed += nw_Closed; nw.Show(); }
internal static void DisplayNotification(string Message, string Title = "Notification!", int Duration = 5000) { Thread t = new Thread(() => { NotificationWindow nw = new NotificationWindow(); nw.Show(Message, Title, Duration); nw.Closed += (sender, e) => nw.Dispatcher.InvokeShutdown(); Dispatcher.Run(); nw.Closed -= (sender, e) => nw.Dispatcher.InvokeShutdown(); }); t.SetApartmentState(ApartmentState.STA); t.Start(); }
private void GotChangeLog(object sender, RunWorkerCompletedEventArgs e) { ChangeLog.IsEnabled = true; ChangeLog.Visibility = System.Windows.Visibility.Visible; ChangeLog.ItemsSource = log; GettingLog.Visibility = System.Windows.Visibility.Hidden; int haveChanges = checker.CheckLogForUpdates(originalLog); if (haveChanges > -1) { NotificationWindow w = new NotificationWindow(null); for (int i = 0; i < haveChanges; i++) { List<string> l = originalLog[i]; if (l.Count > 1) w.ShowNotification(l[2], l[3], l[4]); w.ShowWindow(w); } } }
private void CloseWindow(NotificationWindow window) { window.Close(); NotificationCurrentSongCount = 0; NotificationMaxSongCount = 0; }
private void UpdateWindow(NotificationWindow window) { NotificationCurrentSongCount++; OnPropertyChanged("Notification"); window.Refresh(); }
private NotificationWindow InitiateWindow(String template, Int32 maxSongs) { var window = new NotificationWindow(); window.Owner = App.Current.MainWindow; window.DataContext = this; NotificationCurrentSongCount = 0; NotificationMaxSongCount = maxSongs; NotificationTemplate = template; OnPropertyChanged("Notification"); return window; }
/// <summary> /// Initializes a new instance of the /// <see cref="ShellNotificationListener"/> class. /// </summary> public ShellNotificationListener(IContainer container) { container.Add(this); m_Window = new NotificationWindow(this); }
private void ShowPopup(Notification notification) { if (notification == null || notification.IsDismissed) { return; } if (this.Displays(notification)) { return; } DisplayedNotifications.Add(notification); lock (lockObject) { if (notification.IsDismissed) { return; } _timer.Dispatcher.Invoke( DispatcherPriority.Normal, new Action( delegate() { NotificationWindow notifier = new NotificationWindow(notification) { WindowStartupLocation = WindowStartupLocation.CenterOwner, OtherWindowCount = DisplayedNotifications.CountBeforeReset - 1, CloseCommand = new RemoveNotificationCommand(notification, DisplayedNotifications) }; notifier.BeginInvoke(); notifier.Show(); })); } }
void Notifications_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.NewItems == null) { return; } foreach (var item in e.NewItems) { // notification windows management var nw = new NotificationWindow(this.FindAncestor<Window>(), NotificationTime, NotificationTemplate, _notificationsWindows) { DataContext = item }; _notificationsWindows.Add(nw); nw.Closed += nw_Closed; nw.Show(); } }
private async void Refresh(string searchVal1, string searchVal2) { busyIndicator.IsBusy = true; string message = ""; if (searchVal1 != "" && searchVal2 != "") { message = await QueryValidateUser(searchVal1, searchVal2); } else { message = "Please input required fields."; } busyIndicator.IsBusy = false; if (message != null) { var window = new NoticeWindow(); NoticeWindow.message = message; window.Height = 0; window.Top = screenTopEdge + 8; window.Left = (screenWidth / 2) - (window.Width / 2); if (screenLeftEdge > 0 || screenLeftEdge < -8) { window.Left += screenLeftEdge; } window.ShowDialog(); using (var context = new DatabaseContext()) { var log = new Log(); log.Date = DateTime.Now.ToString("MM/dd/yyyy"); log.Time = DateTime.Now.ToString("hh:mm:ss tt"); log.Description = "An unknown user tries to log in with the username " + txtUsername.Text + "."; context.Logs.Add(log); context.SaveChanges(); } if (txtUsername.Text != null && txtUsername.Text != "") { txtPassword.Text = ""; txtPassword.Focus(); } else { txtUsername.Focus(); } } else { using (var context = new DatabaseContext()) { var user = context.UserAccounts.FirstOrDefault(c => c.UserAccountId == searchVal1); var employee = context.Employees.FirstOrDefault(c => c.EmployeeId == user.EmployeeId); Variables.Name = employee.FirstName + " " + employee.MiddleName + " " + employee.LastName; Variables.ULastName = employee.LastName; Variables.UFirstName = employee.FirstName; Variables.UEmpNo = txtUsername.Text; Variables.CustomerServiceAccess = user.CustomerServiceAccess; Variables.LeadManagementAccess = user.LeadManagementAccess; Variables.TaskManagementAccess = user.TaskManagementAccess; Variables.IsAdmin = user.IsAdmin; btnOK.IsEnabled = false; btnExit.IsEnabled = false; txtUsername.IsReadOnly = true; txtPassword.IsReadOnly = true; var windows = new NotificationWindow(); NotificationWindow.username = Variables.UFirstName + " " + Variables.ULastName; windows.Height = 0; windows.Top = screenTopEdge + 8; windows.Left = (screenWidth / 2) - (windows.Width / 2); if (screenLeftEdge > 0 || screenLeftEdge < -8) { windows.Left += screenLeftEdge; } windows.ShowDialog(); MainView.Username = txtUsername.Text; var log = new Log(); log.Date = DateTime.Now.ToString("MM/dd/yyyy"); log.Time = DateTime.Now.ToString("hh:mm:ss tt"); log.Description = NotificationWindow.username + " logs in on " + DateTime.Now.ToString("MMMM d, yyyy") + " at " + DateTime.Now.ToString("HH:mm") + "."; context.Logs.Add(log); context.SaveChanges(); var frame = DevExpress.Xpf.Core.Native.LayoutHelper.FindParentObject<NavigationFrame>(this); MainView page = new MainView(); frame.Navigate(page); } } }
private void ShowNotificationWindow() { //Show NotificationWindow. _notificationWindow = SimpleIoc.Default.GetInstance<NotificationWindow>(); _notificationWindow.FadeIn(); }