private void Window_Activated(object sender, EventArgs e) { WindowState = WindowState.Minimized; slider.Maximum = sleepTime - 1; labelMax.Content = (sleepTime - 1).ToString(); string notificationTimeString = ConfigurationManager.AppSettings.Get("NotificationTime"); if (notificationTimeString == null) { notificationTime = 1; ConfigurationManager.AppSettings.Set("NotificationTime", notificationTime.ToString()); } else { notificationTime = int.Parse(notificationTimeString); } slider.Value = notificationTime; dailogService = new NotificationDialogService(); notification = new Notification(); notification.ImgURL = "pack://application:,,,/warning.png"; notification.Title = $"Компьютер скоро уйдёт в сон"; notification.Message = "Пошевелите мышкой или нажмите кнопку"; player = new System.Media.SoundPlayer(Properties.Resources.music); //player.FileName = "music.wav"; //player = new System.Media.SoundPlayer("pack://application:,,,/music.wav"); notificationConfiguration = new NotificationConfiguration(new TimeSpan(0, sleepTime - notificationTime, 0), 350, 150, "", null); notificationController = new NotificationController(notificationTime, sleepTime); notificationController.ShowNotification = ShowNotification; notificationController.HideNotification = HideNotification; notificationController.StartWorker(); }
void ShowMessage(string messsge) { INotificationDialogService _dailogService = new NotificationDialogService(); var newNotification = new Notification() { Title = "", Message = messsge, }; _dailogService.ShowNotificationWindow(newNotification); }
private static void DefNot() { System.Windows.Application.Current.Dispatcher.Invoke( (Action)(() => { Notification req = new Notification() { Message = "Новая заявка № " + _topid + Environment.NewLine + Environment.NewLine + mdt.Rows[0]["Name"] + Environment.NewLine + mdt.Rows[0]["company"], Title = "Получена новая заявка", }; INotificationDialogService dia = new NotificationDialogService(); dia.ShowNotificationWindow(req); })); }
public MainViewModel() { notify = new NotificationDialogService(); log = new Log(); CheckPowerStatusCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { MainModel = MainProcessor.getPowerStatus(); }); GetHDDInfoCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { hddCollection = MainProcessor.getHardDriveInfo(); }); CheckInternetCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { MainModel.IsConnectedInternet = Helper.IsNetworkAvailable(); }); EnglishCommand = new RelayCommand <FrameworkElement>((e) => { return(true); }, (e) => { LocUtil.SwitchLanguage(e, "en-US"); LanguageCollection = MainProcessor.getLanguages(); LanguageWindow lw = new LanguageWindow(); lw.ShowDialog(); }); ChinaCommand = new RelayCommand <FrameworkElement>((e) => { return(true); }, (e) => { LocUtil.SwitchLanguage(e, "zh-CN"); //AboutWindow aw = new AboutWindow(); //aw.ShowDialog(); var newNotification = new Notification() { Title = "Test Fail", Message = "Test one Fail Please check your Machine Code and Try Again" // ,ImgURL = "pack://application:,,,a/Resources/Images/warning.png" }; var notificationConfiguration = NotificationConfiguration.DefaultConfiguration; notify.Show(newNotification, notificationConfiguration); }); SaveLanguageCommand = new RelayCommand <object>((p) => { return(true); }, (p) => { MainProcessor.SaveLanguage(this.LanguageCollection); }); //Log.Error("Test2", "Test2"); //var lst = Log.GetListErrors(); initData(); //iup.UnInstall("{c166523c-fe0c-4a94-a586-f1a80cfbbf3e}"); }
private static void DefNot() { System.Windows.Application.Current.Dispatcher.Invoke( (Action)(() => { Notification req = new Notification() { Message = "Новая заявка № " + _topid + Environment.NewLine + Environment.NewLine + "Название: " + mdt.Rows[0]["Name"] + Environment.NewLine + "Компания: " + mdt.Rows[0]["company"] + Environment.NewLine + Environment.NewLine + "Содержание: " + _content, Title = "Получена новая заявка", }; INotificationDialogService dia = new NotificationDialogService(); dia.ShowNotificationWindow(req); })); //var p = MainWindowViewModel.Values4Not(); }
private void LoginButton_Click(object sender, RoutedEventArgs e) { MySqlConnection myConn = new MySqlConnection(myConnection); SpeechSynthesizer s = new SpeechSynthesizer(); try { MySqlCommand SelectCommand = new MySqlCommand("SELECT * FROM system_administrators WHERE system_administrators_user_id='" + this.txt_institutionID.Text + "' AND system_administrators_password='******' ", myConn); myConn.Open(); if (this.txt_institutionID.Text == "" && this.txt_password.Text == "") { LoginAlertTitle.Text = "EMPTY FIELDS"; s.Speak(LoginAlertTitle.Text); LoginModal.Visibility = Visibility.Visible; Console.Beep(); } else { MySqlDataReader myReader; myReader = SelectCommand.ExecuteReader(); int count = 0; while (myReader.Read()) { count = count + 1; } if (count == 1) { string privilage = myReader.GetString("system_administrators_privileges"); string institution_registry_id = myReader.GetString("system_institution_registry_id"); string activeadminUser = myReader.GetString("system_administrators_user_id"); string complete = institution_registry_id + "-" + activeadminUser; //lbl_label1.Text = privilage; if (privilage == "Master admin") { Console.Beep(); MainGrid.Children.Clear(); MainGrid.Children.Add(new AdminDashboardMenu(institution_registry_id)); } else if (privilage == "Library") { MainGrid.Children.Clear(); MainGrid.Children.Add(new LibraryDashboard(complete)); } else if (privilage == "Staff") { MainGrid.Children.Clear(); MainGrid.Children.Add(new StaffAdminDashboard(complete)); } else if (privilage == "Academics") { MainGrid.Children.Clear(); MainGrid.Children.Add(new AcademicsAdminDashboard(complete)); } else if (privilage == "Finance") { MainGrid.Children.Clear(); MainGrid.Children.Add(new FinanceAdminDashboard()); } else { MessageBox.Show("SORRY"); LoginAlertTitle.Text = "ACCESS DENIED"; s.Speak(LoginAlertTitle.Text); LoginModal.Visibility = Visibility.Visible; } } else { Console.Beep(); LoginAlertTitle.Text = "ACCESS DENIED!"; s.Speak(LoginAlertTitle.Text); LoginModal.Visibility = Visibility.Visible; } } myConn.Close(); } catch (Exception ex) { //String LoginText = "SORRY. INTERNET CONNECTION LOST"; //s.Speak(LoginText); INotificationDialogService _dailogService = new NotificationDialogService(); var newNotification = new Notification() { Title = "SYSTEM ERROR", Message = "Sorry error detected! \n\n" + ex.Message }; _dailogService.ShowNotificationWindow(newNotification); } }
public MainWindow() { var nbRandom = deplacementClick.Next(500, 1500); InitializeComponent(); Process NourrirePet = Process.Start(@"C:\Users\Pierre\AppData\Local\Ankama\Dofus\app\Dofus.exe");//Chemin de l'application dofus sans le launcher. INotificationDialogService notificationNourritureFamilier = new NotificationDialogService(); Thread.Sleep(10000); souris.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RETURN); Thread.Sleep(nbRandom); souris.Keyboard.TextEntry(infoUser.Fichier(cheminFichierMotDePasse)); // mot de passe Thread.Sleep(5000); souris.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RETURN); Thread.Sleep(2000); souris.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RETURN); Thread.Sleep(2000); souris.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.RETURN); Thread.Sleep(20000); souris.Keyboard.KeyPress(WindowsInput.Native.VirtualKeyCode.VK_I); Thread.Sleep(nbRandom); souris.Mouse.MoveMouseTo(convertpixel.ConvertPixelY(1267), convertpixel.ConvertPixelX(137));// Selection "tous" les object pour permetre de rechercher plus facilement les familiers. Thread.Sleep(nbRandom); souris.Mouse.LeftButtonClick(); Thread.Sleep(nbRandom); for (int z = 0; z < Familier5heures[z].Length; z++) { RechercheFamilier(); souris.Mouse.LeftButtonDoubleClick(); Thread.Sleep(nbRandom); souris.Keyboard.TextEntry(Familier5heures[z]); Thread.Sleep(nbRandom); for (int i = 0; i < NombreDeLignes(NbFamilierParNom[z]); i++) { for (int j = 0; j < 5 && i * 5 + j < NbFamilierParNom[z]; j++) { Nourrir(posx, posy, posxNouriture, posyNouriture); posx += 60; posxNouriture += 60; Thread.Sleep(nbRandom); } posx -= 300; posxNouriture -= 300; posy += 60; posyNouriture += 60; } nbBoucle += 1; posx = 1270; posy = 215; posxNouriture = 1350; posyNouriture = 250; } for (int i = 0; i < NbFamilierParNom.Length; i++) { if ((NbFamilierParNom[i] * 4) < 10) { Notification.Program.Main(); } } QuitterApplication(); NourrirePet.Kill(); }