/// <summary> /// execution of bootstrapper /// </summary> /// <param name="runWithDefaultConfiguration"></param> public override void Run(bool runWithDefaultConfiguration) { AccessBehavior.Provider = new AccessLevelProvider(); if (Debugger.IsAttached) { BindingListener.SetTrace(); } Application.Current.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler( this.OnAppDispatcherUnhandledException); Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; // Authenticate the current user and set the default principal LoginView auth = new LoginView(); auth.WindowStartupLocation = WindowStartupLocation.CenterScreen; bool?dialogResult = auth.ShowDialog(); // deal with the results if (dialogResult.HasValue && dialogResult.Value) { //AppDomain.CurrentDomain.SetThreadPrincipal(auth.NewPrincipal); base.Run(runWithDefaultConfiguration); Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; } else { Application.Current.Shutdown(-1); } }
public static void CloseTrace() { if (_Listener == null) { return; } _Listener.Flush(); _Listener.Close(); PresentationTraceSources.DataBindingSource.Listeners.Remove(_Listener); _Listener = null; }
public static void SetTrace(SourceLevels level, TraceOptions options) { if (_Listener == null) { _Listener = new BindingListener(); PresentationTraceSources.DataBindingSource.Listeners.Add(_Listener); } _Listener.TraceOutputOptions = options; PresentationTraceSources.DataBindingSource.Switch.Level = level; }