/// <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 void OnLaunched(LaunchActivatedEventArgs e)
        {
            ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
            if (titleBar != null)
            {
                Color titleBarColor = (Color)App.Current.Resources["SystemChromeMediumColor"];
                titleBar.BackgroundColor = titleBarColor;
                titleBar.ButtonBackgroundColor = titleBarColor;
            }

            AppShell shell = Window.Current.Content as AppShell;

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

                // Set the default language
                shell.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
            }

            // Place our app shell in the current Window
            Window.Current.Content = shell;

            if (shell.AppFrame.Content == null)
            {
                // When the navigation stack isn't restored, navigate to the first page
                // suppressing the initial entrance animation.
                shell.AppFrame.Navigate(typeof(MasterDetailPage), e.Arguments, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
            }

            // Ensure the current window is active
            Window.Current.Activate();

            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 200));
        }
        private void authButton_Clicked(object sender, EventArgs e)
        {
            if (_email.Text == "")
            {
                DisplayAlert("Ошибка", "Вы не ввели E-Mail", "OK");
            }
            else
            if (_pass1?.Text == "")
            {
                DisplayAlert("Ошибка", "Вы не ввели пароль", "OK");
            }
            else
            {
                try
                {
                    var client = new RestClient("https://api-eldoed.herokuapp.com/login");
                    client.Timeout = -1;
                    var request = new RestRequest(Method.POST);

                    request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
                    request.AddParameter("email", _email.Text.ToString());
                    request.AddParameter("password", _pass1.Text.ToString());
                    //delay ???
                    IRestResponse response = client.Execute(request);

                    string responseData = response.Content.ToString();

                    JSONauth tempUser = JsonConvert.DeserializeObject <JSONauth>(responseData);

                    DisplayAlert("Выполнено", "Авторизация прошла успешно", "OK");
                    Cart.CartList.Clear();
                    var page = new AppShell(tempUser);
                    (Application.Current.MainPage) = page;
                }
                catch
                {
                    DisplayAlert("Ошибка", "Введен неверный логин или пароль", "ОК");
                }
            }
        }
        public ExtendedSplash(IActivatedEventArgs e)
        {
            this.InitializeComponent();

            Window.Current.SizeChanged += new WindowSizeChangedEventHandler(ExtendedSplash_OnResize);

            splashScreen            = e.SplashScreen;
            this.activatedEventArgs = e;

            if (splashScreen != null)
            {
                // Retrieve the window coordinates of the splash screen image.
                splashImageRect = splashScreen.ImageLocation;
            }
            Resize();

            // Prepare the app shell and window content.
            shell          = Window.Current.Content as AppShell ?? new AppShell();
            shell.Language = ApplicationLanguages.Languages[0];

            LoadDataAsync(this.activatedEventArgs);
        }
        protected override async void OnStart()
        {
            AutoFacInit();
            MainPage = MasterPage = new AppShell();

            if (Mobile.PlatformSpecific.Properties.REDIRECT_TO.HasValue)
            {
                switch (Mobile.PlatformSpecific.Properties.REDIRECT_TO.Value)
                {
                case Common.Enums.ActivityPage.AddTransaction:
                    var value = Mobile.PlatformSpecific.Properties.ADD_TRANSACTION_VALUE;
                    var title = Mobile.PlatformSpecific.Properties.ADD_TRANSACTION_TITLE;
                    //MasterPage.NavigateTo(typeof(AddTransaction), value.ToString(), title);
                    await Shell.Current.GoToAsync("AddTransaction");

                    break;

                default:
                    break;
                }
            }
        }
Beispiel #5
0
        private async void Auth_Completed(object sender, AuthenticatorCompletedEventArgs e)
        {
            DismissViewController(true, null);

            if (e.IsAuthenticated)
            {
                var accessToken = e.Account.Properties["access_token"].ToString();
                var expiresIn   = Convert.ToDouble(e.Account.Properties["expires_in"]);
                var espiryDate  = DateTime.Now + TimeSpan.FromSeconds(expiresIn);

                var resquest = new OAuth2Request("GET", new Uri("https://graph.facebook.com/me?fields=email,first_name,last_name,gender,picture"), null, e.Account);
                var response = await resquest.GetResponseAsync();

                var obj = JObject.Parse(response.GetResponseText());
                GuidGenerate.E_MAIL = obj["email"].ToString();
                var name    = obj["first_name"].ToString() + " " + obj["last_name"].ToString();
                var picture = obj["picture"]["data"]["url"].ToString();

                done = true;
                await AppShell.NavigateToProfile(string.Format("{0}|{1}", name, picture));
            }
        }
Beispiel #6
0
        private async void App_LeavingBackground(object sender, LeavingBackgroundEventArgs e)
        {
            var d = e.GetDeferral();

            AppShell shell = Window.Current.Content as AppShell;

            if (shell != null && shell.AppFrame.CanGoBack)
            {
                try
                {
                    await SuspensionManager.RestoreAsync();
                }
                catch (SuspensionManagerException ex)
                {
                    // Something went wrong restoring state.
                    // Assume there is no state and continue
                }
            }


            d.Complete();
        }
Beispiel #7
0
        /// <summary>
        /// 画面から離れるとき
        /// </summary>
        /// <param name="e"></param>
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);
            this.RemoveHandler(UIElement.PointerReleasedEvent, new PointerEventHandler(mainGrid_PointerReleased));

            //終了処理
            this.ViewModel.Dispose();

            //フルスクリーンだったら元に戻す
            if (ApplicationView.GetForCurrentView().IsFullScreenMode)
            {
                ApplicationView.GetForCurrentView().ExitFullScreenMode();
            }

            //ナビメニューの表示状態を元に戻す
            AppShell shell = Window.Current.Content as AppShell;

            if (shell != null)
            {
                shell.ShowMenuPane();
            }
        }
Beispiel #8
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)
        {
            await VK.Api.Initialize();

            var response = await VK.Api.Execute(Creator(VK.Api.UserId, 10));
            var list = response["items"].Select(i => new VK.Model.Photo(i)).ToList();

            AppShell shell = Window.Current.Content as AppShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (shell == null)
            {
                // CreateAsync a Frame to act as the navigation context and navigate to the first page
                shell = new AppShell { DataContext = VK.Api.LoggedUser };

                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

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

            if (shell.AppFrame.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
                shell.AppFrame.Navigate(typeof(UserPage), VK.Api.UserId);
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Beispiel #9
0
        public StopService(Stop stopModel, AppShell appShell, MapService mapService, LocationChecker locationChecker, GameService gameService)
        {
            Model           = stopModel;
            Model.Service   = this;
            ViewModel       = new StopViewModel(appShell, Model.Name);
            MapService      = mapService;
            LocationChecker = locationChecker;
            GameService     = gameService;
            if (Model.Position != null)
            {
                IsVisibleInState2 = Model.Position.IsVisibleAsStopPosition;
            }

            State = 0;
            if ((bool)Model.IsInitial)
            {
                SetAsVisible();
            }
            else
            {
                SetAsUnvisible();
            }
        }
Beispiel #10
0
        /// <summary>
        /// Initialize the App launch.
        /// </summary>
        /// <returns>The AppShell of the app.</returns>
        private async Task <AppShell> Initialize()
        {
            var shell = Window.Current.Content as AppShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (shell == null)
            {
                UnityBootstrapper.Init();
                UnityBootstrapper.ConfigureRegistries();

                await AppInitialization.DoInitialization();

                // Create a AppShell to act as the navigation context and navigate to the first page
                shell = new AppShell()
                {
                    // Set the default language
                    Language = ApplicationLanguages.Languages[0]
                };
                shell.AppFrame.NavigationFailed += OnNavigationFailed;
            }
            return(shell);
        }
Beispiel #11
0
        public static void HandleKeyPress(AcceleratorKeyEventArgs keyPressEventArgs)
        {
            if (keyPressEventArgs.EventType != CoreAcceleratorKeyEventType.KeyDown)
            {
                return;
            }
            switch (keyPressEventArgs.VirtualKey)
            {
            case VirtualKey.F1:
                Cheats.GameSettings.Quests.Points = 20;
                AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("CHEAT: Points set to 20.", "Cheat activated"));
                break;

            case VirtualKey.F2:
                Cheats.GameSettings.Quests.LastQuestReceivedWhen  = DateTime.Today.GetNoon().GetPreviousDay();
                Cheats.GameSettings.Quests.LastQuestExchangedWhen = DateTime.Today.GetNoon().GetPreviousDay();

                AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("CHEAT: Cooldowns refreshed to 1 day.", "Cheat activated"));
                break;

            case VirtualKey.F3:
                Cheats.GameSettings.Quests.ClearAllQuests();
                AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("CHEAT: All quests cleared.", "Cheat activated"));
                break;

            case VirtualKey.F4:
                QuestManager.AddPoints(100);
                AppShell.GetForCurrentView().TriggerBubbleNotification(new BubbleNotification("CHEAT: +100 points", "Cheat activated"));
                break;

            default:
                //not handled, just return
                return;
            }
            //handle the key press
            keyPressEventArgs.Handled = true;
        }
        private void SetMainNavigation()
        {
            AppShell shell = Window.Current.Content as AppShell;

            if (shell == null)
            {
                shell = new AppShell();

                shell.Language = Windows.Globalization.ApplicationLanguages.Languages[0];

                shell.AppFrame.NavigationFailed += this.OnNavigationFailed;

                Window.Current.Content = shell;

                if (shell.AppFrame.Content == null)
                {
                    shell.AppFrame.Navigate(typeof(LandingPage), new RoutedEventArgs(), new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
                }

                Window.Current.Activate();
            }

            Window.Current.Content = shell;
        }
Beispiel #13
0
        protected override async void OnStart()
        {
            var oauthToken = string.Empty;

            // Find a user session
            try
            {
                oauthToken = await SecureStorage.GetAsync("oauth_token");
            }
            catch (Exception ex)
            {
                // Possible that device doesn't support secure storage on device.
            }

            // If a token is find
            if (!string.IsNullOrEmpty(oauthToken))
            {
                // Set the header
                IDictionary <string, string> headers = new Dictionary <string, string>();

                // Fetch the user token
                headers.Add("Authorization", "Bearer " + oauthToken);

                // Set the user session from the token
                UserSession = await WsHost.ExecuteGet <User>("users", "current", headers);

                UserSession.Token = oauthToken;

                // Opening the main view
                MainPage = new AppShell();
            }
            else
            {
                MainPage = new SignInPage();
            }
        }
Beispiel #14
0
        private async Task <AppShell> PrepareAppShellAsync(ApplicationExecutionState previousExecutionState)
        {
            AppShell shell = Window.Current.Content as AppShell;

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

                //Associate the frame with a SuspensionManager key
                SuspensionManager.RegisterFrame(shell.AppFrame, "AppFrame");

                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                if (previousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        // Something went wrong restoring state.
                        // Assume there is no state and continue
                    }
                }

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

            return(shell);
        }
Beispiel #15
0
        public App()
        {
#if DEBUG
            AdMaiora.RealXaml.Client.AppManager.Init(this);
#endif

            InitializeComponent();
            ThemeManager.LoadTheme();

            AppDomain.CurrentDomain.UnhandledException += (s, e) =>
            {
                LogManager.GetCurrentClassLogger().Fatal(e.ExceptionObject);
            };

            ConfigureNavigation();

            var appShell = new AppShell();
            NavigationService.Initialize(appShell.Navigation);
            MainPage = new NavigationPage(appShell)
            {
                BarBackgroundColor = Color.FromHex("#314a9b"),
                BarTextColor       = Color.White
            };
        }
Beispiel #16
0
        private void loginUser()
        {
            if (isRefreshing)
            {
                return;
            }

            isRefreshing = true;
            Models.AuthResponse        resp;
            Task <Models.AuthResponse> loginTask = Task.Run(() => restService.LoginAsync(Login));

            loginTask.ContinueWith(t => Device.BeginInvokeOnMainThread(
                                       async() => {
                isRefreshing = false;
                if (t.IsFaulted)
                {
                    await App.Current.MainPage.DisplayAlert("Connection error", "There was an error connecting to the server", "Try Again"); return;
                }
                resp = t.Result;
                if (resp.Success)
                {
                    AppShell appShell            = new AppShell(restService.Role == "Admin");
                    Models.UserInfoResponse usrR = await restService.UserInfo();
                    if (resp.Success)
                    {
                        restService.CurrentUser = usrR.User.itemValue;
                    }
                    App.Current.MainPage = appShell;
                }
                else
                {
                    await App.Current.MainPage.DisplayAlert(resp.Error.Message, resp.Error.Detail, "Try Again");
                }
            }
                                       ));
        }
Beispiel #17
0
 public static void Initialize<T>(List<NavMenuItem> list, NavigationFailedEventHandler OnNavigationFailed, LaunchActivatedEventArgs e)
     {
         AppShell shell = Window.Current.Content as AppShell;
         // Do not repeat app initialization when the Window already has content,
         // just ensure that the window is active
         if (shell == null)
         {
             // Create a AppShell to act as the navigation context and navigate to the first page
             shell = new AppShell();
             shell.NavigationList = list;
             try
             {
                 shell.CurrentItem = list.First(i => i.DestPage == typeof(T));
             }
             catch
             {
             }
             // Set the default language
             shell.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
             shell.AppFrame.NavigationFailed += OnNavigationFailed;
             if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
             {
                 //TODO: Load state from previously suspended application
             }
         }
         // Place our app shell in the current Window
         Window.Current.Content = shell;
         if (shell.AppFrame.Content == null)
         {
             // When the navigation stack isn't restored, navigate to the first page
             // suppressing the initial entrance animation.
             shell.AppFrame.Navigate(typeof(T), e.Arguments, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
         }
         // Ensure the current window is active
         Window.Current.Activate();
     }
 private void Current_TogglePaneButtonSizeChanged(AppShell s, Rect e)
 {
     Margin = new Thickness(e.Right, 0, 0, 0);
 }
 private void Current_TogglePaneButtonSizeChanged(AppShell sender, Rect e)
 {
     // If there is no adjustment due to the toggle button, use the default left margin.
     TitleBar.Margin = new Thickness(e.Right == 0 ? DEFAULT_LEFT_MARGIN : e.Right, 0, 0, 0);
 }
Beispiel #20
0
 private void Current_TogglePaneButtonSizeChanged(AppShell sender, Rect e)
 {
     this.titleBar.Margin = new Thickness(e.Right, 0, 0, 0);
 }
Beispiel #21
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)
        {
            ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
            StorageFolder            localFolder   = ApplicationData.Current.LocalFolder;
            var shell = Window.Current.Content as AppShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active

            //Two objects to store language preferences loaded from app data.
            object bool_check = localSettings.Values["LangBool"];
            object value      = localSettings.Values["ChosenLang"];

            if (shell == null)
            {
                //TODO: check if this can be removed with the neutral language set.
                // Create a AppShell to act as the navigation context and navigate to the first page
                if (Convert.ToBoolean(bool_check) == false)
                {
                    shell = new AppShell {
                        Language = ApplicationLanguages.Languages[0]
                    };



                    shell.MyAppFrame.NavigationFailed += OnNavigationFailed;

                    //Create an object of the DefaultLanguageSetter class.
                    DefaultLanguageSetter.LanguageSetter DLS = new DefaultLanguageSetter.LanguageSetter();

                    //Depending on the Langage of the machine, the default language index for the combo box is set.
                    if (shell.Language.Contains("de"))
                    {
                        DLS.setIndex(0);
                    }
                    if (shell.Language.Contains("de"))
                    {
                        DLS.setIndex(1);
                    }
                    if (shell.Language.Contains("es"))
                    {
                        DLS.setIndex(2);
                    }
                    if (shell.Language.Contains("pt"))
                    {
                        DLS.setIndex(3);
                    }
                    if (shell.Language.Contains("ru"))
                    {
                        DLS.setIndex(4);
                    }
                    if (shell.Language.Contains("cn"))
                    {
                        DLS.setIndex(5);
                    }
                }
                else
                {
                    shell = new AppShell {
                        Language = Convert.ToString(value)
                    };
                }
            }

            // Place our app shell in the current Window
            Window.Current.Content = shell;
            if (Convert.ToBoolean(bool_check) == false)
            {
                ApplicationLanguages.PrimaryLanguageOverride = GlobalizationPreferences.Languages[0];
            }
            else
            {
                ApplicationLanguages.PrimaryLanguageOverride = Convert.ToString(value);
            }

            if (shell.MyAppFrame.Content == null)
            {
                // When the navigation stack isn't restored, navigate to the first page
                // suppressing the initial entrance animation.
                var setup = new Setup(shell.MyAppFrame);
                setup.Initialize();

                var start = Mvx.Resolve <IMvxAppStart>();
                start.Start();

                shell.ViewModel = Mvx.Resolve <MenuViewModel>();
            }

            new TileHelper().DoNavigation(string.IsNullOrEmpty(e.Arguments)
                ? e.TileId
                : e.Arguments);

            OverrideTitleBarColor();

            //If Jump Lists are supported, adds them§a
            if (ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList"))
            {
                SetJumplist();
            }

            CallRateReminder();

            // Ensure the current window is active
            Window.Current.Activate();
        }
 private void Current_TogglePaneButtonSizeChanged(AppShell sender, Rect e)
 {
     this.titleBar.Margin = new Thickness(e.Right, 0, 0, 0);
 }
Beispiel #23
0
        private void ViewAllFurnitureProduct_Clicked(object sender, EventArgs e)
        {
            AppShell appShell = (AppShell)Shell.Current;

            appShell.CurrentItem = appShell.Items[AppShell.FURNITURE_INDEX];
        }
 private void EasterEggButton_OnClick(object sender, RoutedEventArgs e)
 {
     AppShell.GetForCurrentView().ToggleEasterEgg();
 }
 public SettingsSecurityUserControl()
 {
     InitializeComponent();
     appShell = Window.Current.Content as AppShell;
     Loaded  += new RoutedEventHandler(DisablePassportSwitch);
 }
Beispiel #26
0
 public void AddToBar()
 {
     AppShell.AddFlyoutItemAtIndex(2, FlyoutItem);
 }
 protected void Loaded() => AppShell.GetCurrent().SetLoaded();
Beispiel #28
0
 public AppShellViewDispatcher(IMvxWindowsViewPresenter presenter, AppShell rootFrame)
     : base(rootFrame.Dispatcher)
 {
     _presenter = presenter;
 }
Beispiel #29
0
        protected override async void OnStart()
        {
            await FetchPreviousToken();

            MainPage = new AppShell();
        }
Beispiel #30
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)
        {
#if DEBUG
            if (Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            AppShell shell = Window.Current.Content as AppShell;



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

                //Associate the frame with a SuspensionManager key
                SuspensionManager.RegisterFrame(shell.AppFrame, "AppFrame");

                shell.AppFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropriate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        // Something went wrong restoring state.
                        // Assume there is no state and continue
                    }
                }

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


            // Back to the first(home) page if the app already have pages
            while (shell.AppFrame.CanGoBack)
            {
                shell.AppFrame.GoBack();
            }

            foreach (var item in shell.AppFrame.BackStack)
            {
                Debug.WriteLine(item.SourcePageType);
            }


            if (shell.AppFrame.Content == null)
            {
                shell.AppFrame.Navigate(typeof(BooruViewer.Views.HomePage), e.Arguments);
            }


            // Handle the launch from a toast
            var queryString = QueryString.Parse(e.Arguments);
            if (queryString.TryGetValue("action", out string action))
            {
                switch (action)
                {
                case "viewPost":
                    break;

                default:
                    break;
                }
            }

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            // Ensure the current window is active
            Window.Current.Activate();

            AppSettings.Current.ScreenHeight = DisplayInformation.GetForCurrentView().ScreenHeightInRawPixels;
            AppSettings.Current.ScreenWidth  = DisplayInformation.GetForCurrentView().ScreenWidthInRawPixels;


            // Update Tags
            if (TagDataBase.AllTags.Count == 0)
            {
                try
                {
                    await TagDataBase.DownloadLatestTagDBAsync();
                }
                catch (Exception ex)
                {
                    //new MessageDialog(ex.Message).ShowAsync();
                }
            }


            // TODO: reenable after debug
            BackgroundAccessStatus status = await BackgroundExecutionManager.RequestAccessAsync();

            BackgroundTaskBuilder builder = new BackgroundTaskBuilder()
            {
                Name = "ToastActionTask",
                //TaskEntryPoint = "RuntimeComponent1.NotificationActionBackgroundTask"
            };
            builder.SetTrigger(new ToastNotificationActionTrigger());
            BackgroundTaskRegistration registration = builder.Register();



            //await new MessageDialog("這是公測版應用,所有內容和功能不代表最終成品。公測者有義務不定期使用QQ或電郵提出反饋和改善建議。請勿在應用商店就內測版內容作出評分或評論。如果無法理解或者無法同意此守則,請卸載本應用。電郵:[email protected]", "使用須知").ShowAsync();
        }
Beispiel #31
0
    public App()
    {
        InitializeComponent();

        MainPage = new AppShell();
    }
Beispiel #32
0
 public void TriggerNotification(BubbleNotification notification)
 {
     AppShell.GetForCurrentView().TriggerBubbleNotification(notification);
 }
Beispiel #33
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 shell = Window.Current.Content as AppShell;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (shell == null)
            {
                //TODO: check if this can be removed with the neutral language set.
                // Create a AppShell to act as the navigation context and navigate to the first page
                shell = new AppShell {
                    Language = ApplicationLanguages.Languages[0]
                };

                shell.MyAppFrame.NavigationFailed += OnNavigationFailed;
            }

            // Place our app shell in the current Window
            Window.Current.Content = shell;
            ApplicationLanguages.PrimaryLanguageOverride = GlobalizationPreferences.Languages[0];

            if (shell.MyAppFrame.Content == null)
            {
                // When the navigation stack isn't restored, navigate to the first page
                // suppressing the initial entrance animation.
                var setup = new Setup(shell.MyAppFrame);
                setup.Initialize();

                var start = Mvx.Resolve <IMvxAppStart>();
                start.Start();

                shell.ViewModel = Mvx.Resolve <MenuViewModel>();
            }

            new TileHelper().DoNavigation(string.IsNullOrEmpty(e.Arguments)
                ? e.TileId
                : e.Arguments);

            OverrideTitleBarColor();

            //If Jump Lists are supported, adds them§a
            if (ApiInformation.IsTypePresent("Windows.UI.StartScreen.JumpList"))
            {
                SetJumplist();
            }

            CallRateReminder();

            // Ensure the current window is active
            Window.Current.Activate();

            var settings           = ApplicationData.Current.LocalSettings;
            var clearPaymentResult = settings.Values["CLEAR_PAYMENT"]?.ToString();

            if (!string.IsNullOrEmpty(clearPaymentResult) && clearPaymentResult == "true")
            {
                await new DialogService().ShowMessage("Task Executed", "Clear PaymentViewModel");
            }

            var recPaymentResult = settings.Values["RECURRING_PAYMENT"]?.ToString();

            if (!string.IsNullOrEmpty(recPaymentResult) && recPaymentResult == "true")
            {
                await new DialogService().ShowMessage("Task Executed", "RecPayment");
            }

            var syncBackupResult = settings.Values["SYNC_BACKUP"]?.ToString();

            if (!string.IsNullOrEmpty(syncBackupResult) && syncBackupResult == "true")
            {
                await new DialogService().ShowMessage("Task Executed", "Sync Backup");
            }
        }
Beispiel #34
0
 private void Current_TogglePaneButtonSizeChanged(AppShell sender, Rect e)
 {
     // If there is no adjustment due to the toggle button, use the default left margin.
     TitleBar.Margin = new Thickness(e.Right == 0 ? DEFAULT_LEFT_MARGIN : e.Right, 0, 0, 0);
 }
Beispiel #35
0
 public void Ask()
 {
     AppShell.AddFlyoutItemAtIndex(2, FlyOutItem);
 }
Beispiel #36
0
 public void RemoveFromBar()
 {
     AppShell.RemoveFlyoutItem(this.FlyOutItem);
 }
Beispiel #37
0
        // Event handler for login button, try to login when clicked
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            provider = (sender as Button).Name;

            // Hide the buttons and show a progress ring
            LoginProgress.Visibility = Visibility.Visible;
            MicrosoftAccount.Visibility = Visibility.Collapsed;
            Facebook.Visibility = Visibility.Collapsed;

            // Try to log the user in
            try
            {
                await AuthenticateAsync();
            }
            catch(Exception ex)
            {
                Debug.WriteLine(ex.StackTrace);
            }

            if (user != null)
            {
                try
                {
                    User newuser = new User() { Id = user.UserId };
                    await userTable.InsertAsync(newuser);
                }
                catch (Exception)
                {
                    // User already exist, do nothing
                }

                AppShell shell = Window.Current.Content as AppShell;

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

                    // Set the default language
                    shell.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
                }

                // Place our app shell in the current Window
                Window.Current.Content = shell;

                if (shell.AppFrame.Content == null)
                {
                    // When the navigation stack isn't restored, navigate to the first page
                    // suppressing the initial entrance animation.
                    shell.AppFrame.Navigate(typeof(EventList), null, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
                }

                Window.Current.Activate();
            }
            else
            {
                LoginProgress.Visibility = Visibility.Collapsed;
                MicrosoftAccount.Visibility = Visibility.Visible;
                Facebook.Visibility = Visibility.Visible;
            }
        }