public MainWindow( IMainViewModel viewModel, IMainWindowHandleContainer handleContainer, IEnvironmentInformation environmentInformation, ILogger logger) { this.handleContainer = handleContainer; this.logger = logger; this.viewModel = viewModel; Left = int.MinValue; Top = int.MinValue; Width = 1; Height = 1; SourceInitialized += MainWindow_SourceInitialized; InitializeComponent(); SetupViewModel(); if (environmentInformation.GetIsDebugging()) { Background = Brushes.Transparent; } }
async Task Update() { if (!environmentInformation.GetIsDebugging() && environmentInformation.GetHasInternetAccess()) { await updateService.UpdateAsync(); } }
public void Emit(LogEvent logEvent) { if (environmentInformation.GetIsDebugging()) { return; } if (logEvent.Level == LogEventLevel.Error || logEvent.Level == LogEventLevel.Warning) { ScheduleLogEventReport(logEvent); } var level = GetPropertyValue(logEvent, "Level"); var message = StripSensitiveInformation($"{level} {logEvent.RenderMessage()}"); try { reportingSemaphore.Wait(); logHistory.AddLast(message); if (logHistory.Count > logHistoryLength) { logHistory.RemoveFirst(); } } finally { reportingSemaphore.Release(); } }
static void RegisterLogging(IEnvironmentInformation environment, ContainerBuilder builder) { if (!environment.GetIsInDesignTime()) { var logPath = !environment.GetIsDebugging() && environment.GetIsRunningDeveloperVersion() ? Path.GetTempFileName() : FileManager.GetFullPathFromTemporaryPath("Shapeshifter.log"); Log.Logger = new LoggerConfiguration() .MinimumLevel.Verbose() .Enrich.WithProperty("ProcessId", Process.GetCurrentProcess().Id) .Enrich.FromLogContext() .WriteTo.Debug( outputTemplate: "{Timestamp:HH:mm:ss.fff} [{Level:u3}] {Message:lj} ({SourceContext:l}){NewLine}{Exception}") .WriteTo.File( logPath, restrictedToMinimumLevel: LogEventLevel.Verbose, fileSizeLimitBytes: int.MaxValue, rollOnFileSizeLimit: false, rollingInterval: RollingInterval.Day, retainedFileCountLimit: 2, shared: true, outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [#{ProcessId}] [{SourceContext:l}] [{Level:u3}]{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}") .WriteTo.Sink(new IssueReporterSink(environment)) .CreateLogger(); } builder.RegisterLogger(autowireProperties: true); }
public bool CanProcess() { var isDebugging = environmentInformation.GetIsDebugging(); if (isDebugging) { return(false); } return(!GetIsCurrentlyRunningFromInstallationFolder()); }
async void UserInterfaceViewModel_UserInterfaceDataControlAdded(object sender, UserInterfaceDataControlAddedEventArgument e) { ActiveScreen = screenManager.GetActiveScreen(); Source = e.Package.Data.Source; Count = mainViewModel .UserInterfaceViewModel .Elements.Count(x => x.Data.Source.Text == Source.Text); ClipboardQuantityShown?.Invoke(this, new DataSourceClipboardQuantityShownEventArgument()); await threadDelay.ExecuteAsync(environmentInformation.GetIsDebugging()? 3000 : 1500); ClipboardQuantityHidden?.Invoke(this, new DataSourceClipboardQuantityHiddenEventArgument()); }
static void RegisterLogStream(IEnvironmentInformation environment, ContainerBuilder builder) { if (!environment.GetIsDebugging()) { builder .RegisterType <FileLogStream>() .AsImplementedInterfaces() .SingleInstance(); } else { builder .RegisterType <DebugLogStream>() .AsImplementedInterfaces() .SingleInstance(); } }
public MainWindow( IMainViewModel viewModel, IMainWindowHandleContainer handleContainer, IEnvironmentInformation environmentInformation) { this.handleContainer = handleContainer; this.viewModel = viewModel; SourceInitialized += MainWindow_SourceInitialized; InitializeComponent(); SetupViewModel(); if (environmentInformation.GetIsDebugging()) { Background = Brushes.Transparent; } }
static void RegisterLogging(IEnvironmentInformation environment, ContainerBuilder builder) { builder .RegisterType <Logger>() .PropertiesAutowired(new PropertySelector(), true) .AsImplementedInterfaces() .SingleInstance(); if (!environment.GetIsDebugging()) { builder .RegisterType <FileLogStream>() .PropertiesAutowired(new PropertySelector(), true) .AsImplementedInterfaces() .SingleInstance(); } else { builder .RegisterType <DebugLogStream>() .AsImplementedInterfaces() .SingleInstance(); } }
public bool CanProcess() { return(!environmentInformation.GetIsDebugging() && (processManager.GetCurrentProcessDirectory() != TargetDirectory)); }
public bool CanProcess() { return(!GetIsCurrentlyRunningFromInstallationFolder() && !environmentInformation.GetIsDebugging()); }
public bool CanProcess() { return(!environmentInformation.GetIsDebugging() && (Environment.CurrentDirectory != TargetDirectory)); }