public static void Error(string message) { Deployment.Current.Dispatcher.BeginInvoke(() => { var errWindow = new ErrorWindow(message); errWindow.Show(); }); }
// Выполняется, когда пользователь переходит на эту страницу. protected override void OnNavigatedTo(NavigationEventArgs e) { if (!WebContext.Current.User.IsInRole("Worker")) { ErrorWindow errorWnd = new ErrorWindow("Ошибка доступа.", "У вас нет доступа к данной странице. Возможно вы не авторизировались."); errorWnd.Show(); NavigationService.Navigate(new Uri("/Home", UriKind.Relative)); } }
public static void Show(string message, string details) { if (window != null) return; window = new ErrorWindow(message, details); window.Closed += (sender, args) => window = null; window.Show(); }
public void setErrorText(string text) { if(errorWindow.gameObject.activeSelf) { if(window == null) { window = errorWindow.GetComponentInChildren<ErrorWindow>(); } window.setText(text); } }
private void OnOperationCompleted(object sender, EventArgs e) { OperationBase operation = (OperationBase)sender; this.IsBusy = false; operation.Completed -= OnOperationCompleted; if (operation.HasError && (operation.IsErrorHandled == false)) { ErrorWindow errorWin = new ErrorWindow(operation.Error); errorWin.Show(); operation.MarkErrorAsHandled(); } }
public ErrorProperty(ErrorProvider ep, Control control) { this.ep = ep; this.control = control; alignment = ErrorIconAlignment.MiddleRight; padding = 0; text = string.Empty; blink_count = 0; tick = new EventHandler(window_Tick); window = new ErrorWindow (); window.Visible = false; window.Width = ep.icon.Width; window.Height = ep.icon.Height; #if NET_2_0 // UIA Framework: Associate ErrorProvider with Control ErrorProvider.OnUIAErrorProviderHookUp (ep, new ControlEventArgs (control)); // UIA Framework: Generate event to associate UserControl with ErrorProvider window.VisibleChanged += delegate (object sender, EventArgs args) { if (window.Visible == true) ErrorProvider.OnUIAControlHookUp (control, new ControlEventArgs (window)); else ErrorProvider.OnUIAControlUnhookUp (control, new ControlEventArgs (window)); }; #endif if (control.Parent != null) { #if NET_2_0 // UIA Framework: Generate event to associate UserControl with ErrorProvider ErrorProvider.OnUIAControlHookUp (control, new ControlEventArgs (window)); #endif control.Parent.Controls.Add(window); control.Parent.Controls.SetChildIndex(window, control.Parent.Controls.IndexOf (control) + 1); } window.Paint += new PaintEventHandler(window_Paint); window.MouseEnter += new EventHandler(window_MouseEnter); window.MouseLeave += new EventHandler(window_MouseLeave); control.SizeChanged += new EventHandler(control_SizeLocationChanged); control.LocationChanged += new EventHandler(control_SizeLocationChanged); control.ParentChanged += new EventHandler (control_ParentChanged); // Do we want to block mouse clicks? if so we need a few more events handled CalculateAlignment(); }
private void InitializeShell() { // use custom shell and view factory Bxf.Shell.Instance = new NavigationShell(); // initialize Bxf event handlers var presenter = (Bxf.IPresenter)Bxf.Shell.Instance; presenter.OnShowView += (view, region) => { NextView = view.ViewName; }; presenter.OnShowError += (message, title) => { ChildWindow errorWin = new ErrorWindow(title, message); errorWin.Show(); }; }
private void Download() { try { data = c.DownloadString(adress); JObject o = JObject.Parse(data); if (o != null) { SuccesLabel.Visibility = Visibility.Visible; JArray array = (JArray)o["sounds"]; if (array.Count > 0) { database.clearTableSounds(); } for (int i = 0; i < array.Count; i++) { var name = (string)array[i]["name"]; var url = (string)array[i]["url"]; var size = (string)array[i]["size"]; database.AddSound(name, url, size); } JArray arrayGames = (JArray)o["games"]; for (int i = 0; i < arrayGames.Count; i++) { Uri Url = new Uri(arrayGames[i]["url"].ToString()); data = c.DownloadString(Url); data = Win1251ToUTF8(data); parseXmlGames(data); parseXmlTeam(data, i + 1); } } } catch (Exception ex) { ErrorWindow errorWindow = new ErrorWindow(); errorWindow.ErrorLabel.Content = ex.Message; errorWindow.ShowDialog(); ClearEffect(); } }
public static void MyHandler(object sender, UnhandledExceptionEventArgs args) { Exception e = (Exception)args.ExceptionObject; if (e.Source != "iRacingSdkWrapper") { #if !DEBUG string error = String.Format( "{0}\n{1}\n{2}\n{3}", e.Message, e.Source, e.TargetSite, e.StackTrace); ErrorWindow window = new ErrorWindow(error); window.ShowDialog(); #endif } }
/// <summary> /// Completion handler for the login operation that occurs after a successful /// registration and login attempt. This will close the window. On the unexpected /// event that this operation failed (the user was just added so why wouldn't it /// be authenticated successfully) an <see cref="ErrorWindow"/> is created and /// will display the error message. /// </summary> /// <param name="loginOperation">The <see cref="LoginOperation"/> that has completed.</param> private void LoginOperation_Completed(LoginOperation loginOperation) { if (!loginOperation.IsCanceled) { this.parentWindow.Close(); if (loginOperation.HasError) { ErrorWindow.CreateNew(string.Format(System.Globalization.CultureInfo.CurrentUICulture, ErrorResources.ErrorLoginAfterRegistrationFailed, loginOperation.Error.Message)); loginOperation.MarkErrorAsHandled(); } else if (loginOperation.LoginSuccess == false) { // The operation was successful, but the actual login was not ErrorWindow.CreateNew(string.Format(System.Globalization.CultureInfo.CurrentUICulture, ErrorResources.ErrorLoginAfterRegistrationFailed, ErrorResources.ErrorBadUserNameOrPassword)); } } }
public LoginMC() { try { InitializeComponent(); Username_Login.Text = GADD_Application.Properties.Settings.Default.username; password_login.Text = GADD_Application.Properties.Settings.Default.password; a3Switcher.TabStop = false; a3Switcher.FlatStyle = FlatStyle.Flat; a3Switcher.FlatAppearance.BorderSize = 0; a3Switcher.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); //transparent } catch (Exception errormessage) { ErrorWindow ew = new ErrorWindow(errormessage); ew.Show(); } }
public void ShowException(Exception Exception, string Message, bool Blocking = false) { Application.Current.Dispatcher.Invoke(() => { var win = new ErrorWindow(Exception, Message); _audioPlayer.Play(SoundKind.Error); if (Blocking) { win.ShowDialog(); } else { win.ShowAndFocus(); } }); }
public Guid Process(Exception ex, string displayMessage, ErrorWindow errorWindow, params object[] args) { Guid errorId = Guid.NewGuid(); Log.WriteInfo("VERSION: {0}, ERROR: ID={1}, Message={2}", Constants.Version, errorId, ex.Message); Log.Write(ex, errorId, args); try { sendByEmail(ex, errorId, (displayMessage != null ? string.Format(displayMessage, errorId) : null), errorWindow); } catch (Exception e) { MessageBox.Show(e.Message); } return(errorId); }
// Start is called before the first frame update void Start() { mainUI = GetComponent <UIPanel>().ui; errorWindow = new ErrorWindow(); inputPhone = mainUI.GetChild("inputPhone").asTextInput; inputCode = mainUI.GetChild("inputCode").asTextInput; inputPass = mainUI.GetChild("inputPass").asTextInput; inputConfirm = mainUI.GetChild("inputConfirm").asTextInput; mainUI.GetChild("btnReset").onClick.Add(btnResetClick); mainUI.GetChild("btnGetCode").onClick.Add(btnGetCodeClick); mainUI.GetChild("btnLogin").onClick.Add(() => { SceneManager.LoadScene("Login"); }); }
public static DialogResult ShowErrorDialog(string friendlyMessage, Exception ex, bool allowContinue) { var lang = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName; using var dialog = new ErrorWindow(lang) { ShowContinue = allowContinue, Message = friendlyMessage, Error = ex, }; var dialogResult = dialog.ShowDialog(); if (dialogResult == DialogResult.Abort) { Environment.Exit(1); } return(dialogResult); }
public void Clear() { ErrorWindow[] array = new ErrorWindow[this.windows.Values.Count]; this.windows.Values.CopyTo(array, 0); for (int i = 0; i < array.Length; i++) { array[i].Dispose(); } this.windows.Clear(); foreach (ControlItem item in this.items.Values) { if (item != null) { item.Dispose(); } } this.items.Clear(); }
public static bool CheckGameDef(GameDef game) { Program.Game = new Game(game); Program.Game.TestBegin(); var engine = new Engine(true); string[] terr = engine.TestScripts(Program.Game); Program.Game.End(); if (terr.Length > 0) { String ewe = terr.Aggregate("", (current, s) => current + (s + Environment.NewLine)); var er = new ErrorWindow(ewe); er.ShowDialog(); } return terr.Length == 0; }
void Awake() { GameObject temp = GameObject.FindGameObjectWithTag("HintBox"); if (ErrorWindow <DisplayHint> .CanBeAssigned(temp, this, "HintBox")) { hintbox = temp.GetComponent <HintBoxController> (); // hintbox.AddObj(gameObject); } GameObject tempFlash = GameObject.FindGameObjectWithTag("FlashingTextBox"); if (ErrorWindow <DisplayHint> .CanBeAssigned(tempFlash, this, "FlashingTextBox")) { flashText = tempFlash.GetComponent <FlashingTextController> (); // flashText.AddObj(gameObject); } }
public override void StartUp() { control = new ErrorWindow(); tab = AddToTab(PluginManager.BottomTab, control, "Errors"); errorListViewModel = GlueState.Self.ErrorList; errorListViewModel.Errors.CollectionChanged += HandleErrorsCollectionChanged; errorListViewModel.RefreshClicked += HandleRefreshClicked; control.DataContext = errorListViewModel; this.ReactToLoadedGlux += HandleLoadedGlux; this.ReactToFileChangeHandler += HandleFileChanged; this.ReactToFileRemoved += HandleFileRemoved; this.ReactToUnloadedGlux += HandleUnloadedGlux; this.ReactToFileReadError += HandleFileReadError; }
private void DeleteDatabase(string password, string dbName) { var app = (App)Application.Current; app.IsBusy = true; app.ClientService.DeleteDatabase(password, dbName, (error) => { app.IsBusy = false; if (error != null) { ErrorWindow.CreateNew(error); return; } this.LoadDatabaseList(); }); }
/// <summary> /// Completion handler for the registration operation. If there was an error, an /// <see cref="ErrorWindow"/> is displayed to the user. Otherwise, this triggers /// a login operation that will automatically log in the just registered user. /// </summary> private void RegistrationOperation_Completed(InvokeOperation <CreateUserStatus> operation) { if (!operation.IsCanceled) { if (operation.HasError) { ErrorWindow.CreateNew(operation.Error); operation.MarkErrorAsHandled(); } else if (operation.Value == CreateUserStatus.Success) { var userService = IoC.Resolve <IApplicationUserService>(); userService.ApplicationUserRetrieved += (sender, e) => { if (e.Value is ApplicationUser) { ApplicationUser.CurrentUser = e.Value as ApplicationUser; } }; userService.ApplicationUserRetrievalError += (sender, e) => { ErrorWindow.CreateNew("Error occured retrieving the application user"); }; userService.RetrieveApplicationUser(registrationData.UserName); this.registrationData.CurrentOperation = WebContext.Current.Authentication.Login(this.registrationData.ToLoginParameters(), this.LoginOperation_Completed, null); this.parentWindow.AddPendingOperation(this.registrationData.CurrentOperation); } else if (operation.Value == CreateUserStatus.DuplicateUserName) { this.registrationData.ValidationErrors.Add(new ValidationResult(ErrorResources.CreateUserStatusDuplicateUserName, new string[] { "UserName" })); } else if (operation.Value == CreateUserStatus.DuplicateEmail) { this.registrationData.ValidationErrors.Add(new ValidationResult(ErrorResources.CreateUserStatusDuplicateEmail, new string[] { "Email" })); } else { ErrorWindow.CreateNew(ErrorResources.ErrorWindowGenericError); } } }
public Publish(object app) { d_SetDownloadState = new SetDownloadState(this.SetDownloadStateMethod); d_CloseWindows = new CloseWindows(this.CloseWindowsMethod); d_ErrorWindow = new ErrorWindow(this.LaunchErrorWindow); this.app = (Word._Application)app; if (IsPengYouDocument() == true && GetPublishPath() == true) { PublishDoc(); } else { error_reason = "This document is not a valid PengYou Document"; LaunchErrorWindow(); } InitializeComponent(); }
private void BtnAdd(object sender, System.EventArgs e) { Model.ConfirmationNumber = textBoxConfirmationNumber.Text; Model.DateOwed = DateTime.Parse(textBoxDateDue.Text); Model.MonthlyPayment = decimal.Parse(textBoxPayment.Text); Model.Paid = checkBoxPaid.Checked; try { Presenter.EditBill(Model); } catch (Exception ex) { ErrorWindow window = new ErrorWindow(ex.Message); ShowWindow(window); } Close(); }
void _nzbDrive_EventLog(NZBDriveDLL.LogLevelType lvl, string msg) { this.Dispatcher.BeginInvoke((Action)(() => { try { NZBDriveView.Model.Log.Add(new LogEntry() { Time = DateTime.Now, LogLevel = lvl, Message = msg }); if (lvl == NZBDriveDLL.LogLevelType.PopupError) { var dialog = new ErrorWindow(msg); dialog.Owner = Window.GetWindow(this); dialog.ShowDialog(); // MessageBox.Show(this, msg, "NZBDrive Error", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } else if (lvl == NZBDriveDLL.LogLevelType.PopupInfo) { var dialog = new InfoWindow(msg); dialog.Owner = Window.GetWindow(this); dialog.ShowDialog(); // MessageBox.Show(this, msg, "NZBDrive Info", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); if (msg.StartsWith("Trial license timeout")) { Application.Current.Shutdown(); } } } catch (ObjectDisposedException) { // Can happen when application is shutting down. } catch (InvalidOperationException) { // Can happen when application is shutting down. } catch (Exception e) { MessageBox.Show("_nzbDrive_OnEventLog Failed: " + e.Message); } })); }
private void Button_Click_Remove(object sender, RoutedEventArgs e) { int id = int.Parse(IDTextBox.Text); string name = NameTextBox.Text; Tournaments tour = TournamentViewModel.Tournaments.FindByID(id); if (tour != null && tour.Name == name) { TournamentViewModel.Tournaments.Remove(id); } else { ErrorWindow errorWindow = new ErrorWindow(); errorWindow.Width += 100; errorWindow.ErrorContent.Text = "Wrong ID or Name"; errorWindow.Show(); } NavigationService.Navigate(ViewTournaments); }
private void treeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { try { WS_Link.BaseItem bt = treeView.SelectedItem as WS_Link.BaseItem; WS_Link.WServiceClient wc = new WS_Link.WServiceClient(); wc.WS_GetDevicesCompleted += new EventHandler <WS_Link.WS_GetDevicesCompletedEventArgs>(wc_WS_GetDevicesCompleted); //if (bt.lastchild == 1) //{ wc.WS_GetDevicesAsync(bt.ID); //} } catch (Exception err) { HeaderText.Text = "Исключение в WS_GetDevices: "; ErrorWindow.CreateNew(err); } }
private void Button_Click_AddReferee(object sender, RoutedEventArgs e) { string name = NameTextBox.Text; string surname = SurnameTextBox.Text; bool IsNameValid; bool IsSurameValid; if (name != string.Empty) { IsNameValid = true; } else { ErrorWindow errorNameWindow = new ErrorWindow(); errorNameWindow.ErrorContent.Text = "Please enter the Name"; errorNameWindow.Show(); return; } if (surname != string.Empty) { IsSurameValid = true; } else { ErrorWindow errorSurnameWindow = new ErrorWindow(); errorSurnameWindow.ErrorContent.Text = "Please enter the Surname"; errorSurnameWindow.Show(); return; } if (IsNameValid && IsSurameValid) { RefereesViewModel.Referees.Add(new Referee() { Name = name, Surname = surname, ID = -1 }); ViewReferees.Refresh(); NavigationService.Navigate(ViewReferees); ErrorWindow errorWindow = new ErrorWindow(); errorWindow.ErrorContent.Text = "Succesfully added Referee"; errorWindow.Show(); } }
public void AddCustomerControl_badIDValue() { DBConnection_Accessor db = new DBConnection_Accessor(); Delete_Accessor d = new Delete_Accessor(db.GetDB()); SearchFunction_Accessor sf = new SearchFunction_Accessor(db.GetDB()); AddCustomerControl_Accessor aec = new AddCustomerControl_Accessor(db.GetDB()); String[] D = new String[] { "abc", "", "", "", "", "abc", "Customer" }; ErrorWindow ew = aec.createCustomer(D); DataTable dt = null; try { dt = sf.SearchPersonID("abc"); } catch (Exception e) { }; Assert.IsTrue(dt.Rows.Count == 0); Assert.IsNotNull(ew); }
private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { var errorWindow = new ErrorWindow(e.Exception); try { errorWindow.Owner = Current.MainWindow; } catch { errorWindow.Owner = null; } errorWindow.ShowDialog(); e.Handled = true; if (errorWindow.Owner == null) { Current.Shutdown(0); } }
public void OnAlreadyJoined(object sender, EventArgs e) { this.Dispatcher.Invoke(() => { ErrorWindow popup = new ErrorWindow("This user is already connected to the privatechatqueue!"); popup.ShowDialog(); curUser.HasOngoingChatSearch = false; this.lookingForAny.IsEnabled = true; this.lookingForFemale.IsEnabled = true; this.lookingForMale.IsEnabled = true; this.lookingForOther.IsEnabled = true; }); this.joinPrivateMatchServer.Content = "GIVE ME A MATCH!"; privatechat.LeaveQueue(); ///at this time, its still in the matchmanager curUser.HasOngoingChatSearch = false; curUser.HasOngoingChat = false; }
private void OnDownloadClicked(object sender, RoutedEventArgs e) { try { System.Diagnostics.Process.Start(downloadLink); } catch (System.ComponentModel.Win32Exception noBrowser) { if (noBrowser.ErrorCode == -2147467259) { ErrorWindow wnd = new ErrorWindow(noBrowser.Message); wnd.Owner = MainWindowKeeper.MainWindowInstance as Window; wnd.ShowDialog(); } else { throw; } } }
void Awake() { print("puzzle inventory awake"); GameObject temp = GameObject.FindGameObjectWithTag("HintBox"); if (ErrorWindow <PuzzlePieceActivator> .CanBeAssigned(temp, this, "HintBox")) { hintbox = temp.GetComponent <HintBoxController> (); } GameObject soundDirObj = GameObject.FindGameObjectWithTag("SoundDirector"); if (soundDirObj != null) { soundDirector = soundDirObj.GetComponent <SoundDirector> (); } else { Debug.Log("Cannot find the SoundDirector!"); } }
private void contectButton_Click(object sender, RoutedEventArgs e) { if (_cameraInfo.state == CamContectingState.OFFLINE) { Ping ping = new Ping(); try { if (ping.Send(_cameraInfo.IP, 2000).Status == IPStatus.Success) { if (ConnectHandler != null) { ConnectHandler(_cameraInfo.IP); _cameraInfo.state = CamContectingState.ONLINE; ChangedState(_cameraInfo.state); } } else { LogHelper.WriteLog("Connect to device. device offline"); ErrorWindow mw = new ErrorWindow(Application.Current.FindResource("errorText").ToString(), Application.Current.FindResource("nodevice").ToString()); mw.ShowDialog(); } } catch (Exception ex) { LogHelper.WriteLog("Connect to device error", ex); ErrorWindow mw = new ErrorWindow(Application.Current.FindResource("errorText").ToString(), Application.Current.FindResource("nodevice").ToString()); mw.ShowDialog(); } } else { if (DisconnectHandler != null) { DisconnectHandler(_cameraInfo.IP); _cameraInfo.state = CamContectingState.OFFLINE; ChangedState(_cameraInfo.state); } } }
public void TriggerUsernameValidation() { textBlock.Text = String.Empty; progressBarCircular.Visibility = Visibility.Visible; IVtsWebService client = Infrastructure.Container.GetInstance <IVtsWebService>(); try { string username = UsernameInput; if (String.IsNullOrEmpty(username)) { progressBarCircular.Visibility = Visibility.Collapsed; textBlock.Text = String.Empty; IsUsernameValidated = false; return; } bool occupied = client.CheckUsernameAvailability(username); if (!occupied) { progressBarCircular.Visibility = Visibility.Collapsed; textBlock.Text = "Available"; textBlock.Foreground = new SolidColorBrush(Colors.Green); IsUsernameValidated = true; } else { progressBarCircular.Visibility = Visibility.Collapsed; textBlock.Text = "Occupied"; textBlock.Foreground = new SolidColorBrush(Colors.Red); IsUsernameValidated = false; } } catch (Exception e) { progressBarCircular.Visibility = Visibility.Collapsed; Log.Error(e, e.Message); ErrorWindow wnd = new ErrorWindow(e, e.Message); wnd.Owner = MainWindowKeeper.MainWindowInstance as Window; wnd.ShowDialog(); } }
private void CreateClient() { try { IsWaitingMode = true; var service = Infrastructure.Container.GetInstance <IVtsWebService>(); service.ProvideAccessToVehicleForClientUsingEmail( SelectedVehicle.Model.Id, Email, LoggedUserContext.LoggedUser.Login, LoggedUserContext.LoggedUser.PasswordHash); window.Close(); } catch (Exception e) { string msg = "Can not create client."; Logging.Log.Error(e, msg); ErrorWindow w = new ErrorWindow(e, msg); w.ShowDialog(); } }
/// <summary> /// Handles <see cref="LoginOperation.Completed"/> event. If operation /// succeeds, it closes the window. If it has an error, we show an <see cref="ErrorWindow"/> /// and mark the error as handled. If it was not canceled, succeded but login failed, /// it must have been because credentials were incorrect so we add a validation error /// to notify the user /// </summary> private void LoginOperation_Completed(LoginOperation loginOperation) { if (loginOperation.LoginSuccess) { this.parentWindow.Close(); } else { if (loginOperation.HasError) { ErrorWindow.CreateNew(loginOperation.Error); loginOperation.MarkErrorAsHandled(); } else if (!loginOperation.IsCanceled) { this.loginForm.ValidationSummary.Errors.Add(new ValidationSummaryItem(ErrorResources.ErrorBadUserNameOrPassword)); } this.loginForm.BeginEdit(); } }
private void searchWindow_SubmitSearchAction(object sender, EventArgs e) { if (((RouteCardSearchResultChild)sender).DialogResult == true) { try { FormMode = FormMode.Read; SwitchFormMode(FormMode); } catch (Exception ex) { var err = new ErrorWindow(ex); err.Show(); } } else { BtnEdit.IsChecked = false; BtnAddNewCard.IsChecked = false; } }
public override void StartUp() { EditorObjects.IoC.Container.Get <List <IErrorReporter> >() .Add(new ErrorCreateRemoveLogic()); control = new ErrorWindow(); tab = AddToTab(PluginManager.BottomTab, control, "Errors"); errorListViewModel = GlueState.Self.ErrorList; errorListViewModel.Errors.CollectionChanged += HandleErrorsCollectionChanged; errorListViewModel.RefreshClicked += HandleRefreshClicked; control.DataContext = errorListViewModel; this.ReactToLoadedGlux += HandleLoadedGlux; this.ReactToFileChangeHandler += HandleFileChanged; this.ReactToFileRemoved += HandleFileRemoved; this.ReactToUnloadedGlux += HandleUnloadedGlux; this.ReactToFileReadError += HandleFileReadError; }
// Handle the UI exceptions by showing a dialog box, and asking the user whether // or not they wish to abort execution. // NOTE: This exception cannot be kept from terminating the application - it can only // log the event, and inform the user about it. private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { var ex = (Exception)e.ExceptionObject; // Todo: make this translatable ErrorWindow.ShowErrorDialog("An unhandled exception has occurred.\nPKHeX must now close.", ex, false); } catch { try { // Todo: make this translatable MessageBox.Show("A fatal non-UI error has occurred in PKHeX, and the details could not be displayed. Please report this to the author.", "PKHeX Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { Application.Exit(); } } }
internal Save(string folder, Guid id) { Id = id; _file = folder + "/" + Id; if (!File.Exists(_file + ".id")) { Invalid = true; return; } try { SaveMetadata = new SaveMetadata(_file); SaveData = new SaveData(_file); Invalid = false; } catch (Exception e) { ErrorWindow.ShowException(e); Invalid = true; } }
// Выполняется, когда пользователь переходит на эту страницу. protected override void OnNavigatedTo(NavigationEventArgs e) { if (WebContext.Current.User.IsInRole("Clinic")) { RejectButton.Visibility = ConfirmButton.Visibility = Visibility.Collapsed; respondTransplantantDomainDataSource.QueryName = "RespondOwnTransplantant"; Parameter p = new Parameter(); p.Value = WebContext.Current.User.ClinicId; p.ParameterName = "ClinicId"; respondTransplantantDomainDataSource.QueryParameters.Add(p); } else if (WebContext.Current.User.IsInRole("Worker")) { AddButton.Visibility = CancelButton.Visibility = Visibility.Collapsed; } else { ErrorWindow errorWnd = new ErrorWindow("Ошибка доступа.", "У вас нет доступа к данной странице. Возможно вы не авторизировались."); errorWnd.Show(); NavigationService.Navigate(new Uri("/Home", UriKind.Relative)); } }
void proxy_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { if (e.Error != null) { ChildWindow errorWindow = new ErrorWindow(e.Error); errorWindow.Show(); busyIndicator.IsBusy = false; } else { using (XmlReader feedReader = XmlReader.Create(e.Result)) { gotLatest = false; SyndicationFeed syndFeed = SyndicationFeed.Load(feedReader); foreach (SyndicationItem syndicationItem in syndFeed.Items) { searchResults.Add( new TwitterSearchResult { Author = syndicationItem.Authors[0].Name, ID = GetTweetId(syndicationItem.Id), PublishDate = syndicationItem.PublishDate.LocalDateTime, Tweet = syndicationItem.Title.Text, Avatar = new BitmapImage(syndicationItem.Links[1].Uri) }); gotLatest = true; } } timer.Start(); } busyIndicator.IsBusy = false; }
/// <include file='doc\ErrorProvider.uex' path='docs/doc[@for="ErrorProvider.ControlItem.RemoveFromWindow"]/*' /> /// <devdoc> /// Remove this control's error icon from the error window. /// </devdoc> void RemoveFromWindow() { if (window != null) { window.Remove(this); window = null; } }
private void VerifyAllDefs() { UpdateStatus("Loading Game Definitions..."); try { if (Program.GamesRepository == null) Program.GamesRepository = new GamesRepository(); var g2R = new List<Data.Game>(); using (MD5 md5 = new MD5CryptoServiceProvider()) { foreach (Data.Game g in Program.GamesRepository.Games) { string fhash = ""; UpdateStatus("Checking Game: " + g.Name); if (!File.Exists(g.Filename)) { _errors.Add("[" + g.Name + "]: Def file doesn't exist at " + g.Filename); continue; } using (var file = new FileStream(g.Filename, FileMode.Open)) { byte[] retVal = md5.ComputeHash(file); fhash = BitConverter.ToString(retVal).Replace("-", ""); // hex string } if (fhash.ToLower() == g.FileHash.ToLower()) continue; Program.Game = new Game(GameDef.FromO8G(g.Filename)); Program.Game.TestBegin(); //IEnumerable<Player> plz = Player.All; var engine = new Engine(true); string[] terr = engine.TestScripts(Program.Game); Program.Game.End(); if (terr.Length <= 0) { Program.GamesRepository.UpdateGameHash(g,fhash); continue; } _errors.AddRange(terr); g2R.Add(g); } } foreach (Data.Game g in g2R) Program.GamesRepository.Games.Remove(g); if (_errors.Count > 0) { Dispatcher.BeginInvoke(new Action(() => { String ewe = _errors.Aggregate("", (current, s) => current + (s + Environment.NewLine)); var er = new ErrorWindow(ewe); er.ShowDialog(); })); } UpdateStatus("Checking for updates..."); } catch (Exception e) { Debug.WriteLine(e); if (Debugger.IsAttached) Debugger.Break(); } CheckForUpdates(); }
/// <include file='doc\ErrorProvider.uex' path='docs/doc[@for="ErrorProvider.Clear"]/*' /> /// <devdoc> /// Clears all errors being tracked by this error provider, ie. undoes all previous calls to SetError. /// </devdoc> public void Clear() { ErrorWindow[] w = new ErrorWindow[windows.Values.Count]; windows.Values.CopyTo(w, 0); for (int i = 0; i < w.Length; i++) { w[i].Dispose(); } windows.Clear(); foreach (ControlItem item in items.Values) { if (item != null) { item.Dispose(); } } items.Clear(); }
public static ErrorWindow Show(string text1) { Console.WriteLine("At error window"); if (ErrorWindowBox == null) { ErrorWindowBox = new ErrorWindow(text1); } ErrorWindowBox.error_window.Show (); return ErrorWindowBox; }
private void OKButton_Click(object sender, RoutedEventArgs e) { if ((donor.Series == null) || (donor.Number == 0)) { ErrorWindow errorWnd = new ErrorWindow("Ошибка", "Не введены паспортные данные!"); errorWnd.Show(); return; } if (Currentblood.HasValidationErrors) return; if (donor.FirstName != null && PurposeComboBox.SelectedItem != null) { if (donor.BloodDonor == null) donor.BloodDonor = 1; else donor.BloodDonor++; Currentblood.Purpose = (PurposeComboBox.SelectedItem as Label).Content.ToString(); Currentblood.IdDonor = donor.Id; context.SubmitChanges(); this.DialogResult = true; } else this.DialogResult = false; }
/// <include file='doc\ErrorProvider.uex' path='docs/doc[@for="ErrorProvider.EnsureErrorWindow"]/*' /> /// <devdoc> /// Helper to make sure we have allocated an error window for this control. /// </devdoc> /// <internalonly/> internal ErrorWindow EnsureErrorWindow(Control parent) { ErrorWindow window = (ErrorWindow)windows[parent]; if (window == null) { window = new ErrorWindow(this, parent); windows[parent] = window; } return window; }
public static ErrorWindow Show(string text1) { LogB.Information("At error window"); if (ErrorWindowBox == null) { ErrorWindowBox = new ErrorWindow(text1); } //hidden always excepted when called to be shown (see below) ErrorWindowBox.hbox_send_log.Hide(); ErrorWindowBox.button_open_database_folder.Hide(); ErrorWindowBox.error_window.Show(); return ErrorWindowBox; }
protected void on_button_accept_clicked(object o, EventArgs args) { ErrorWindowBox.error_window.Hide(); ErrorWindowBox = null; }
private void OKButton_Click(object sender, RoutedEventArgs e) { if ((donor.Series == null) || (donor.Number == 0)) { ErrorWindow errorWnd = new ErrorWindow("Ошибка", "Не введены паспортные данные!"); errorWnd.Show(); return; } foreach (Transplantant transplantant in list) { if (transplantant.HasValidationErrors) return; } this.DialogResult = true; }
//if user doesn't touch the platform after pressing "finish", sometimes it gets waiting a Read_event //now the event finishes ok, and next will be ok // //not for multiChronopic: private void checkFinishTotally(object o, EventArgs args) { if(currentEventExecute.TotallyFinished) Log.WriteLine("totallyFinished"); else { Log.Write("NOT-totallyFinished "); errorWin = ErrorWindow.Show(Catalog.GetString("Please, touch the contact platform for full finishing.\nThen press this button:\n")); errorWin.Button_accept.Clicked += new EventHandler(checkFinishTotally); } }
//runA is not called for this, because it ends different //and there's a message on gui/eventExecute.cs for runA private void checkFinishMultiTotally(object o, EventArgs args) { bool needFinish1 = false; bool needFinish2 = false; bool needFinish3 = false; bool needFinish4 = false; Console.WriteLine("cfmt 0"); needFinish1 = !currentEventExecute.TotallyFinishedMulti1; if(currentEventExecute.Chronopics > 1) { Console.WriteLine("cfmt 1"); needFinish2 = !currentEventExecute.TotallyFinishedMulti2; if(currentEventExecute.Chronopics > 2) { Console.WriteLine("cfmt 2"); needFinish3 = !currentEventExecute.TotallyFinishedMulti3; if(currentEventExecute.Chronopics > 3) { Console.WriteLine("cfmt 3"); needFinish4 = !currentEventExecute.TotallyFinishedMulti4; } } } Console.WriteLine("cfmt 4"); if(needFinish1 || needFinish2 || needFinish3 || needFinish4) { // Log.Write("NOT-totallyFinishled "); string cancelStr = ""; string sep = ""; if(needFinish1) { cancelStr += sep + "1"; sep = ", "; } if(needFinish2) { cancelStr += sep + "2"; sep = ", "; } if(needFinish3) { cancelStr += sep + "3"; sep = ", "; } if(needFinish4) { cancelStr += sep + "4"; sep = ", "; } Console.WriteLine("cfmt 5"); //try here because maybe solves problems in runAnalysis when seem to update the eventExecuteWindow at the same time as tries to show this errorWindow errorWin = ErrorWindow.Show(string.Format( Catalog.GetString("Please, touch the contact platform on Chronopic/s [{0}] for full finishing.") + "\n" + Catalog.GetString("Then press this button:\n"), cancelStr)); Console.WriteLine("cfmt 6"); errorWin.Button_accept.Clicked += new EventHandler(checkFinishMultiTotally); Console.WriteLine("cfmt 7"); //} } else { Log.WriteLine("totallyFinished"); /* //call write here, because if done in execute/MultiChronopic, will be called n times if n chronopics are working currentEventExecute.MultiChronopicWrite(false); currentMultiChronopic = (MultiChronopic) currentEventExecute.EventDone; Console.WriteLine("W"); //if this multichronopic has more chronopics than other in session, then reload treeview, else simply add if(currentMultiChronopic.CPs() != SqliteMultiChronopic.MaxCPs(currentSession.UniqueID)) { treeview_multi_chronopic_storeReset(); fillTreeView_multi_chronopic(); } else myTreeViewMultiChronopic.Add(currentPerson.Name, currentMultiChronopic); Console.WriteLine("X"); //since 0.7.4.1 when test is done, treeview select it. action event button have to be shown showHideActionEventButtons(true, Constants.MultiChronopicName); //show //unhide buttons for delete last test sensitiveGuiYesEvent(); */ } }
private void checkCancelMultiTotally(object o, EventArgs args) { bool needCancel1 = false; bool needCancel2 = false; bool needCancel3 = false; bool needCancel4 = false; needCancel1 = !currentEventExecute.TotallyCancelledMulti1; if(currentEventExecute.Chronopics > 1) { needCancel2 = !currentEventExecute.TotallyCancelledMulti2; if(currentEventExecute.Chronopics > 2) { needCancel3 = !currentEventExecute.TotallyCancelledMulti3; if(currentEventExecute.Chronopics > 3) needCancel4 = !currentEventExecute.TotallyCancelledMulti4; } } if(needCancel1 || needCancel2 || needCancel3 || needCancel4) { // Log.Write("NOT-totallyCancelled "); string cancelStr = ""; string sep = ""; if(needCancel1) { cancelStr += sep + "1"; sep = ", "; } if(needCancel2) { cancelStr += sep + "2"; sep = ", "; } if(needCancel3) { cancelStr += sep + "3"; sep = ", "; } if(needCancel4) { cancelStr += sep + "4"; sep = ", "; } errorWin = ErrorWindow.Show(string.Format(Catalog.GetString("Please, touch the contact platform on Chronopic/s [{0}] for full cancelling.\nThen press button\n"), cancelStr)); errorWin.Button_accept.Clicked += new EventHandler(checkCancelMultiTotally); } }
/* * update button is clicked on eventWindow, chronojump.cs delegate points here */ private void on_update_clicked(object o, EventArgs args) { Log.WriteLine("--On_update_clicked--"); try { switch (currentEventType.Type) { case EventType.Types.JUMP: if(lastJumpIsSimple) PrepareJumpSimpleGraph(currentJump.Tv, currentJump.Tc); else PrepareJumpReactiveGraph( Util.GetLast(currentJumpRj.TvString), Util.GetLast(currentJumpRj.TcString), currentJumpRj.TvString, currentJumpRj.TcString, volumeOn, repetitiveConditionsWin); break; case EventType.Types.RUN: if(lastRunIsSimple) PrepareRunSimpleGraph(currentRun.Time, currentRun.Speed); else { RunType runType = SqliteRunIntervalType.SelectAndReturnRunIntervalType(currentRunInterval.Type, false); double distanceTotal = Util.GetRunITotalDistance(currentRunInterval.DistanceInterval, runType.DistancesString, currentRunInterval.Tracks); double distanceInterval = currentRunInterval.DistanceInterval; if(distanceInterval == -1) //variable distances distanceInterval = Util.GetRunIVariableDistancesStringRow( runType.DistancesString, (int) currentRunInterval.Tracks -1); PrepareRunIntervalGraph(distanceInterval, Util.GetLast(currentRunInterval.IntervalTimesString), currentRunInterval.IntervalTimesString, distanceTotal, runType.DistancesString, volumeOn, repetitiveConditionsWin); } break; case EventType.Types.PULSE: PreparePulseGraph(Util.GetLast(currentPulse.TimesString), currentPulse.TimesString); break; case EventType.Types.REACTIONTIME: PrepareReactionTimeGraph(currentReactionTime.Time); break; case EventType.Types.MULTICHRONOPIC: PrepareMultiChronopicGraph( //currentMultiChronopic.timestamp, Util.IntToBool(currentMultiChronopic.Cp1StartedIn), Util.IntToBool(currentMultiChronopic.Cp2StartedIn), Util.IntToBool(currentMultiChronopic.Cp3StartedIn), Util.IntToBool(currentMultiChronopic.Cp4StartedIn), currentMultiChronopic.Cp1InStr, currentMultiChronopic.Cp1OutStr, currentMultiChronopic.Cp2InStr, currentMultiChronopic.Cp2OutStr, currentMultiChronopic.Cp3InStr, currentMultiChronopic.Cp3OutStr, currentMultiChronopic.Cp4InStr, currentMultiChronopic.Cp4OutStr); break; } } catch { errorWin = ErrorWindow.Show(Catalog.GetString("Cannot update. Probably this test was deleted.")); } }
public void HideAndNull() { if(ErrorWindowBox != null) { ErrorWindowBox.error_window.Hide(); ErrorWindowBox = null; } }
private void ShowErrorWindow(string title, string message) { ErrorWindow error = new ErrorWindow(title, message); error.Show(); }
public void Show() { try { #if RAWRSERVER System.Windows.MessageBox.Show(buildFullMessage(), Title, MessageBoxButton.OK); #else ErrorWindow ew = new ErrorWindow() { ErrorMessage = this.Message + (this.InnerMessage != "" ? "\n" + this.InnerMessage : ""), StackTrace = this.StackTrace, SuggestedFix = this.SuggestedFix, Info = this.Info, }; #if SILVERLIGHT ew.Show(); #else ew.ShowDialog(); #endif #endif System.Diagnostics.Debug.WriteLine(Title + "\n" + buildFullMessage()); }catch(Exception){ } }
// If an error occurs during navigation, show an error window private void ProductManagerContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) { e.Handled = true; ChildWindow errorWin = new ErrorWindow(e.Uri); errorWin.Show(); }