static IEnumerator DoMsgShow() { if (!inst.isShowing) { inst.Show(); } while (true) { if (inst.queue.Count != 0) { msg = inst.queue.Dequeue(); } else { break; } if (inst.preMsg == msg) { continue; } inst.preMsg = msg; inst.SetError(msg); yield return(null); } is_render = false; yield return(null); }
// inserting into item table public static void AddNewItem(string category, string vendor, string name, string description, string unitPrice, string quantity) { ErrorWindow errM = new ErrorWindow(); SuccessWindow sm = new SuccessWindow(); if (IsCategoryExist(category) || IsVendorExist(vendor)) { try { using ( SqlConnection connection = new SqlConnection( ConfigurationManager.ConnectionStrings["RentalConnection"].ConnectionString)) { if (connection.State == ConnectionState.Closed) { connection.Open(); string query = "INSERT INTO dbo.Item(Category_Id,Vendor_Id,Name,Description,Unit_Price,Quantity)VALUES(" + "(select Id from Category where Category_Name='" + category + "')," + "(select Id from Vendor where Company_Name = '" + vendor + "'), '" + name + "'," + "'" + description + "','" + unitPrice + "','" + quantity + "')"; var command = new SqlCommand(query, connection) { CommandType = CommandType.Text }; if (command.ExecuteNonQuery() > 0) { //command.ExecuteNonQuery(); sm.Message = "New Item is saved Successfully."; sm.Show(); } connection.Close(); } } } catch (Exception exception) { errM.Message = exception.Message; errM.Show(); } } else { errM.Message = "OOPS!!! Category Name or Vendor Name cannot be found."; errM.Show(); } }
// inserting into purchase order table table public static void Ordering(string customer, string itemName, string user, string quantity, string discount, string totalCost) { ErrorWindow errM = new ErrorWindow(); SuccessWindow sm = new SuccessWindow(); if (!IsItemExist(itemName)) { errM.Message = "OOPS!!! Item Name cannot be found, try again."; errM.Show(); } //if (!IsQuantityZero(itemName)) //{ // errM.Message = "OOPS!!! Some Item may have zero quantity, check available quantity and try again."; // errM.Show(); //} try { using ( SqlConnection connection = new SqlConnection( ConfigurationManager.ConnectionStrings["RentalConnection"].ConnectionString)) { if (connection.State == ConnectionState.Closed) { connection.Open(); string query = "INSERT INTO [dbo].[Order](Customer_Id,Item_Id,User_Id,Quantity,Discount,Total_Cost)VALUES((select Id from Customer where Full_Name = '" + customer + "'),(select Id from Item where Name = '" + itemName + "'), '" + user + "','" + quantity + "','" + discount + "','" + totalCost + "')"; var command = new SqlCommand(query, connection) { CommandType = CommandType.Text }; if (command.ExecuteNonQuery() > 0) { //command.ExecuteNonQuery(); } connection.Close(); } } } catch (Exception exception) { errM.Message = exception.Message; errM.Show(); } }
// inserting into item table public static void AddBrokenItem(string name, string quantity, string comment) { ErrorWindow errM = new ErrorWindow(); SuccessWindow sm = new SuccessWindow(); if (IsItemExist(name)) { try { using ( SqlConnection connection = new SqlConnection( ConfigurationManager.ConnectionStrings["RentalConnection"].ConnectionString)) { if (connection.State == ConnectionState.Closed) { connection.Open(); string query = "INSERT INTO dbo.Damage_Item(Item_Id,Quantity,Comment)VALUES(" + "(select Id from Item where Name='" + name + "'), '" + quantity + "'," + "'" + comment + "')"; var command = new SqlCommand(query, connection) { CommandType = CommandType.Text }; if (command.ExecuteNonQuery() > 0) { //command.ExecuteNonQuery(); sm.Message = "Damage item is recorded Successfully."; sm.Show(); } connection.Close(); } } } catch (Exception exception) { errM.Message = exception.Message; errM.Show(); } } else { errM.Message = "OOPS!!! Item Name cannot be found."; errM.Show(); } }
private void OnError(Exception e, string msg) { ErrorWindow w = new ErrorWindow(e, msg); w.Show(); controlVehicleSelection.SetWaitingMode(false); }
public void SaveRouteCard(string saveMode) { if (saveMode.ToLower() == "add") { try { } catch (Exception ex) { var err = new ErrorWindow(ex); err.Show(); } } else { try { } catch (Exception ex) { var err = new ErrorWindow(ex); err.Show(); } } }
private void Error(string text) { ErrorWindow errorNameWindow = new ErrorWindow(); errorNameWindow.ErrorContent.Text = text; errorNameWindow.Show(); }
private void MessagesRetrievedCallback(object o, GetDesktopMessagesCompletedEventArgs e) { messages.Clear(); if (e.Error != null) { ErrorWindow w = new ErrorWindow(e.Error, e.Error.Message); w.Show(); } else { IList <string> result = e.Result; if (result.Count == 0) { DisplayEmptyView(); } else { int number = 0; foreach (string s in result) { messages.Add(s); SystemMessageItemControl itemControl = new SystemMessageItemControl(); itemControl.Tag = number; itemControl.Click += ItemClicked; itemControl.SetCaption((number + 1).ToString(CultureInfo.InvariantCulture)); stackPanelMessageItems.Children.Add(itemControl); } textBlockMessageText.Text = CodeBehindStringResolver.Resolve(messages[0]); } } }
/// <summary> /// ナビゲーション中にエラーが発生した場合は、エラー ウィンドウを表示します /// </summary> private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) { e.Handled = true; ChildWindow errorWin = new ErrorWindow(e.Uri); errorWin.Show(); }
private void ErrorCallback(Exception e, string msg) { ErrorWindow w = new ErrorWindow(e, msg); w.Closed += DialogWindowStatus.OnDialogClosed; w.Show(); }
public static void Error(string message) { Deployment.Current.Dispatcher.BeginInvoke(() => { var errWindow = new ErrorWindow(message); errWindow.Show(); }); }
private void ErrorCallback(Exception e, string msg) { ErrorWindow w = new ErrorWindow(e, msg); w.Show(); SetNormalState(); }
private void OnError(Exception e, string msg) { ErrorWindow w = new ErrorWindow(e, msg); w.Show(); Enable(); }
private void Button_Click_Add(object sender, RoutedEventArgs e) { int id = int.Parse(IDText.Text); string name = NameText.Text; string surname = SurnameText.Text; Player player = PlayersViewModel.Players.FindByID(id); if (player != null && player.Name == name && player.Surname == surname) { if (Team.PlayersList.FindByID(id) == null) { Team.PlayersList.Add(player); TeamWindow.Refresh(); // TeamViewModel.SaveTeamViewModel(); this.Close(); } else { ErrorWindow errorWindow = new ErrorWindow { Width = 500 }; errorWindow.ErrorContent.Text = "This player is already in this team"; errorWindow.Show(); } } else { ErrorWindow errorWindow = new ErrorWindow() { Width = 500 }; errorWindow.Show(); } }
private void NewDetails() { try { SelectedMainRow.LatestColor = SelectedMainRow.LatestColor + 1; //SelectedMainRow.LatestColor ; var temp = new AccessoryAttributesDetailsViewModel { Code = SelectedMainRow.FullCode, Descreption = SelectedMainRow.Descreption, Configuration = SelectedMainRow.LatestColor.ToString(), Size = SelectedMainRow.AccSizeProperty != null ? SelectedMainRow.AccSizeProperty.TblAccSize1.SizeCode : null, ObjStatus = { IsNew = true } }; AccDetailsList.Add(temp); SelectedDetail = temp; } catch { var err = new ErrorWindow("Error Adding Details" , "Please make sure that there is enough data in the header section!"); err.Show(); } }
protected override void OnStartup(StartupEventArgs e) { try { CheckAlreadyRunning(); UnityConfiguration.Register(UnityContainer); foreach (IModule module in UnityContainer.Registrations. Where(x => typeof(IModule).IsAssignableFrom(x.RegisteredType)). Select(x => UnityContainer.Resolve(x.RegisteredType))) { module.Initialize(); } UnityContainer.Resolve <MainWindow>().Show(); } catch (Exception ex) { ErrorWindow.Show(ex); Application.Current.Shutdown(); } finally { handleExceptions = true; } }
private void FillSubGroupSizes() { try { var client = new _Proxy.CRUD_ManagerServiceClient(); client.GetSuptGroupSizesCompleted += (s, e) => { if (e.Result != null) { AccSizesList.Clear(); foreach (var item in e.Result) { AccSizesList.Add(item); RaisePropertyChanged("AccSizesList"); } IsSizeIncludedInHeader = true; } else { IsSizeIncludedInHeader = false; } }; if (AccSubGroup != null) { client.GetSuptGroupSizesAsync((int)AccSubGroup); } } catch (Exception ex) { var err = new ErrorWindow(ex); err.Show(); } }
public Home() { try { InitializeComponent(); PlayArma.TabStop = false; PlayArma.FlatStyle = FlatStyle.Flat; PlayArma.FlatAppearance.BorderSize = 0; PlayArma.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); PlayMinecraft.TabStop = false; PlayMinecraft.FlatStyle = FlatStyle.Flat; PlayMinecraft.FlatAppearance.BorderSize = 0; PlayMinecraft.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); this.PlayMinecraft.FlatAppearance.MouseOverBackColor = this.PlayMinecraft.BackColor; this.PlayMinecraft.BackColorChanged += (s, e) => { this.PlayMinecraft.FlatAppearance.MouseOverBackColor = this.PlayMinecraft.BackColor; }; this.PlayArma.FlatAppearance.MouseOverBackColor = this.PlayArma.BackColor; this.PlayArma.BackColorChanged += (s, e) => { this.PlayArma.FlatAppearance.MouseOverBackColor = this.PlayArma.BackColor; }; } catch (Exception errormessage) { ErrorWindow ew = new ErrorWindow(errormessage); ew.Show(); } }
protected void readMessageToStart() { if (messageToShowOnBoot.Length > 0) { ErrorWindow errorWin; if (chronojumpHasToExit) { messageToShowOnBoot += "\n<b>" + string.Format(Catalog.GetString("Chronojump will exit now.")) + "</b>\n"; errorWin = ErrorWindow.Show(messageToShowOnBoot); errorWin.Show_button_open_database_folder(); errorWin.Button_accept.Clicked += new EventHandler(on_message_boot_accepted_quit); } else { errorWin = ErrorWindow.Show(messageToShowOnBoot); errorWin.Show_send_log(); errorWin.ProgVersion = progVersion; errorWin.Button_accept_label(Catalog.GetString("Open Chronojump")); errorWin.Button_accept.Clicked += new EventHandler(on_message_boot_accepted_continue); } } else { startChronojump(); } }
public void Registration(string Login, string Password) { bool UserExists = false; bool UserExist = TryUser(Login); if (!UserExist) { string RegistrationString = "INSERT INTO `wpfapp1`.`auth` (`Login`, `Password`) VALUES ('" + Login + "', '" + Password + "');"; MySqlConnection connection = new MySqlConnection(); //создаем соединение connection.ConnectionString = ConectionDataBaseAuth(); connection.Open(); //соединяемся try { MySqlCommand command = new MySqlCommand(); //класс для передачи команд в базу command.Connection = connection; // указываем через какое соединение command.CommandText = RegistrationString; command.ExecuteNonQuery(); //выполнить команду } catch (Exception e) { connection.Close(); string error = e.Message; } connection.Close(); } else { ErrorWindow Error = new ErrorWindow(); Error.Show(); } }
private bool CreateSerialPort() { try { serialPort = new SerialPort(comPort, baudRate, parity, dataBits, stopBits); serialPort.ReadTimeout = readTimeout; serialPort.ReceivedBytesThreshold = readBufferSize; serialPort.DataReceived += HandleDataReceived; serialPort.Open(); isConfigured = true; } catch (Exception e) { if (errorWindowOpen == false) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { errorDisplay = new ErrorWindow(); errorDisplay.Topmost = true; errorDisplay.errorMsg.Content = "Error connecting to serial port."; errorDisplay.Show(); })); errorWindowOpen = true; } isConfigured = false; return(false); } return(true); }
private void OnError(Exception e, string msg) { ErrorWindow errorWindow = new ErrorWindow(e, msg); errorWindow.Closed += DialogWindowStatus.OnDialogClosed; errorWindow.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)); } }
//updating the item price from references link // inserting into item table public static void UpdatePrice(string name, decimal price) { ErrorWindow errM = new ErrorWindow(); SuccessWindow sm = new SuccessWindow(); if (IsItemExist(name)) { try { using ( SqlConnection connection = new SqlConnection( ConfigurationManager.ConnectionStrings["RentalConnection"].ConnectionString)) { if (connection.State == ConnectionState.Closed) { connection.Open(); string query = "UPDATE dbo.Item SET Unit_Price='" + price + "' WHERE Name=(select Id from Item where Name='" + name + "')"; var command = new SqlCommand(query, connection) { CommandType = CommandType.Text }; if (command.ExecuteNonQuery() > 0) { //command.ExecuteNonQuery(); sm.Message = "Item price updated Successfully."; sm.Show(); } connection.Close(); } } } catch (Exception exception) { errM.Message = exception.Message; errM.Show(); } } else { errM.Message = "OOPS!!! Item Name cannot be found."; errM.Show(); } }
// update item stock..by returning rented item back to stock public static void ReturnItem(string name, string quantity, string id) { ErrorWindow errM = new ErrorWindow(); SuccessWindow sm = new SuccessWindow(); if (IsItemExist(name)) { try { using ( SqlConnection connection = new SqlConnection( ConfigurationManager.ConnectionStrings["RentalConnection"].ConnectionString)) { if (connection.State == ConnectionState.Closed) { connection.Open(); string query = "UPDATE dbo.Item SET Quantity +='" + quantity + "' where Id='" + id + "'"; var command = new SqlCommand(query, connection) { CommandType = CommandType.Text }; if (command.ExecuteNonQuery() > 0) { //command.ExecuteNonQuery(); sm.Message = "Item return is successfully added to stock."; sm.Show(); } connection.Close(); } } } catch (Exception exception) { errM.Message = exception.Message; errM.Show(); } } else { errM.Message = "OOPS!!! Item Name cannot be found."; errM.Show(); } }
private void OnError(Exception e, string msg) { progressBarCircular.Visibility = Visibility.Collapsed; ErrorWindow wnd = new ErrorWindow(e, msg); wnd.Closed += DialogWindowStatus.OnDialogClosed; wnd.Show(); }
private void ApplicationDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { LoggerContext.Instance.Screenshot(); LoggerContext.Instance.AddError(e.Exception); var window = new ErrorWindow(e.Exception); window.Show(); e.Handled = true; }
static void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (!Debugger.IsAttached) { e.Handled = true; var errorWin = new ErrorWindow(e.ExceptionObject); errorWin.Show(); } }
// Standard Silverlight rubbish for debugging private static void ApplicationUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (!System.Diagnostics.Debugger.IsAttached) { e.Handled = true; ChildWindow errorWin = new ErrorWindow(e.ExceptionObject); errorWin.Show(); } }
public override void OnFrameworkInitializationCompleted() { if (Desktop != null) { Desktop.Exit += onExit; } string dataDirectory; string logsDirectory; dataDirectory = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "UgCS", "telemetry-viewer"); ServiceProvider = initServices(dataDirectory); ServiceProvider.GetRequiredService <IDiscoveryService>().StartListen(); _viewFactory = ServiceProvider.GetService <IVisualComponentsFactory>(); try { if (!Directory.Exists(dataDirectory)) { Directory.CreateDirectory(dataDirectory); } logsDirectory = Path.Combine(dataDirectory, "logs"); if (!Directory.Exists(logsDirectory)) { Directory.CreateDirectory(logsDirectory); } initLog(logsDirectory); } catch (Exception err) { // Log still is not initialized, app can display error message only. ErrorWindow errWindow = _viewFactory.CreateWindow <ErrorWindow>(true); errWindow.DataContext = err; errWindow.Show(); TelemetryViewerApp.Current.SetMainWindow(errWindow); return; } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; _log.Info($"Telemetry viewer {Version} started."); if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { desktop.MainWindow = _viewFactory.CreateWindow <InitializingSplashWindow>(); ((IInitializingSplashWindowViewModel)desktop.MainWindow.DataContext).StartInitializing(); } base.OnFrameworkInitializationCompleted(); }
private void Error(string text) { ErrorWindow errorSurnameWindow = new ErrorWindow() { Width = 400 }; errorSurnameWindow.ErrorContent.Text = text; errorSurnameWindow.Show(); }
public void Error(string text) { ErrorWindow errorWindow = new ErrorWindow() { Width = 500 }; errorWindow.ErrorContent.Text = text; errorWindow.Show(); }
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(); } }
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(); }; }
// Выполняется, когда пользователь переходит на эту страницу. 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; }
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; }
private void ShowErrorWindow(string title, string message) { ErrorWindow error = new ErrorWindow(title, message); error.Show(); }
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 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(); }
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){ } }