protected override async void OnStartup(StartupEventArgs e) { #if DEBUG LogManager.AddDebugListener(); #endif Log.Info("Starting application"); apphelper = new WKitGlobal.AppHelper(); discordhelper = new DiscordHelper(); GithubHelper = new GithubHelper(); themehelper = new ThemeHelper(); await apphelper.InitializeMVVM(); themehelper.InitializeThemeHelper(); await apphelper.InitializeShell(); discordhelper.InitDiscordRPC(); Log.Info("Calling base.OnStartup"); base.OnStartup(e); NNViewRegistrar.RegisterSplat(); }
protected override void OnStartup(StartupEventArgs e) { #if DEBUG LogManager.AddDebugListener(true); #endif var languageService = ServiceLocator.Default.ResolveType <ILanguageService>(); // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture), // we use .CurrentCulture for the sake of the demo languageService.PreferredCulture = CultureInfo.CurrentCulture; languageService.FallbackCulture = new CultureInfo("en-US"); FontMaterial.Initialize(false); FontAwesome.Initialize(); var serviceLocator = ServiceLocator.Default; var shellService = serviceLocator.ResolveType <IShellService>(); shellService.CreateAsync <ShellWindow>(); _stopwatch.Stop(); Log.Info("Elapsed startup stopwatch time: {0}", _stopwatch.Elapsed); }
#pragma warning disable AvoidAsyncVoid protected override async void OnStartup(StartupEventArgs e) #pragma warning restore AvoidAsyncVoid { #if DEBUG LogManager.AddDebugListener(); #endif var languageService = ServiceLocator.Default.ResolveType <ILanguageService>(); // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture), // we use .CurrentCulture for the sake of the demo languageService.PreferredCulture = CultureInfo.CurrentCulture; languageService.FallbackCulture = new CultureInfo("en-US"); //Log.Info("Starting application"); this.ApplyTheme(); //Log.Info("Calling base.OnStartup"); var serviceLocator = ServiceLocator.Default; var shellService = serviceLocator.ResolveType <IShellService>(); await shellService.CreateAsync <ShellWindow>(); var filterSchemeManager = serviceLocator.ResolveType <IFilterSchemeManager>(); await filterSchemeManager.LoadAsync(); base.OnStartup(e); }
private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new ConsoleLogListener(); LogManager.AddListener(consoleLogListener); var exitCode = 0; try { Log.Info("Example console app"); } catch (Exception ex) { Log.Error(ex, "An unknown exception occurred"); exitCode = -1; } #if DEBUG if (Debugger.IsAttached) { WaitForKeyPress(); } #endif return(exitCode); }
protected override void OnStartup(StartupEventArgs e) { #if DEBUG LogManager.AddDebugListener(); #endif Log.Info("Starting application"); // To force the loading of all assemblies at startup, uncomment the lines below: //Log.Info("Preloading assemblies"); //AppDomain.CurrentDomain.PreloadAssemblies(); // Want to improve performance? Uncomment the lines below. Note though that this will disable // some features. // // For more information, see https://catelproject.atlassian.net/wiki/display/CTL/Performance+considerations // Log.Info("Improving performance"); // Catel.Data.ModelBase.DefaultSuspendValidationValue = true; // Catel.Windows.Controls.UserControl.DefaultCreateWarningAndErrorValidatorForViewModelValue = false; // Catel.Windows.Controls.UserControl.DefaultSkipSearchingForInfoBarMessageControlValue = true; // TODO: Register custom types in the ServiceLocator //Log.Info("Registering custom types"); //var serviceLocator = ServiceLocator.Default; //serviceLocator.RegisterType<IMyInterface, IMyClass>(); Log.Info("Calling base.OnStartup"); base.OnStartup(e); }
/// <summary> /// Raises the <see cref="E:System.Windows.Application.Startup" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs" /> that contains the event data.</param> protected override void OnStartup(StartupEventArgs e) { var dependencyResolver = this.GetDependencyResolver(); // // Logging #if DEBUG LogManager.AddDebugListener(true); #endif // // Localization var languageService = dependencyResolver.Resolve <ILanguageService>(); languageService.FallbackCulture = new CultureInfo("en-US"); languageService.RegisterLanguageSource( new LanguageResourceSource( "Sidekick.Windows", "Sidekick.Windows.Properties", "Resources")); languageService.RegisterLanguageSource( new LanguageResourceSource("Sidekick.MVVM", "Sidekick.MVVM.Properties", "Resources")); // // Shell creation var serviceLocator = ServiceLocator.Default; var shellService = serviceLocator.ResolveType <IShellService>(); shellService.CreateWithSplashAsync <MnemoShellWindow>(); }
protected override void OnStartup(StartupEventArgs e) { #if DEBUG LogManager.AddDebugListener(true); #endif var languageService = ServiceLocator.Default.ResolveType <ILanguageService>(); // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture), // we use .CurrentCulture for the sake of the demo languageService.PreferredCulture = CultureInfo.CurrentCulture; languageService.FallbackCulture = new CultureInfo("en-US"); Orc.Theming.FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orchestra.Examples.Ribbon.Fluent;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome")); Orc.Theming.FontImage.DefaultFontFamily = "FontAwesome"; var serviceLocator = ServiceLocator.Default; var shellService = serviceLocator.ResolveType <IShellService>(); shellService.CreateAsync <ShellWindow>(); _stopwatch.Stop(); Log.Info("Elapsed startup stopwatch time: {0}", _stopwatch.Elapsed); }
public void DefaultsToZero() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); Assert.AreEqual(0, log.IndentLevel); }
public void DefaultsToTwo() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); Assert.AreEqual(2, log.IndentSize); }
public void ErrorAndThrowException_NullInput() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); log.ErrorAndThrowException <InvalidOperationException>(null); }
public void CorrectlyLogsMessageWithBraces() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); log.Error("This is a string with { and sometimes and ending }"); }
public void Error_MessageFormat_Null() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); log.Error((string)null, null); }
public void ErrorAndCreateException_ExceptionWithoutMessageConstructor() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); ExceptionTester.CallMethodAndExpectException <ExceptionWithoutStringConstructor>(() => { throw log.ErrorAndCreateException <ExceptionWithoutStringConstructor>("exception test"); }); }
public void WorksWithData() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); LogMessageEventArgs eventArgs = null; log.LogMessage += (sender, e) => eventArgs = e; var threadId = ThreadHelper.GetCurrentThreadId(); log.InfoWithData("log message", new LogData { { "ThreadId", threadId } }); Assert.IsNotNull(eventArgs); Assert.AreEqual(log, eventArgs.Log); Assert.AreEqual(LogEvent.Info, eventArgs.LogEvent); Assert.AreEqual("log message", eventArgs.Message); var logData = eventArgs.LogData; Assert.IsNotNull(logData); Assert.IsTrue(ObjectHelper.AreEqual(logData["ThreadId"], threadId)); }
protected override void OnStartup(StartupEventArgs e) { #if DEBUG LogManager.AddDebugListener(); #endif Log.Info("Starting application"); // Want to improve performance? Uncomment the lines below. Note though that this will disable // some features. // // For more information, see http://docs.catelproject.com/vnext/faq/performance-considerations/ // Log.Info("Improving performance"); // Catel.Windows.Controls.UserControl.DefaultCreateWarningAndErrorValidatorForViewModelValue = false; // Catel.Windows.Controls.UserControl.DefaultSkipSearchingForInfoBarMessageControlValue = true; // TODO: Register custom types in the ServiceLocator //Log.Info("Registering custom types"); //var serviceLocator = ServiceLocator.Default; //serviceLocator.RegisterType<IMyInterface, IMyClass>(); // To auto-forward styles, check out Orchestra (see https://github.com/wildgums/orchestra) // StyleHelper.CreateStyleForwardersForDefaultStyles(); Log.Info("Calling base.OnStartup"); base.OnStartup(e); }
public void ErrorAndCreateException_NullInput() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); ExceptionTester.CallMethodAndExpectException <InvalidOperationException>(() => { throw log.ErrorAndCreateException <InvalidOperationException>(null); }); }
public void Error_ExceptionWithMessage_ExceptionNull() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => log.Error(null, string.Empty)); }
public void Error_ExceptionWithMessageFormat_ExceptionNull() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => log.Error(null, "additional message", 1)); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); LogManager.IgnoreCatelLogging = true; LogManager.AddDebugListener(true); }
public void Error_Exception_Null() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); ExceptionTester.CallMethodAndExpectException <ArgumentNullException>(() => log.Error((Exception)null)); }
public void SupportsNestedHierarchySerialization() { LogManager.AddDebugListener(); var root = new ModelBaseFacts.Group() { Name = "myRoot" }; var child = new ModelBaseFacts.Group() { Name = "myChild" }; root.Items = new ObservableCollection <ModelBaseFacts.Item>(); root.Items.Add(child); var xmlDocument = root.ToXml(null); var newRoot = ModelBaseFacts.Group.Load <ModelBaseFacts.Group>(xmlDocument); Assert.IsNotNull(newRoot); Assert.AreEqual("myRoot", newRoot.Name); Assert.AreEqual(1, newRoot.Items.Count); Assert.AreEqual("myChild", newRoot.Items[0].Name); }
public void Warning_Message_Null() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); log.Warning((string)null); }
public void CreatesLogForType() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); Assert.AreEqual(typeof(int), log.TargetType); }
public void CreatesLogForString() { LogManager.AddDebugListener(); var log = new Log("log"); Assert.AreEqual("log", log.Name); Assert.IsNull(log.TargetType); }
public void CreatesLogForStringAndType() { LogManager.AddDebugListener(); var log = new Log("log", typeof(int)); Assert.AreEqual("log", log.Name); Assert.AreEqual(typeof(int), log.TargetType); }
public void ThrowsArgumentOutOfRangeForNegativeValue() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); // TODO: IndentSize should be settable ExceptionTester.CallMethodAndExpectException <ArgumentOutOfRangeException>(() => log.IndentSize = -1); }
private static int Main(string[] args) { #if DEBUG LogManager.AddDebugListener(true); #endif var consoleLogListener = new OutputLogListener(); LogManager.AddListener(consoleLogListener); Uri remoteGitUrl = null; string commitId = null; string baseDir = null; string pdbPath = null; bool skipVerify = false; LinkMethod method = LinkMethod.Http; var arguments = ArgumentSyntax.Parse(args, syntax => { syntax.DefineOption("m|method", ref method, v => (LinkMethod)Enum.Parse(typeof(LinkMethod), v, true), "The method for SRCSRV to retrieve source code. One of <" + string.Join("|", Enum.GetNames(typeof(LinkMethod))) + ">. Default is " + method + "."); syntax.DefineOption("u|url", ref remoteGitUrl, s => new Uri(s, UriKind.Absolute), "Url to remote git repository."); syntax.DefineOption("commit", ref commitId, "The git ref to assume all the source code belongs to."); syntax.DefineOption("baseDir", ref baseDir, "The path to the root of the git repo."); syntax.DefineOption("s|skipVerify", ref skipVerify, "Verify all source files are available in source control."); syntax.DefineParameter("pdb", ref pdbPath, "The PDB to add source indexing to."); if (!string.IsNullOrEmpty(pdbPath) && !File.Exists(pdbPath)) { syntax.ReportError($"File not found: \"{pdbPath}\""); } if (!string.IsNullOrEmpty(baseDir) && !Directory.Exists(baseDir)) { syntax.ReportError($"Directory not found: \"{baseDir}\""); } }); if (string.IsNullOrEmpty(pdbPath)) { Log.Info(arguments.GetHelpText()); return(1); } var options = new LinkOptions { GitRemoteUrl = remoteGitUrl, GitWorkingDirectory = baseDir != null?Catel.IO.Path.GetFullPath(baseDir, Environment.CurrentDirectory) : null, CommitId = commitId, SkipVerify = skipVerify, Method = method, }; if (!Linker.Link(pdbPath, options)) { return(1); } WaitForKeyPressWhenDebugging(); return(0); }
public void SetUp() { LogManager.AddDebugListener(true); _serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _serverSocket.Bind(new IPEndPoint(IPAddress.Loopback, 0)); _serverSocket.Listen(1); _serverEndPoint = _serverSocket.LocalEndPoint as IPEndPoint; }
public void Warning_ExceptionWithMessage_MessageNull() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); var exception = new ArgumentNullException("log test"); log.Warning(exception, null); }
public void Error_ExceptionWithMessageFormat_MessageFormatNull() { LogManager.AddDebugListener(); var log = new Log(typeof(int)); var exception = new ArgumentNullException("log test"); log.Error(exception, null, 1); }