Exemplo n.º 1
0
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(500, 500));
            var rootFrame = Window.Current.Content as Frame;

            if (!string.IsNullOrWhiteSpace(e.Arguments))
            {
                LaunchUri(e.Arguments);
            }

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //nothing
                }
                if (e.PrelaunchActivated)
                {
                    return;
                }


                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active

            try
            {
                HtmlClassMgr.Init();
            }
            catch (Exception)
            {
                // no internet?
            }

            Window.Current.Activate();
            RateReminderPopUp.ProcessRatePopUp();
            var tb = ApplicationView.GetForCurrentView().TitleBar;

            tb.BackgroundColor = tb.ButtonBackgroundColor = tb.InactiveBackgroundColor = tb.ButtonInactiveBackgroundColor = Settings.SelectedTheme == ApplicationTheme.Dark ? Color.FromArgb(255, 41, 41, 41) : Colors.White;
            ProcessUpdate();
        }
Exemplo n.º 2
0
 public static void InitApp()
 {
     Credentials.Init();
     HtmlClassMgr.Init();
     FavouritesManager.LoadData();
     AnimeImageQuery.Init();
     ViewModelLocator.ForumsMain.LoadPinnedTopics();
     if (Settings.NotificationCheckInRuntime && Credentials.Authenticated)
     {
         ResourceLocator.SchdeuledJobsManger.StartJob(ScheduledJob.FetchNotifications, 5, () =>
         {
             ResourceLocator.NotificationsTaskManager.CallTask(BgTasks.Notifications);
         });
     }
     ResourceLocator.HandyDataStorage.Init();
 }
Exemplo n.º 3
0
 protected TestResources()
 {
     HtmlClassMgr.Init();
 }
Exemplo n.º 4
0
 public AnimeSeasonalTest()
 {
     HtmlClassMgr.Init();
 }
Exemplo n.º 5
0
        /// <summary>
        ///     Invoked when the application is launched normally by the end user.  Other entry points
        ///     will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = Window.Current.Content as Frame;
            Tuple <int, string> navArgs = null;

            if (!string.IsNullOrWhiteSpace(e.Arguments))
            {
                var options = e.Arguments.Split(';');
                if (options[0] == TileActions.OpenUrl.ToString())
                {
                    LaunchUri(options[1]);
                }
                else
                {
                    var detailArgs = options[1].Split('|');
                    navArgs = new Tuple <int, string>(int.Parse(detailArgs[0]), detailArgs[1]);
                }
            }
            Credentials.Init();
            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //nothing
                }
                if (e.PreviousExecutionState == ApplicationExecutionState.NotRunning)
                //Crashed - we have to remove cached anime list
                {
                    if (Settings.IsCachingEnabled)
                    {
                        await DataCache.ClearAnimeListData(); //clear all cached users data
                    }
                }
                if (e.PrelaunchActivated)
                {
                    return;
                }


                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), navArgs);
            }
            else if (!string.IsNullOrEmpty(e.Arguments))
            {
                ViewModelLocator.Main.Navigate(PageIndex.PageAnimeDetails,
                                               new AnimeDetailsPageNavigationArgs(navArgs.Item1, navArgs.Item2, null, null));
            }
            // Ensure the current window is active
            HtmlClassMgr.Init();
            LiveTilesManager.LoadTileCache();
            Window.Current.Activate();
            RateReminderPopUp.ProcessRatePopUp();
            ProcessStatusBar();
            ProcessUpdate();
        }