protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            AppDomain.CurrentDomain.UnhandledException += (o, args) => {
                HandleUnhandledException(args.ExceptionObject as Exception);
            };

            DispatcherUnhandledException += (o, args) => {
                HandleUnhandledException(args.Exception);
            };

            try
            {
                Singleton.Add(Log = new WarningHandler());

                Singleton.Add(new DataEncryptor());
                Singleton.Add(new FileDataManager());

                Log.OnWrite += (sender, eventArgs) =>
                {
                    var args = (WarningEventArgs)eventArgs;
                    if (args.Value == WarnType.Error || args.Value == WarnType.Fatal)
                    {
                        MessageBox.Show(args.Message, args.Exception?.Message);
                    }
                };

                if (e.Args.Any() && e.Args[0] == TaskSchedulerMode)
                {
                    if (new LauncherSettingsManager().Settings.RunOnUserLogon)
                    {
                        RunLazuriteWithAdminPrivileges();
                    }
                    else
                    {
                        Shutdown();
                    }
                }
                else
                {
                    RunLazuriteWithAdminPrivileges();
                }
            }
            catch (Exception exception)
            {
                HandleUnhandledException(exception);
            }
        }