//events private void CancelBtn_Click(object sender, RoutedEventArgs e) { if (MadeChanges) { AlertWindow alert = new AlertWindow("You made unsaved changes. Are you sure you want to cancel?", true); alert.Owner = MainWindow.ActiveWindow; alert.ShowDialog(); if (alert.DialogResult.Value) { //remove the properties window MainWindow.ActiveWindow.ShowProperties = false; //remove the eventhandler from the properties grid MainWindow.ActiveWindow.propertiesBackgroundGrid.MouseUp -= CancelBtn_Click; } } else { MainWindow.ActiveWindow.ShowProperties = false; //remove the eventhandler from the properties grid MainWindow.ActiveWindow.propertiesBackgroundGrid.MouseUp -= CancelBtn_Click; } }
public QuickWindowViewModel(object item) { Item = item; if (Item is Announcement) { Info = (Item as Announcement).Info; Title = $"Информация о объявлении {(Item as Announcement).Name}"; Name = (Item as Announcement).Name; Region = regionRepository.getRegion((Item as Announcement).idRegion.Value); ContactInfo = $"Mail: {userRepository.getById((Item as Announcement).seller).Mail}\n" + $"Телефон: {userRepository.getById((Item as Announcement).seller).TelNumber}\n"; About = $"{(Item as Announcement).About}\n"; Cost = Decimal.Round((Item as Announcement).Cost, 2); } else if (Item is TmpAnnouncement) { Info = (Item as TmpAnnouncement).Info; Title = $"Информация о объявлении {(Item as TmpAnnouncement).Name}"; Name = (Item as TmpAnnouncement).Name; Region = regionRepository.getRegion((Item as TmpAnnouncement).idRegion.Value); ContactInfo = $"Mail: {userRepository.getById((Item as TmpAnnouncement).seller).Mail}\n" + $"Телефон: {userRepository.getById((Item as TmpAnnouncement).seller).TelNumber}\n"; About = $"{(Item as TmpAnnouncement).About}\n"; Cost = Decimal.Round((Item as TmpAnnouncement).Cost, 2); } else { AlertWindow alertWindow = new AlertWindow("Ошибка типа данных!"); alertWindow.ShowDialog(); } }
/// <summary> /// Событие вызывающееся по окончанию работы таймера. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RegisterForm_UnblockTimer(object sender, EventArgs e) { RegisterTimer?.Stop(); var Alert = new AlertWindow("Ошибка", "Время ожидания ответа от сервера истекло.\n" + "Возможно введены некорректные данные.", _RegisterWindow.RegisterElements_Unblock); }
// Play Pachinko! void OnMouseClicked() { if (isPlay()) { return; } ClearBoxes(); string toggle = ""; GameObject[] btns = GameObject.FindGameObjectsWithTag("BetBtn"); for (int i = 0; i < btns.Length; i++) { if (btns[i].GetComponent <Pinball_BetBtn>().toggle) { toggle = btns[i].transform.name; } } if (toggle.Length == 0) { AlertWindow window = (AlertWindow)((GameObject)Instantiate(Resources.Load("prefab/Alert"))).GetComponent <AlertWindow>(); window.title.text = "Pin&Ball"; window.text.text = "You need selecting bet coin"; } else { int num = 0; if (toggle == "Bet1") { num = 1; } else if (toggle == "Bet10") { num = 10; } else if (toggle == "Bet50") { num = 50; } if (PlayerMeta.GetGold() >= num) { PlayerMeta.decreaseGold(num); transform.localScale = new Vector3(1.4f, 1.4f, 1); GameObject shooter = GameObject.Find("Shooter"); shooter.SendMessage("GameStart", num); } else { AlertWindow window = (AlertWindow)((GameObject)Instantiate(Resources.Load("prefab/Alert"))).GetComponent <AlertWindow>(); window.title.text = "Pin&Ball"; window.text.text = "You need more gold"; } } }
/* * TAG FOUND EVENT: * This event occurs when the user passes a NFC card near the reader. * It checks if the UID is valid and unlock the door if so. */ private void TagFound(string uid) { if (!scanWindow.IsShowing()) { // Check authorization var authorized = DataHelper.CheckCardId(uid); // Show access window accessWindow.Show(authorized); // Log the event string logText; Log log; if (authorized) { // Access granted UnlockDoor(); logText = "Card \"" + uid + "\" inserted. Authorized access."; log = new Log(Log.TypeAccess, null, uid, logText); } else { // Access denied logText = "Card \"" + uid + "\" inserted. Access denied!"; log = new Log(Log.TypeInfo, logText); } DebugOnly.Print(logText); // Add log to loglist DataHelper.AddLog(log); } else { // Log new cardID var newCardIdLog = new Log( Log.TypeAccess, pendingPin, uid, "Card \"" + uid + "\" has been added for pin \"" + pendingPin + "\"."); // Update CardID in userList DataHelper.AddCardId(pendingPin, uid); // Send urgent log DataHelper.AddLog(newCardIdLog, true); var cardAddedAlert = new AlertWindow(WindowAlertPeriod); cardAddedAlert.SetText("NFC card added!"); cardAddedAlert.SetPositiveButton("Ok", delegate { cardAddedAlert.Dismiss(); }); cardAddedAlert.Show(); DebugOnly.Print("Card added to user with pin \"" + pendingPin + "\""); } }
/// <summary> /// Uses the incoming alert details to dispaly message /// </summary> private void DisplayAlertMessage(AlertMessage alertMessage) { _currentDispatcher.Invoke(DispatcherPriority.Background, (Action)(() => { AlertWindow notificationWindow = new AlertWindow(); notificationWindow.DataContext = new AlertWindowViewModel(alertMessage); notificationWindow.Show(); })); }
public void changeDataOfUser() { User tmp = new User(FirstName, SecondName, Mail, TelNumber, About, CurrentUser.User.image, user.privilege); userRepository.update(user, tmp); CurrentUser.User = userRepository.getByMail(Mail); AlertWindow alertWindow = new AlertWindow($"Изменения сохранены\nДля входа используйте новый Mail - {Mail}"); alertWindow.ShowDialog(); }
public void delete() { if (SelectedItem is User) { if (CurrentUser.isAdmin()) { DialogWindow dialogWindow = new DialogWindow(); dialogWindow.DataContext = this; Message = $"Уверены, что хотите удалить пользователя {(SelectedItem as User).firstName} {(SelectedItem as User).secondName}?"; dialogWindow.ShowDialog(); if (dialogWindow.DialogResult == true) { deleteUser(SelectedItem as User); } } else { AlertWindow alertWindow = new AlertWindow("У вас недостаточно прав для совершения данного действия"); alertWindow.ShowDialog(); } } else if (SelectedItem is Announcement) { DialogWindow dialogWindow = new DialogWindow(); dialogWindow.DataContext = this; Message = $"Уверены, что хотите удалить объявление \"{(SelectedItem as Announcement).Name}\" ?"; dialogWindow.ShowDialog(); if (dialogWindow.DialogResult == true) { announcementRepository.delete(SelectedItem as Announcement); } } else if (SelectedItem is TmpAnnouncement) { DialogWindow dialogWindow = new DialogWindow(); dialogWindow.DataContext = this; Message = $"Уверены, что хотите удалить объявление \"{(SelectedItem as TmpAnnouncement).Name}\" ?"; dialogWindow.ShowDialog(); if (dialogWindow.DialogResult == true) { tmpAnnouncementRepository.delete(SelectedItem as TmpAnnouncement); } } else { AlertWindow alertWindow = new AlertWindow($"Выберите объект"); alertWindow.ShowDialog(); } update(); }
private void onTapExitExercise() { AlertWindow.show( Properties.Strings.accent_exercise_exit_title, Properties.Strings.accent_exercise_exit_message, null, Properties.Strings.finish_exercise_text, () => { finishExercise(); }, Properties.Strings.cancel_text, null); }
private void DeleteItemBtn_Click(object sender, RoutedEventArgs e) { AlertWindow alert = new AlertWindow($"Are you sure you want to delete {ledItem.ItemName}?", true); alert.Owner = MainWindow.ActiveWindow; alert.ShowDialog(); if (alert.DialogResult.Value) { ledItem.Delete(); MainWindow.ActiveWindow.ShowProperties = false; } }
private void SendForgotPasswordCommand(string username) { ServerManager.Instance.Reset(); ServerManager.Instance.SendUserCommand("FORGOTPASSWORD", username); var alert = new AlertWindow(); alert.Closed += (o, e) => { ScreenManager.SetScreen(new LoginScreen()); }; alert.Show("Password Sent", "Your password has been sent to the email address you used when the account was created."); }
private void ShowLyrics(object sender, EventArgs e) { try { Button button = (Button)sender; string name = ""; string artist = ""; char separator = " ".ToCharArray()[0]; string buttonLabel = ""; if (button.Name == "1") { buttonLabel = button21.Label; name = buttonLabel.Split(separator)[0]; artist = buttonLabel.Split(separator)[2]; } else if (button.Name == "2") { buttonLabel = button22.Label; name = buttonLabel.Split(separator)[0]; artist = buttonLabel.Split(separator)[2]; } else if (button.Name == "3") { buttonLabel = button23.Label; name = buttonLabel.Split(separator)[0]; artist = buttonLabel.Split(separator)[2]; } else if (button.Name == "4") { buttonLabel = button24.Label; name = buttonLabel.Split(separator)[0]; artist = buttonLabel.Split(separator)[2]; } XDocument document = new XDocument(new XElement("Data", new XElement("opCode", 40), new XElement("SongName", name), new XElement("Artist", artist))); SocketClient.GetSocketClient().send(document); document = SocketClient.GetSocketClient().Listen(); string lyrics = document.Root.Element("Reply").Value; Lyrics lyricsWindow = new Lyrics(lyrics); lyricsWindow.Show(); } catch (Exception) { AlertWindow alertWindow = new AlertWindow("Error: No se pudo eliminar el elemento o este no existe, por favor reintentar"); } }
private void Edit(object sender, EventArgs e) { try { Button button = (Button)sender; string name = ""; string artist = ""; char separator = " ".ToCharArray()[0]; string buttonLabel = ""; if (button.Name == "1") { buttonLabel = button21.Label; name = buttonLabel.Split(separator)[0]; artist = buttonLabel.Split(separator)[2]; } else if (button.Name == "2") { buttonLabel = button22.Label; name = buttonLabel.Split(separator)[0]; artist = buttonLabel.Split(separator)[2]; } else if (button.Name == "3") { buttonLabel = button23.Label; name = buttonLabel.Split(separator)[0]; artist = buttonLabel.Split(separator)[2]; } else if (button.Name == "4") { buttonLabel = button24.Label; name = buttonLabel.Split(separator)[0]; artist = buttonLabel.Split(separator)[2]; } XDocument document = new XDocument(new XElement("Data", new XElement("opCode", 25), new XElement("SongName", name), new XElement("Artist", artist))); SocketClient.GetSocketClient().send(document); EditSong editSong = new EditSong(name, artist, page); document = XMLGenerator.RequestSongs(page); UpdateSongs(document); } catch (Exception) { AlertWindow alertWindow = new AlertWindow("Error: No se pudo eliminar el elemento o este no existe, por favor reintentar"); } }
/// <summary> /// Регестирует аккаунт в системе. /// </summary> /// <param name="UserEntity">Сущность пользователя</param> internal void RegisterAccount(User UserEntity) { if (Sender.SendToServer("User.Register", UserEntity, 2)) { RegisterTimer = new DispatcherTimer(); RegisterTimer.Tick += new EventHandler(RegisterForm_UnblockTimer); RegisterTimer.Interval = new TimeSpan(0, 0, 5); RegisterTimer.Start(); } else { var Alert = new AlertWindow("Ошибка", "Не удалось соединиться с сервером.\n" + "Возможно сервер выключен или присутствуют неполадки в вашем интернет-соединении.", _RegisterWindow.RegisterElements_Unblock); } }
public UserViewWindowViewModel(object item) { Item = item; if (Item is User) { Title = $"Информация о пользователе {(Item as User).FirstName} {(Item as User).SecondName}"; Name = $"{(Item as User).FirstName} {(Item as User).SecondName}"; ContactInfo = $"Mail: {(Item as User).Mail}\nТелефон: {(Item as User).TelNumber}\n"; About = $"{(Item as User).About}\n"; BitmapImage = LoadPhoto(); } else { AlertWindow alertWindow = new AlertWindow("Ошибка типа данных!"); alertWindow.ShowDialog(); } }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="args">Event args.</param> private void Execute(object sender, EventArgs args) { ThreadHelper.ThrowIfNotOnUIThread(); ConfirmationWindow confirmationWindow = new ConfirmationWindow(); DialogResult buildConfirmation = confirmationWindow.ShowDialogWithMessage("JsonButler needs to build solution to identify this type.\nProceed?"); if (buildConfirmation != DialogResult.OK) { return; } _package.Dte?.Solution.SolutionBuild.Build(true); TextSelection textSelection = _package.Dte?.ActiveDocument.Selection as TextSelection; CodeElement codeElement = EditorUtilities.GetCodeElement(textSelection); AlertWindow alertWindow; if (codeElement == null) { alertWindow = new AlertWindow(); alertWindow.ShowDialogWithMessage("Invalid code element selected for serialization."); return; } ITypeResolutionService resolutionService = GetResolutionService(codeElement.ProjectItem.ContainingProject); Type type = resolutionService.GetType(codeElement.FullName); ButlerSerializerSettings serializerSettings = new ButlerSerializerSettings(type?.Assembly); JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings(); SerializerContractResolver contractResolver = new SerializerContractResolver(); contractResolver.SerializationType = _package.SerializationType; jsonSerializerSettings.ContractResolver = contractResolver; jsonSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; jsonSerializerSettings.Formatting = Formatting.Indented; serializerSettings.JsonSerializerSettings = jsonSerializerSettings; string serialized = ButlerSerializer.SerializeType(type, serializerSettings); Clipboard.SetText(serialized); _package.DoAlert("Serialized JSON contents copied to clipboard."); }
//events private void CancelBtn_Click(object sender, RoutedEventArgs e) { if (MadeChanges) { AlertWindow alert = new AlertWindow("You made unsaved changes. Are you sure you want to cancel?", true); alert.ShowDialog(); if (!alert.DialogResult.Value) { return; } } MainWindow.ActiveWindow.ShowColorPicker = false; //remove the eventhandler from the colorpicker grid MainWindow.ActiveWindow.colorPickerBackgroundGrid.MouseUp -= CancelBtn_Click; }
public void DoAlert(string alertMessage) { _statusBar = _statusBar ?? (_statusBar = GetService(typeof(SVsStatusbar)) as IVsStatusbar); if (_statusBar != null) { _statusBar.IsFrozen(out int frozen); if (frozen == 0) { _statusBar.SetText($"JsonButler: {alertMessage}"); } } if (_optionPage.ShouldShowConfirmationAlerts) { AlertWindow alertWindow = new AlertWindow(); alertWindow.ShowDialogWithMessage(alertMessage); } }
private void DoorOpen(Button sender, Button.ButtonState state) { doorOpen = true; pinWindow.SetText("Door open"); DebugOnly.Print("Door open!"); if (!authorizedAccess) { // Security breach DebugOnly.Print("Security breach! Unauthorized access!"); DataHelper.AddLog(new Log(Log.TypeError, "Security breach! Unauthorized access!")); var breachWindow = new AlertWindow(20000); breachWindow.SetText("BREACH ALERT!!! \n UNAUTHORIZED ACCESS!!! \n\n\n\n Please contact the administrator immediately."); breachWindow.Show(); } }
protected override void OnStartup(StartupEventArgs e) { var systemVersion = Environment.OSVersion.Version; if (systemVersion.Major < 6) { MessageBox.Show("Incompatible system version, must be at least Windows Vista", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); } DirectoryGuard.DirectoriesSanityCheck(); if (!HasWriteAccessToFolder(AppDomain.CurrentDomain.BaseDirectory)) { AlertWindow.Show(LocaleSelector.GetLocaleString("AlertWindow_NoWriteAccess")); CanWriteToCurrentFolder = false; } else { CanWriteToCurrentFolder = true; } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; WindowFlashHelper = new WindowFlashHelper(this); Connection = new Connection { SendUserAgent = SettingsSelector.GetConfigurationValue <bool>("Behavior_SendUserAgent") }; StatsManager = new StatsManager(Connection); ArchiveManager = new ArchiveManager(); LocaleSelector.SetLocaleIdentifier( SettingsSelector.GetConfigurationValue <string>("Language") ); ColorSchemeLoader = new ColorSchemeLoader(); ColorSchemeLoader.LoadColorSchemes(); ColorSchemeLoader.ApplyColors(); base.OnStartup(e); }
public void accept() { if (SelectedItem is User) { if (CurrentUser.isAdmin()) { if ((SelectedItem as User).privilege.Equals("admin")) { userRepository.changePrivelege((SelectedItem as User), "user"); } else if ((SelectedItem as User).privilege.Equals("user")) { userRepository.changePrivelege((SelectedItem as User), "moderator"); } else if ((SelectedItem as User).privilege.Equals("moderator")) { userRepository.changePrivelege((SelectedItem as User), "admin"); } AlertWindow alertWindow = new AlertWindow($"Пользователь {(SelectedItem as User).firstName} {(SelectedItem as User).secondName} теперь {(SelectedItem as User).privilege}"); alertWindow.ShowDialog(); } else { AlertWindow alertWindow = new AlertWindow("У вас недостаточно прав для совершения данного действия"); alertWindow.ShowDialog(); } } else if (SelectedItem is TmpAnnouncement) { transferToAnnouncemet(SelectedItem as TmpAnnouncement); } else { AlertWindow alertWindow = new AlertWindow($"Выберите объект"); alertWindow.ShowDialog(); } update(); }
void LoginScreen_Loaded(object sender, RoutedEventArgs e) { // Check socket port, if fails to open a connection then use the http handler. ServerManager.Connected += (o, args) => { this.Dispatcher.BeginInvoke(() => { ServerManager.Instance.Reset(); ServerManager.Instance.Response += new ServerResponseEventHandler(_server_Response); txtUsername.Focus(); // Check local storage for the remember me token. var token = StorageManager.GetPersistLoginToken(); if (!String.IsNullOrEmpty(token)) { _waitDialog.Show("Attempting login..."); ServerManager.Instance.SendUserCommand("LOGIN", token); } txtUsername.Text = _username; }); }; ServerManager.ConnectFailed += (o, args) => { this.Dispatcher.BeginInvoke(() => { var alert = new AlertWindow(); alert.Closed += (s, a) => { System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("http://www.perenthia.com")); }; alert.Show("Connection to Server Failed", String.Format(SR.ConnectionFailed, Settings.GameServerPort)); }); }; ServerManager.Configure(); }
public void setPage(int index) { switch (index) { case 0: Content = new AllAnnouncement(); break; case 1: Content = new MyAnnouncementPage(); break; case 2: Content = new PersonAreaPage(); break; case 3: { if (CurrentUser.isAdmin() || CurrentUser.isModerator()) { Content = new AdminPage(); } else { AlertWindow alertWindow = new AlertWindow("У вас нет прав зайти в это меню"); alertWindow.ShowDialog(); } break; } default: Content = new AllAnnouncement(); break; } }
public void FinishGame() { _onPause = true; AlertWindow = new DeadAlertWindow(this); }
/* * PIN FOUND EVENT: * This event occurs when the user inserts a pin code. It checks if the pin is valid and unlock the door if so. * If the pin has no related CardId it prompts the user to add it. */ private void PinFound(string pin) { string masterPin = SettingsManager.Get(SettingsManager.MasterPin); // Check master pin if (String.Compare(masterPin, pin) == 0) { maintenanceWindow.Show(); return; } // Check authorization var authorized = DataHelper.CheckPin(pin); var nullCardId = DataHelper.PinHasNullCardId(pin); // Log the event string logText; Log log; if (authorized) { // Access granted UnlockDoor(); logText = "Pin \"" + pin + "\" inserted. Authorized access."; log = new Log(Log.TypeAccess, pin, logText); } else { // Access denied logText = "Pin \"" + pin + "\" inserted. Access denied!"; log = new Log(Log.TypeInfo, logText); } DebugOnly.Print(logText); // Add log to loglist DataHelper.AddLog(log); if (nullCardId && authorized) { // Null CardID detected, prompt the user to set one var nullCardIdAlert = new AlertWindow(WindowAlertPeriod); nullCardIdAlert.SetText( "It happears that this user has no related NFC card.\nDo you want to scan it now?"); nullCardIdAlert.SetPositiveButton("Yes", delegate { // User wants to add a new NFC card pendingPin = pin; scanWindow.Show(); }); nullCardIdAlert.SetNegativeButton("No", delegate { // User doesn't want to add a new NFC card nullCardIdAlert.Dismiss(); }); nullCardIdAlert.Show(); } else { // Everything is fine accessWindow.Show(authorized); } }
public void ShowInfoWindow(string info) { AlertWindow infoWindow = new AlertWindow(info); infoWindow.ShowDialog(); }
public void ResumeGame() { _onPause = false; AlertWindow = null; }
public void PauseGame() { _onPause = true; AlertWindow = new MenuWindow(this); }
public void ExitToMenu() { AlertWindow = null; ExitScreen(); }
public void RestartGame() { _startNewGame = true; AlertWindow = null; LoadContent(); }