protected override void OnStartup(StartupEventArgs e) { //localization. string culture = ConfigurationManager.AppSettings["Culture"]; if (!string.IsNullOrEmpty(culture)) { CultureInfo ci = new CultureInfo(culture); // Force application to work with $ regardless of culture // Demonstrates customization of culture for app (optional) // ci.NumberFormat.CurrencySymbol = "$"; Thread.CurrentThread.CurrentCulture = ci; Thread.CurrentThread.CurrentUICulture = ci; } else { Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-ES"); } // debugging binding PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); // PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error | SourceLevels.Critical; base.OnStartup(e); bootstrapper = new Boot.Bootstrapper(); bootstrapper.Run(); }
public static void Initialize() { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ThowDataBindingError40TraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error; }
static void Main(string[] args) { try { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new DefaultTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; ThemeManager.ApplicationThemeName = Theme.VS2010Name; // bool bdownload = DataUtils.ActivityUtils.DownLoadActivity(Loadprocess); DXSplashScreen.Show <SplashScreen_AMTS>(); //DXSplashScreen.Progress(10); DXSplashScreen.SetState("Start Loding..."); DataUtils.StaticInfo.ExecutePath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); DataUtils.StaticInfo.LoginUser = "******"; DataUtils.StaticInfo.LocalModel = ConfigurationManager.AppSettings["LocalModel"] == null ? "" : ConfigurationManager.AppSettings["LocalModel"].ToUpper(); DataUtils.StaticInfo.AutoConnect = ConfigurationManager.AppSettings["AutoConnect"] == null ? "" : ConfigurationManager.AppSettings["AutoConnect"].ToUpper(); DataUtils.StaticInfo.ProcessName = ConfigurationManager.AppSettings["ProcessName"] == null ? "" : ConfigurationManager.AppSettings["ProcessName"].ToUpper(); DataUtils.StaticInfo.AutoLoadStateBySN = ConfigurationManager.AppSettings["AutoLoadStateBySN"] == null ? "" : ConfigurationManager.AppSettings["AutoLoadStateBySN"].ToUpper(); DataUtils.StaticInfo.AutoLoadStateFile = ConfigurationManager.AppSettings["AutoLoadStateFile"] == null ? "" : ConfigurationManager.AppSettings["AutoLoadStateFile"].ToUpper(); DataUtils.StaticInfo.ATEKind = ConfigurationManager.AppSettings["ATEKind"] == null ? "" : ConfigurationManager.AppSettings["ATEKind"].ToUpper(); DataUtils.StaticInfo.ATEStatusFile = ConfigurationManager.AppSettings["ATEStatusFile"] == null ? "" : ConfigurationManager.AppSettings["ATEStatusFile"].ToUpper(); DataUtils.StaticInfo.MesMode = ConfigurationManager.AppSettings["MesMode"] == null ? "" : ConfigurationManager.AppSettings["MesMode"].ToUpper(); DataUtils.StaticInfo.ResultString = ConfigurationManager.AppSettings["ResultListerner"] == null ? "" : ConfigurationManager.AppSettings["ResultListerner"].ToUpper().Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Trim(); AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ApplicationUtils.CurrentDomain_AssemblyResolve); DXSplashScreen.SetState("Loading The ApplicationTheme"); DXSplashScreen.SetState("Check File Revisions..."); DXSplashScreen.Progress(Loadprocess = 5); DXSplashScreen.SetState("Loading Application Instance"); //string url = System.Reflection.Assembly.GetExecutingAssembly().Location + ";component/App.xaml"; //string uri = ""; //string param = ""; //if (GetAssemblyInstanse(url, ref uri, ref param) == null) { throw new Exception("GetAssemblyInstanse is NULL!"); }; //(System.Windows.Application)System.Windows.Application.LoadComponent(new System.Uri(uri, System.UriKind.Relative)); System.Windows.Application app = new System.Windows.Application(); app.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(app_DispatcherUnhandledException); DXSplashScreen.SetState("Loading Main FrameWork"); DXSplashScreen.Progress(Loadprocess = 70); System.Windows.Window MainWindow = new MainWindow(); DXSplashScreen.SetState("Run MainWindow"); DXSplashScreen.Progress(Loadprocess = 90); app.Run(MainWindow); } catch (Exception ex) { LOG.WriteLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source); if (DXSplashScreen.IsActive) { DXSplashScreen.Close(); } ApplicationUtils.SaveException(ex); System.Windows.MessageBox.Show(ex.Message); if (DXSplashScreen.IsActive) { DXSplashScreen.Close(); } } }
private static void EnableDebugListeners() { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; }
public static void Register() { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new WpfBindingTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Switch.Level = BindingErrorTraceListener.GetSourceLevels(); PresentationTraceSources.DataBindingSource.Listeners.Add(new BindingErrorTraceListener()); }
private void AddListeners() { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error | SourceLevels.Critical; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); #if !DEBUG // 例外処理 AppDomain.CurrentDomain.UnhandledException += (o, e) => { File.WriteAllText($"KEVi_Crash_Domain_{DateTime.Now:yyyy_MM_dd_HH_mm_ss}.txt", e.ExceptionObject.ToString()); MessageBox.Show("エラーが発生しました。\n続けて発生する場合は作者までご連絡ください。", "クラッシュしました…", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(-1); }; // 例外処理 DispatcherUnhandledException += (o, e) => { File.WriteAllText($"KEVi_Crash_Dispatcher_{DateTime.Now:yyyy_MM_dd_HH_mm_ss}.txt", e.Exception.ToString()); MessageBox.Show("エラーが発生しました。\n続けて発生する場合は作者までご連絡ください。", "クラッシュしました!", MessageBoxButton.OK, MessageBoxImage.Error); Environment.Exit(-1); }; #else PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; #endif }
private void InitLog() { if (FailFast) { LogManager.GetLog = t => new FailFastLog(t); return; } //нужно вызвать иначе wpf игнорирует все настройки протоколирование //ошибки которые возникают при биндинге wpf проглатывает это могут быть как безобидные ошибки //например не удалось преобразовать строку в число так и критические //конфигурация должна быть в конфигурационном файле иначе все игнорируется PresentationTraceSources.Refresh(); LogManager.GetLog = t => new Log4net(t); TaskScheduler.UnobservedTaskException += (sender, args) => { if (!FailFast) { args.SetObserved(); } log.Error("Ошибка при выполнении задачи", args.Exception.GetBaseException()); }; AppDomain.CurrentDomain.UnhandledException += (sender, args) => { log.Error("Ошибка в приложении", args.ExceptionObject as Exception); CheckShutdown(args.ExceptionObject as Exception); }; }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); Instance = this; ValidateAppSingleInstanceState(); IKeyHookService keyHookService = Resolve <IKeyHookService>(); IStorageService storageService = Resolve <IStorageService>(); disposableResources = new List <IDisposable>(); this.Dispatcher.UnhandledException += Dispatcher_UnhandledException; RegisterDisposableResources(); PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); //PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; DumpAppConfig(); LoadSettings(); InitialNavigation(); }
public void BindingForPropertyPropertyNamedInAttachedProperyIsValidatedForValidValue() { var instance = new ValidatedObject(); var textBox = new TextBox(); textBox.BeginInit(); textBox.DataContext = instance; var binding = new Binding("ValidatedStringProperty") { Mode = BindingMode.OneWayToSource, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, ValidatesOnExceptions = true }; PresentationTraceSources.SetTraceLevel(binding, PresentationTraceLevel.High); BindingOperations.SetBinding(textBox, TextBox.TextProperty, binding); textBox.EndInit(); Validate.SetBindingForProperty(textBox, "Text"); Assert.IsFalse(SWC.Validation.GetHasError(textBox)); textBox.Text = "aaaaaaaa"; Assert.IsFalse(SWC.Validation.GetHasError(textBox)); }
protected void SetDebugTrace() { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; }
private void SetupLog() { Trace.Listeners.Add(new WpfTraceListener("Trace", _serviceProvider.GetInstance <ILogger>())); PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new WpfTraceListener("WPF", _serviceProvider.GetInstance <ILogger>())); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error | SourceLevels.Warning; }
static TriggerTracing() { // Initialise WPF Animation tracing and add a TriggerTraceListener PresentationTraceSources.Refresh(); PresentationTraceSources.AnimationSource.Listeners.Clear(); PresentationTraceSources.AnimationSource.Listeners.Add(new TriggerTraceListener()); PresentationTraceSources.AnimationSource.Switch.Level = SourceLevels.All; }
private BindingListener() { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(this); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error; TraceOutputOptions = TraceOptions.Callstack | TraceOptions.LogicalOperationStack; }
public DataBindingExceptionRethrower() { threadId = Thread.CurrentThread.ManagedThreadId; AppDomain.CurrentDomain.FirstChanceException += FirstChanceExceptionThrown; PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(this); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning; }
protected override void OnStartup(StartupEventArgs e) { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.All; base.OnStartup(e); }
public static void EnableExceptionOnBindingError() { PresentationTraceSources.Refresh(); var dataBindingSource = PresentationTraceSources.DataBindingSource; dataBindingSource.Listeners.Add(new BindingErrorListener()); dataBindingSource.Switch.Level = SourceLevels.Error; }
protected override void OnStartup(StartupEventArgs e) { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(@"c:\temp\vigenere-markup-debug.txt")); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; base.OnStartup(e); }
private void Application_Startup(object sender, StartupEventArgs e) { PresentationTraceSources.Refresh(); //PresentationTraceSources.DataBindingSource.Listeners.Add( // new TextWriterTraceListener( "DebugProgrammatically.txt" ) //); //PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.All; }
public BindingListener(TraceOptions options) { IsFirstWrite = true; PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(this); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error; TraceOutputOptions = options; DetermineInformationPropertyCount(); }
// Start this window after boot protected override void OnStartup(object sender, StartupEventArgs e) { DisplayRootViewFor <ShellViewModel>(); PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; }
private void SetupLogging() { Log.Logger = new LoggerConfiguration() .WriteTo.Trace(LogEventLevel.Information) .WriteTo.File( new CompactJsonFormatter(), Path.Combine(PathProvider.Logs.FullName, "Log.txt"), buffered: true, fileSizeLimitBytes: 10 * 1024 * 1024, flushToDiskInterval: 10.Seconds(), rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: true) .Enrich.FromLogContext() .Enrich.WithThreadId() .Enrich.WithDemystifiedStackTraces() .Enrich.WithMemoryUsage() .MinimumLevel.Verbose() .CreateLogger(); Log.Information("Log initialized"); if (!Debugger.IsAttached) { AppDomain.CurrentDomain.UnhandledException += (sender, args) => { FatalException(args.ExceptionObject as Exception, sender.GetType()); }; Current.DispatcherUnhandledException += (sender, args) => { FatalException(args.Exception, sender.GetType()); }; } RxApp.DefaultExceptionHandler = Observer.Create <Exception>(ex => { if (Debugger.IsAttached) { Debugger.Break(); } RxApp.MainThreadScheduler.Schedule(() => throw ex); }); PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new RelayTraceListener(m => { Log.ForContext(typeof(PresentationTraceSources)).Warning(m); if (Debugger.IsAttached) { Debugger.Break(); } })); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; if (!Debugger.IsAttached) { DispatcherMonitor.Start(); } }
protected override void OnStartup(StartupEventArgs e) { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); //PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new TextWriterTraceListener(Path.GetTempFileName())); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Information; base.OnStartup(e); }
/// <summary> /// The on start up. /// </summary> /// <param name="e"> /// The e. /// </param> protected override void OnStartup(StartupEventArgs e) { #if DATABINDING_TRACE PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; #endif base.OnStartup(e); }
public SnoopUI() { this.TreeService = TreeService.From(this.CurrentTreeType); this.filterCall = new DelayedCall(this.ProcessFilter, DispatcherPriority.Background); this.InitializeComponent(); // wrap the following PresentationTraceSources.Refresh() call in a try/catch // sometimes a NullReferenceException occurs // due to empty <filter> elements in the app.config file of the app you are snooping // see the following for more info: // http://snoopwpf.codeplex.com/discussions/236503 // http://snoopwpf.codeplex.com/workitem/6647 try { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error; } catch (NullReferenceException) { // swallow this exception since you can snoop just fine anyways. } this.CommandBindings.Add(new CommandBinding(IntrospectCommand, this.HandleIntrospection)); this.CommandBindings.Add(new CommandBinding(RefreshCommand, this.HandleRefresh)); this.CommandBindings.Add(new CommandBinding(HelpCommand, this.HandleHelp)); this.CommandBindings.Add(new CommandBinding(InspectCommand, this.HandleInspect)); this.CommandBindings.Add(new CommandBinding(SelectFocusCommand, this.HandleSelectFocus)); this.CommandBindings.Add(new CommandBinding(SelectFocusScopeCommand, this.HandleSelectFocusScope)); //NOTE: this is up here in the outer UI layer so ESC will clear any typed filter regardless of where the focus is // (i.e. focus on a selected item in the tree, not in the property list where the search box is hosted) this.CommandBindings.Add(new CommandBinding(ClearSearchFilterCommand, this.ClearSearchFilterHandler)); this.CommandBindings.Add(new CommandBinding(CopyPropertyChangesCommand, this.CopyPropertyChangesHandler)); InputManager.Current.PreProcessInput += this.HandlePreProcessInput; this.Tree.SelectedItemChanged += this.HandleTreeSelectedItemChanged; // we can't catch the mouse wheel at the ZoomerControl level, // so we catch it here, and relay it to the ZoomerControl. this.MouseWheel += this.SnoopUI_MouseWheel; this.filterTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(0.3) }; this.filterTimer.Tick += (s, e) => { this.EnqueueAfterSettingFilter(); this.filterTimer.Stop(); }; }
protected override void OnStartup(StartupEventArgs e) { PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; base.OnStartup(e); DXSplashScreen.Show <SplashScreenView>(); ApplicationThemeHelper.UpdateApplicationThemeName(); }
protected override void OnStartup(StartupEventArgs e) { MemberHistoryDescriptionProvider.Register(new DateTime(2017, 08, 08), new DateTime(2017, 08, 15), new DateTime(2017, 08, 22)); PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; base.OnStartup(e); }
protected override void OnStartup(StartupEventArgs e) { // Useful for debugging binding issues: // See https://spin.atomicobject.com/2013/12/11/wpf-data-binding-debug/ PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new ConsoleTraceListener()); PresentationTraceSources.DataBindingSource.Listeners.Add(new DebugTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error; base.OnStartup(e); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error; PresentationTraceSources.DataBindingSource.Listeners.Add(new BindingErrorTraceListener()); DispatcherUnhandledException += App_DispatcherUnhandledException; }