예제 #1
0
 private void MyAutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     sender.Text = args.SelectedItem.ToString();
     SuggestionsManager.GetCitiesByName(Cities, sender.Text);
     CategoryTextBlock.Text = sender.Text;
     Frame.Navigate(typeof(CityFutureWeather), sender.Text);
 }
예제 #2
0
        private void MyAutoSuggestBox_TextChangedAsync(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args)
        {
            if (String.IsNullOrEmpty(sender.Text))
            {
                goBack();
            }

            SuggestionsManager.GetAllCities(Cities);
            Suggestions = Cities.Where(p => p.StartsWith(sender.Text)).Select(p => p.ToString()).ToList();
            MyAutoSuggestBox.ItemsSource = Suggestions;
        }
예제 #3
0
 public SuggestionPageViewModel(INavigationService navigationService, IPageDialogService dialogService,
                                RefreshTokenManager refreshTokenManager, SystemStatusManager systemStatusManager,
                                AppStatus appStatus, SuggestionsManager suggestionsManager)
 {
     this.navigationService   = navigationService;
     this.dialogService       = dialogService;
     this.refreshTokenManager = refreshTokenManager;
     this.systemStatusManager = systemStatusManager;
     this.appStatus           = appStatus;
     this.suggestionsManager  = suggestionsManager;
     OKCommand = new DelegateCommand(async() =>
     {
         using (IProgressDialog fooIProgressDialog = UserDialogs.Instance.Loading($"請稍後,更新資料中...", null, null, true, MaskType.Black))
         {
             bool fooRefreshTokenResult = await RefreshTokenHelper.CheckAndRefreshToken(dialogService, refreshTokenManager, systemStatusManager, appStatus);
             if (fooRefreshTokenResult == false)
             {
                 return;
             }
             var fooResult = await suggestionsManager.PostAsync(new SuggestionRequestDTO()
             {
                 Subject    = SuggestionModel.Subject,
                 Message    = SuggestionModel.Message,
                 SubmitTime = DateTime.Now,
                 User       = new UserDTO()
                 {
                     Id = appStatus.SystemStatus.UserID
                 },
             });
             if (fooResult.Status == true)
             {
                 await dialogService.DisplayAlertAsync("通知", "已經成功提交", "確定");
             }
             else
             {
                 await dialogService.DisplayAlertAsync("錯誤", $"已經發生例外異常:{fooResult.Message}", "確定");
             }
         }
     });
 }
예제 #4
0
 private void goBack()
 {
     SuggestionsManager.GetAllCities(Cities);
     CategoryTextBlock.Text = "All Cities";
 }
예제 #5
0
 private void MyAutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     SuggestionsManager.GetCitiesByName(Cities, sender.Text);
     CategoryTextBlock.Text = sender.Text;
     Frame.Navigate(typeof(CityFutureWeather), sender.Text);
 }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            Suggestions = await SuggestionsManager.GetFutureInfoAsync(e.Parameter.ToString());

            MyGridView.ItemsSource = Suggestions;
        }