Exemplo n.º 1
0
        private async void ToDoTask_CompletedTasksCountChanged(object sender, EventArgs e)
        {
            int numOfCompletedTasks = ToDoTask.CompletedTasks;

            ScoreTextBlock.Text = numOfCompletedTasks.ToString();
            RoamingSync.UpdateScore(numOfCompletedTasks);



            if (numOfCompletedTasks % 10 == 0 && ToDoTask.CompletedTasks != 0)
            {
                await animateScoreTextBlock();
            }

            TileService.UpdateLiveTile(localListOfTasks);
        }
Exemplo n.º 2
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 async override void OnLaunched(LaunchActivatedEventArgs e)
        {
            await Engagement.RegisterEngagementService();

            TileService.turnOnTileServiceForFirstTime();
            var result = Mango.App.appVersionChecker.getAppVersionStatus();

            switch (result)
            {
            case Mango.Enums.appVersionStatus.FirstTime:
                await new FileIOService().saveData();
                TileService.UpdateLiveTile(ToDoTask.listOfTasks);
                break;

            case Mango.Enums.appVersionStatus.Old:
            case Mango.Enums.appVersionStatus.Current:
                await new FileIOService().loadData();
                break;
            }



            RoamingSync.RestoreScore();

            var TopBarColor = (Color)Application.Current.Resources["SystemAccentColor"];

            if (DeviceDetection.DetectDeviceType() == DeviceType.Phone)
            {
                sBarService = new StatusBarService();
            }

            else
            {
                if (new FluentService().tryMakingTitleBarFluent() == false)
                {
                    var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                    titleBar.BackgroundColor               = TopBarColor;
                    titleBar.ForegroundColor               = Colors.White;
                    titleBar.ButtonBackgroundColor         = TopBarColor;
                    titleBar.InactiveBackgroundColor       = TopBarColor;
                    titleBar.ButtonInactiveBackgroundColor = TopBarColor;
                }
            }

            var appView = ApplicationView.GetForCurrentView();

            appView.SetPreferredMinSize(new Size(390, 460));


            Frame rootFrame = Window.Current.Content as Frame;

            // 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)
                {
                    // TODO: Load state from previously suspended application
                }

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

            if (e.PrelaunchActivated == false)
            {
                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
                    PageStuff.navigating = true;
                    NavService           = new Navigation(ref rootFrame);
                    //if (Settings.GetWhetherOnBoardingPageHasBeenViewed() == null)
                    //{
                    //    rootFrame.Navigate(typeof(OnboardingPage), e.Arguments);
                    //}
                    //else
                    //{
                    //    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                    //}
                    NavService.Navigate(typeof(MainPage), e.Arguments);
                }
                // Ensure the current window is active
                Window.Current.Activate();
            }


            rootFrame.Navigated += RootFrame_Navigated;
            // After  Window.Current.Content = rootFrame;
            // Register a handler for BackRequested events and set the
            // visibility of the Back button
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                rootFrame.CanGoBack ?
                AppViewBackButtonVisibility.Visible :
                AppViewBackButtonVisibility.Collapsed;
        }
Exemplo n.º 3
0
 private void Current_DataChanged(ApplicationData sender, object args)
 {
     RoamingSync.UpdateDataChange();
 }