示例#1
0
        public static async Task Run()
        {
            ViewResolver.Instance.ViewInit();
            MangaReader.Core.Client.OtherAppRunning  += ClientOnOtherAppRunning;
            MangaReader.Core.Client.ClientBeenClosed += ClientOnClientBeenClosed;
            MangaReader.Core.Client.ClientUpdated    += ClientOnClientUpdated;

            // Извлечение текущего списка часто используемых элементов
            var jumpList = new JumpList();

            JumpList.SetJumpList(App.Current, jumpList);

            // Добавление нового объекта JumpPath для файла в папке приложения
            var path = System.Reflection.Assembly.GetExecutingAssembly().Location;

            if (File.Exists(path))
            {
                JumpTask jumpTask = new JumpTask
                {
                    CustomCategory   = "Манга",
                    Title            = "Добавить мангу",
                    ApplicationPath  = path,
                    IconResourcePath = path,
                    Arguments        = AddManga
                };
                jumpList.JumpItems.Add(jumpTask);
            }

            // Обновление списка часто используемых элементов
            jumpList.Apply();

            var initialize = new Initialize();
            var args       = Environment.GetCommandLineArgs();

            if (args.Contains("-m") || args.Contains("/min") || ConfigStorage.Instance.AppConfig.StartMinimizedToTray)
            {
                await initialize.InitializeSilent().ConfigureAwait(true);

                WindowModel.Instance.InitializeSilent();
                SaveSettingsCommand.ValidateMangaPaths();
            }
            else
            {
                initialize.Show();
                WindowModel.Instance.Show();
            }
        }
示例#2
0
        public override void Show()
        {
            base.Show();
            var window = ViewService.Instance.TryGet <System.Windows.Window>(this);

            if (window != null)
            {
                window.ContentRendered += async(sender, args) =>
                {
                    try
                    {
                        await Core.Client.Start(this).ConfigureAwait(true);

                        SaveSettingsCommand.ValidateMangaPaths();
                    }
                    catch (Exception e)
                    {
                        Log.Exception(e, "Инициализация не закончилась.");
                    }
                };
                window.ShowDialog();
            }
        }