예제 #1
0
        public void NavigateToActionItem(ActionItem actionItem)
        {
            if (actionItem == null)
            {
                throw new ArgumentNullException("actionItem");
            }
            var navParams = new NavigationParameters {
                { "ActionItem", actionItem }
            };

            switch (actionItem.ActionType)
            {
            case ActionItemType.MissingUtilityBill:
                NavService.Navigate("MissingBillPage", navParams);
                break;

            case ActionItemType.PrebillingApproval:
                NavService.Navigate("PrebillingTabbedPage", navParams);
                break;

            case ActionItemType.UtilityAlert:
                NavService.Navigate("UtilityAlertPage", navParams);
                break;
            }
        }
예제 #2
0
        private void NavigationView_SelectionChanged(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewSelectionChangedEventArgs args)
        {
            if (args.IsSettingsSelected)
            {
                NavService.Navigate(typeof(Views.SettingsView));
                return;
            }

            if (!(args.SelectedItem is Microsoft.UI.Xaml.Controls.NavigationViewItem navItem))
            {
                NavService.Navigate(typeof(Views.HomeView));
                return;
            }

            PageInfo pageInfo = NavigationHelper.Pages.Find((info) => info.Title == navItem.Content.ToString());

            if (pageInfo == null)
            {
                NavService.Navigate(typeof(Views.HomeView));
                return;
            }

            if (pageInfo != null && pageInfo.PageType.BaseType == typeof(Page))
            {
                NavService.Navigate(pageInfo.PageType);
            }
        }
예제 #3
0
        private async void controlsSearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
        {
            if (args.ChosenSuggestion != null && args.ChosenSuggestion is MicrosoftStore.Models.Product product)
            {
                try
                {
                    LoadingIndicator.Visibility = Visibility.Visible;

                    var    culture   = CultureInfo.CurrentUICulture;
                    var    region    = new RegionInfo(culture.LCID);
                    string productId = product.Metas.First(m => m.Key == "BigCatalogId").Value;

                    // Get the full product details
                    var item = await Ioc.Default.GetRequiredService <MicrosoftStore.IStorefrontApi>().GetProduct(productId, region.TwoLetterISORegionName, culture.Name);

                    var candidate = item.Convert <MicrosoftStore.Models.ProductDetails>().Payload;
                    if (candidate?.PackageFamilyNames != null && candidate?.ProductId != null)
                    {
                        CurrentProduct = candidate;
                        LoadingIndicator.Visibility = Visibility.Collapsed;
                        NavService.Navigate(typeof(Views.ProductDetailsView), CurrentProduct);
                    }
                }
                catch (ArgumentNullException ex)
                {
                    Debug.WriteLine(ex.ParamName + ":\r\n" + ex.StackTrace);
                }
            }
            else if (!string.IsNullOrEmpty(args.QueryText))
            {
                NavService.Navigate(typeof(Views.SearchResultsView), args.QueryText);
            }
        }
예제 #4
0
 public static void NavigateToNotesPage()
 {
     if (NotesViewModel == null)
     {
         NotesViewModel = new NotesPageViewModel(new NotesPage());
     }
     NotesViewModel.UpdateNotes();
     NavService.Navigate(NotesViewModel.Page);
 }
예제 #5
0
 public static void NavigateToInfoPage()
 {
     InfoViewModel.SelectedItem = NotesViewModel.SelectedItem;
     NavService.Navigate(InfoViewModel.Page);
 }
예제 #6
0
 public static void NavigateToEditPage()
 {
     EditViewModel.SelectedItem = NotesViewModel.SelectedItem;
     NavService.Navigate(EditViewModel.Page);
 }
예제 #7
0
 public static void NavigateToAddPage()
 {
     AddViewModel.SelectedItem = new Note();
     AddViewModel.Notes        = NotesViewModel.Notes;
     NavService.Navigate(AddViewModel.Page);
 }
예제 #8
0
 public static void NavigateToRegisterPage()
 {
     NavService.Navigate(RegisterViewModel.Page);
 }
예제 #9
0
 public static void NavigateToLoginPage()
 {
     NavService.Navigate(LoginViewModel.Page);
 }
예제 #10
0
 public void ExecuteSinglePlayer()
 {
     NavService.Navigate("SinglePlayer", null);
 }
예제 #11
0
 private void ExecHamburger()
 {
     NavService.Navigate("NwpSelectorPage");
 }
        private async void StartNewGame()
        {
            try
            {
                bool success             = false;
                GoGameStateResponse resp = null;

                for (int tries = 0; !AbortOperation && !success && tries < 5; tries++)
                {
                    BusyMessage = "Starting game...";
                    IsBusy      = true;

                    var tmpNewGame = Guid.NewGuid();

                    // Create game from user's selections.
                    var p1 = new GoPlayer();
                    var p2 = new GoPlayer();
                    if (Color == (int)GoColor.Black)
                    {
                        p1.Name       = Name;
                        p1.PlayerType = PlayerType.Human;

                        p2.Name       = "Fuego";
                        p2.PlayerType = PlayerType.AI;
                        p2.Level      = DifficultyLevel;
                    }
                    else
                    {
                        p2.Name       = Name;
                        p2.PlayerType = PlayerType.Human;

                        p1.Name       = "Fuego";
                        p1.PlayerType = PlayerType.AI;
                        p1.Level      = DifficultyLevel;
                    }
                    var tmpState = new GoGameState(
                        tmpNewGame,
                        (byte)BoardEdgeSize,
                        p1, p2,
                        GoGameStatus.Active,
                        GoColor.Black,
                        "",
                        "",
                        new List <GoMoveHistoryItem>(),
                        0);
                    resp = await DataRepository.StartAsync(tmpNewGame, tmpState);

                    BusyMessage = null;
                    IsBusy      = false;

                    ActiveGame = tmpNewGame;
                    success    = true;
                }

                if (AbortOperation)
                {
                    return;
                }

                if (success)
                {
                    NavService.Navigate("Game", ActiveGame);
                }
                else
                {
                    if (resp != null)
                    {
                        await DisplayErrorCode(resp.ResultCode);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                BusyMessage = null;
                IsBusy      = false;
            }
        }
 public void ExecuteResume()
 {
     NavService.Navigate("Game", ActiveGame);
 }