コード例 #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var frame = Window.Current.Content as Frame;

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = frame.CanGoBack ?
                                                                                      AppViewBackButtonVisibility.Visible :
                                                                                      AppViewBackButtonVisibility.Collapsed;

            if (helper.KeyExists("radio"))
            {
                switch (helper.Read <string>("radio"))
                {
                case "default":
                    tb_notice.Visibility       = Visibility.Collapsed;
                    slder_def.Opacity          = 1.0;
                    slder_def.IsHitTestVisible = true;
                    break;

                case "custom":
                    tb_notice.Visibility       = Visibility.Visible;
                    slder_def.Opacity          = 0.5;
                    slder_def.IsHitTestVisible = false;
                    break;
                }
            }
            else
            {
                tb_notice.Visibility       = Visibility.Collapsed;
                slder_def.Opacity          = 1.0;
                slder_def.IsHitTestVisible = true;
            }
        }
コード例 #2
0
        private void CheckAndSendNotification(string key, int newValue, string text)
        {
            if (_roamingObjectStorage.KeyExists(key))
            {
                int oldValue = _roamingObjectStorage.Read <int>(key);

                if (newValue > oldValue)
                {
                    NotificationExtensions.SendToastNotification(text);
                    NotificationExtensions.SendTileNotification(text);

                    ResourceExtensions.StoreRoamingObject(key, newValue);
                }
            }
        }
コード例 #3
0
        private void g_custom_Loaded(object sender, RoutedEventArgs e)
        {
            if (helper.KeyExists("radio"))
            {
                switch (helper.Read <string>("radio"))
                {
                case "default":
                    rb_default.IsChecked = true;
                    break;

                case "custom":
                    rb_custom.IsChecked = true;
                    break;
                }
            }
            else
            {
                rb_default.IsChecked = true;
            }
        }
コード例 #4
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)
        {
            //IPropertySet roamingProperties = Application.Current.RoamingSettings.Values();
            RoamingObjectStorageHelper roamingProperties = new RoamingObjectStorageHelper();
            //IPropertySet roamingProperties = Windows.Storage.ApplicationData.Current.RoamingSettings.Values;
            Frame rootFrame = Window.Current.Content as Frame;

            Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
            // 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;
            }
            var k = roamingProperties.KeyExists("HasBeenHereBefore");

            if (roamingProperties.KeyExists("HasBeenHereBefore"))
            {
                try
                {
                    var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
                    authToken = localSettings.Values["authToken"].ToString();
                }
                catch
                {
                    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
                            rootFrame.Navigate(typeof(MainPage), e.Arguments);
                        }
                        // Ensure the current window is active
                        Window.Current.Activate();
                    }
                }

                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
                        DataManager.StatusCode res = await DataManager.LoginAsync(authToken);

                        if (res == DataManager.StatusCode.NoInternet)
                        {
                        }
                        if (res == DataManager.StatusCode.Success)
                        {
                            rootFrame.Navigate(typeof(Home), e.Arguments);
                        }
                        else
                        {
                            rootFrame.Navigate(typeof(MainPage), e.Arguments);
                            MessageDialog dialog = new MessageDialog("No Pre-stored data found, please connect to the internet");
                            await dialog.ShowAsync();
                        }
                    }
                    // Ensure the current window is active
                    Window.Current.Activate();
                }
            }
            else
            {
                // The First Time App Starts Case
                //roamingProperties["HasBeenHereBefore"] = bool.TrueString;
                roamingProperties.Save("HasBeenHereBefore", true);
                rootFrame.Navigate(typeof(Welcome), e.Arguments);
                Window.Current.Activate();
            }
        }