private void OnMainVocalSearch(object o) { try { if (SpeechRecognitionTool.RecognizeText.Count() != 0) { SpeechRecognitionTool.RecognizeText.Clear(); } SpeechRecognitionTool.RecognizeText.Add(""); SpeechRecognitionTool.start(); MainVocalSearch.RaiseCanExecuteChanged(); while (SpeechRecognitionTool.IsMicroUse) { } if (SpeechRecognitionTool.RecognizeText == null || ((SpeechRecognitionTool.RecognizeText.Count == 0 || SpeechRecognitionTool.Error) && SpeechRecognitionTool.RecognizeText[0] == "")) { throw (new Exception("Erreur de reconnaissance vocale:\n")); } SearchWord = FindGoodString(SpeechRecognitionTool.RecognizeText); SpeechRecognitionTool.MicClient.EndMicAndRecognition(); } catch (Exception E) { SpeechRecognitionTool.MicClient.EndMicAndRecognition(); ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
private void OnEditCommand(object o) { try { EditView modifier = new EditView(); EditViewModel modele = new EditViewModel(modifier); modifier.DataContext = modele; modifier.ShowDialog(); if (!modele.NormalEnd) { return; } if (modele.Nom == " ") { throw (new ArgumentException("Vous n'avez pas rentrez de nom. Erreur: \n")); } if (!modele.TestI) { if (Speaker == null) { throw (new ArgumentException("Vous n'avez pas sélectioner d'intervenants. Erreur:\n")); } if (Speaker.Nom == modele.Nom && Speaker.TitreDIntervention == modele.Intervention) { throw (new ArgumentException("Vous n'avez pas modifier l'intervenant. Erreur:\n")); } if (modele.Intervention == " ") { throw (new ArgumentException("Vous n'avez pas rentrez d'intervention. Erreur: \n")); } ListeSpeaker[ListeSpeaker.ToList().FindIndex(Intervenant => (Intervenant.Nom == Speaker.Nom && Intervenant.TitreDIntervention == Speaker.TitreDIntervention))].Nom = modele.Nom; ListeSpeaker[ListeSpeaker.ToList().FindIndex(Intervenant => (Intervenant.Nom == Speaker.Nom && Intervenant.TitreDIntervention == Speaker.TitreDIntervention))].TitreDIntervention = modele.Intervention; Speaker = ListeSpeaker[ListeSpeaker.ToList().FindIndex(Intervenant => (Intervenant.Nom == modele.Nom && Intervenant.TitreDIntervention == modele.Intervention))]; UpdateListeSpeaker(); } else { if (Spectator == null) { throw (new ArgumentException("Vous n'avez pas sélectionner de spectateurs. Erreur:\n")); } if (Spectator.Nom == modele.Nom) { throw (new ArgumentException("Vous n'avez pas modifier le spectateur. Erreur:\n")); } ListeSpectator[ListeSpectator.ToList().FindIndex(Internaute => (Internaute.Nom == Spectator.Nom))].Nom = modele.Nom; Spectator = ListeSpectator[ListeSpectator.ToList().FindIndex(Internaute => (Internaute.Nom == modele.Nom))]; UpdateListeSpectator(); } NotifyPropertyChanged("ListeSpectator"); NotifyPropertyChanged("ListeSpeaker"); } catch (Exception E) { ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
private void OnDeleteCommand(object o) { try { DeleteView supprimer = new DeleteView(); DeleteViewModel modele = new DeleteViewModel(supprimer); supprimer.DataContext = modele; supprimer.ShowDialog(); if (!modele.NormalEnd) { return; } // if (modele.Nom == " ") { throw (new ArgumentException("Vous n'avez pas rentrez de nom. Erreur: \n")); } if (!modele.TestI) { Event.Intervenants.RemoveAt(Event.Intervenants.ToList().FindIndex(Intervenant => (Intervenant.Nom == Speaker.Nom))); UpdateListeSpeaker(); } else { Event.Inscrits.RemoveAt(Event.Inscrits.ToList().FindIndex(Internaute => (Internaute.Nom == Spectator.Nom))); UpdateListeSpectator(); } NotifyPropertyChanged("ListeSpectator"); NotifyPropertyChanged("ListeSpeaker"); } catch (Exception E) { ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
/// <summary> /// Shows an exception window. /// </summary> /// <param name="exception"><see cref="Exception"/> object to show an exception window for.</param> /// <param name="parent">Parent <see cref="Window"/> object</param> public static void ShowExceptionWindow(Exception exception, object parent) { var exceptionWindow = new ExceptionView { DataContext = new ExceptionViewModel(exception), Owner = parent as Window }; exceptionWindow.ShowDialog(); }
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { var exceptionView = new ExceptionView(e.Exception) { WindowStartupLocation = WindowStartupLocation.CenterScreen, }; exceptionView.ShowDialog(); e.Handled = true; }
protected override void OnStartup(StartupEventArgs e) { ///MessageBox.Show("Startup"); base.OnStartup(e); var container = new DependencyInjectionContainer(); container.ExportInitialize <OptionsServicesWpf>((c, a, o) => o.SetRegistryPath("HLab.Erp")); container.Configure(c => c.Export <EventHandlerServiceWpf>().As <IEventHandlerService>()); //boot.Container.ExportInitialize<BootLoaderErpWpf>((c, a, o) => o.SetMainViewMode(typeof(ViewModeKiosk))); NotifyHelper.EventHandlerService = container.Locate <IEventHandlerService>(); // new EventHandlerServiceWpf(); boot. var boot = container.Locate <Bootstrapper>(); var a0 = boot.LoadDll("HLab.Erp.Core.Wpf"); var a2 = boot.LoadDll("HLab.Erp.Base.Wpf"); var b0 = boot.LoadDll("HLab.Mvvm"); var c0 = boot.LoadDll("HLab.Mvvm.Wpf"); var d0 = boot.LoadDll("HLab.Erp.Data"); var e0 = boot.LoadDll("HLab.Erp.Acl.Wpf"); var a1 = boot.LoadDll("HLab.Erp.Workflows.Wpf"); var f0 = boot.LoadDll("HLab.Erp.Core"); var g0 = boot.LoadDll("HLab.Erp.Lims.Analysis.Module"); #if !DEBUG try { #endif boot.Configure(); var doc = container.Locate <IDocumentService>(); doc.MainViewModel = container.Locate <MainWpfViewModel>(); boot.Boot(); #if !DEBUG } catch (Exception ex) { var view = new ExceptionView { Exception = ex }; view.ShowDialog(); } #endif }
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { var exceptionView = new ExceptionView(e.Exception) { Owner = Application.Current != null ? Application.Current.MainWindow : null, WindowStartupLocation = Application.Current != null ? WindowStartupLocation.CenterOwner : WindowStartupLocation.CenterScreen, }; exceptionView.ShowDialog(); e.Handled = true; }
private void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs e) { try { var wdw = new ExceptionView { ExceptionToDisplay = e.ExceptionObject as Exception }; wdw.ShowDialog(); } catch { MessageBox.Show(e.ExceptionObject?.ToString()); } }
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { try { var wdw = new ExceptionView { ExceptionToDisplay = e.Exception, }; wdw.ShowDialog(); } catch { MessageBox.Show(e.Exception.ToString()); } e.Handled = true; }
private void OnWaitingLine(object o) { try { WaitingLineViewModel m = new WaitingLineViewModel(); WaitingLineView v = new WaitingLineView(); m.MainList = ListToObservableCollectionFactory.Convert(Event.ListeAttente.ToList()); v.ShowDialog(); } catch (Exception E) { ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
private void OnAddCommand(object o) { try { AddView ajouter = new AddView(); AddViewModel modele = new AddViewModel(ajouter); ajouter.DataContext = modele; ajouter.ShowDialog(); if (!modele.NormalEnd) { return; } if (modele.Nom == " ") { throw (new ArgumentException("Vous n'avez pas rentrez de nom. Erreur: \n")); } if (!modele.TestI) { if (modele.Intervention == " ") { throw (new ArgumentException("Vous n'avez pas rentrez d'intervention. Erreur: \n")); } List <Intervenant> tmp = Event.Intervenants; tmp.Add(new Intervenant(modele.Nom, modele.Intervention)); Event.Intervenants = tmp; UpdateListeSpeaker(); } else { List <Internaute> tmp = Event.Inscrits; tmp.Add(new Internaute(modele.Nom)); Event.Inscrits = tmp; UpdateListeSpectator(); } NotifyPropertyChanged("ListeSpectator"); NotifyPropertyChanged("ListeSpeaker"); } catch (Exception E) { ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
private void OnEditEventCommand(object o) { try { AddEventViewModel m = new AddEventViewModel(); m.Name = Event.Nom; m.NbPlace = Event.NbPlaces; m.Place = Event.Lieu.Nom; m.Date = MaDate.DateToString(Event.Date); m.AddOrEdit = "Edit"; AddEventView v = new AddEventView(); v.DataContext = m; v.ShowDialog(); if (!m.NormalEnd) { return; } if (m.Name == "" || m.Name == null) { throw (new ArgumentException("Vous n'avez pas rentrer de nom. Erreur:\n")); } if (m.Place == "" || m.Place == null) { throw (new ArgumentException("Vous n'avez pas rentrer de lieu. Erreur:\n")); } if (m.Date == "" || m.Date == null) { throw (new ArgumentException("Vous n'avez pas rentrer de date. Erreur:\n")); } Evenement tmp = new Evenement(m.Name, new MaDate(m.Date), m.NbPlace, new Lieu(m.Place)); ListeEvent[ListeEvent.FindIndex(ev => ev.Nom == Event.Nom && ev.Date == Event.Date && ev.Lieu.Nom == Event.Lieu.Nom && ev.NbPlaces == Event.NbPlaces)].Nom = m.Name; ListeEvent[ListeEvent.FindIndex(ev => ev.Nom == Event.Nom && ev.Date == Event.Date && ev.Lieu.Nom == Event.Lieu.Nom && ev.NbPlaces == Event.NbPlaces)].Lieu = new Lieu(m.Place); ListeEvent[ListeEvent.FindIndex(ev => ev.Nom == Event.Nom && ev.Date == Event.Date && ev.Lieu.Nom == Event.Lieu.Nom && ev.NbPlaces == Event.NbPlaces)].NbPlaces = m.NbPlace; ListeEvent[ListeEvent.FindIndex(ev => ev.Nom == Event.Nom && ev.Date == Event.Date && ev.Lieu.Nom == Event.Lieu.Nom && ev.NbPlaces == Event.NbPlaces)].Date = new MaDate(m.Date); UpdateListeEvent(); NotifyPropertyChanged("ListeEventToShow"); } catch (Exception E) { ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
private void OnDeleteEventCommand(object o) { try { if (Event == null) { throw (new Exception("Il n y a pas d'évènements à supprimer. Erreur:\n")); } ListeEvent.Remove(Event); ListeEventToShow = ListToObservableCollectionFactory.Convert(ListeEvent); Event = ListeEventToShow[0]; NotifyPropertyChanged("ListeEventToShow"); NotifyPropertyChanged("Event"); } catch (Exception E) { ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
private void OnAddEventCommand(object o) { try { AddEventViewModel m = new AddEventViewModel(); AddEventView v = new AddEventView(); v.DataContext = m; v.ShowDialog(); if (!m.NormalEnd) { return; } if (m.Name == "" || m.Name == null) { throw (new ArgumentException("Vous n'avez pas rentrer de nom. Erreur:\n")); } if (m.Place == "" || m.Place == null) { throw (new ArgumentException("Vous n'avez pas rentrer de lieu. Erreur:\n")); } if (m.Date == "" || m.Date == null) { throw (new ArgumentException("Vous n'avez pas rentrer de date. Erreur:\n")); } Evenement tmp = new Evenement(m.Name, new MaDate(m.Date), m.NbPlace, new Lieu(m.Place)); ListeEvent.Add(tmp); UpdateListeEvent(); NotifyPropertyChanged("ListeEventToShow"); } catch (Exception E) { ExceptionViewModel v = new ExceptionViewModel(E); ExceptionView ExceptionWindow = new ExceptionView(); ExceptionWindow.DataContext = v; ExceptionWindow.ShowDialog(); } }
public static void HandleException(Exception exception, string message) { if (exception == null) { LogTo.Error(message); } else { LogTo.Error(exception, message); } try { if (errorDialogShown) { return; } errorDialogShown = true; dispatcher.Invoke(() => { var exceptionView = new ExceptionView(exception) { Owner = ShellView.CurrentInstance }; exceptionView.ShowDialog(); }); } catch (Exception showDialogException) { LogTo.Error(showDialogException, "Could not show error dialog. Shutting down."); Environment.Exit(1); } finally { errorDialogShown = false; } }
public static void HandleException(Exception exception, string message) { if (exception == null) { LogTo.Error(message); } else { LogTo.Error(exception, message); } try { if (errorDialogShown) { return; } errorDialogShown = true; dispatcher.Invoke(() => { var exceptionView = new ExceptionView(exception) { Owner = ShellView.CurrentInstance }; exceptionView.ShowDialog(); }); } catch (Exception showDialogException) { LogTo.Error(showDialogException, "Could not show error dialog. Shutting down."); Environment.Exit(1); } finally { errorDialogShown = false; } }