private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var error = false;
            pageTitle.Text = "Hi, " + App.User.Fullname;
            try
            {
                var existingDisasters = await Service.GetTable<Disaster>()
                    .Where(t => t.Active == DisasterStatusType.Active).ToListAsync();
                lstDisasters.ItemsSource = existingDisasters;
                foreach(var item in existingDisasters)
                {
                    var pin = new Pushpin();
                    pin.Text = item.Description;
                    map.Children.Add(pin);
                    MapLayer.SetPosition(pin, new Location(item.Latitude, item.Longitude));
                }
            }
            catch (Exception ex)
            {
                error = true;
            }

            if(error)
            {
                await new MessageDialog("Something went wrong!").ShowAsync();
                return;
            }
            geolocator = new Geolocator();
            geolocator.DesiredAccuracy = PositionAccuracy.High;
            geolocator.DesiredAccuracyInMeters = 100;
            var location = await geolocator.GetGeopositionAsync();
            map.Center = new Location(location.Coordinate.Latitude, location.Coordinate.Longitude);
        }
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="Common.NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Create an appropriate data model for your problem domain to replace the sample data
     var group = await DataSource.GetGroupAsync((String)e.NavigationParameter);
     this.DefaultViewModel["Group"] = group;
     this.DefaultViewModel["Items"] = group.Items;
 }
Esempio n. 3
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            //var sampleDataGroup = await SampleDataSource.GetGroupAsync("Group-4");
            //this.DefaultViewModel["Section3Items"] = sampleDataGroup;

            //this.canteensHub.Sections.Clear();

            CanteenFEUP[] canteens = await API.GetAsync<CanteenFEUP[]>(API.Actions.GetFEUPCanteen);

            //Object canteenTemplate;
            //this.Resources.TryGetValue("canteenSectionDataTemplate", out canteenTemplate);
            /*foreach (CanteenFEUP canteen in canteens)
            {
                HubSection hs = new HubSection();
                hs.Header = canteen.descricao;
                hs.DataContext = canteen.ementas;
                
                //hs.ContentTemplate = canteenTemplate as DataTemplate; //estoura
                hs.ContentTemplate = this.sectionzinha.ContentTemplate; //shitty temp solution
                this.canteensHub.Sections.Add(hs);
            }*/
            this.canteens.DataContext = canteens;
            //this.sectionzinha.Visibility = Visibility.Collapsed;
            //this.sectionzinha.Header = canteens[0].descricao;
            //this.sectionzinha.DataContext = canteens[0].ementas;
           

        }
Esempio n. 4
0
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     if (CurrentPageViewModel != null)
     {
         CurrentPageViewModel.navigationHelper_LoadState(e);
     }
     LoadState(e);
 }
Esempio n. 5
0
        protected override Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            if (e.NavigationEventArgs.NavigationMode == NavigationMode.New)
            {
            }

            return base.OnLoadStateAsync(e, isFirstRun);
        }
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="Common.NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Create an appropriate data model for your problem domain to replace the sample data
     var sampleDataGroups = await DataSource.GetGroupsAsync();
     this.DefaultViewModel["Groups"] = sampleDataGroups;
     //var sampleDataGroups = SampleDataSource.GetGroups((String)navigationParameter);
     this.DefaultViewModel["Groups"] = sampleDataGroups.Take(5);
 }
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     //MedicalCenter art = e.NavigationParameter as MedicalCenter;
     //if (art != null)
     //{
     //    this.DataContext = art;
     //}
 }
        protected override async Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            if(this.View != null)
                this.View.GotFocus += View_GotFocus;

            this.AppCacheTask = new NotifyTaskCompletion<string>(Platform.Current.Storage.GetAppDataCacheFolderSizeAsync());

            await base.OnLoadStateAsync(e, isFirstRun);
        }
Esempio n. 9
0
        protected override async Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            if (isFirstRun)
            {
                await this.RefreshAsync();
            }

            await base.OnLoadStateAsync(e, isFirstRun);
        }
Esempio n. 10
0
 public void LoadState( object sender, LoadStateEventArgs e )
 {
     // Restore the previously saved state associated with this page
      //if ( e.PageState.ContainsKey( "SelectedItem" ) && itemsViewSource.View != null )
      //{
      //   // TODO: Invoke Me.itemsViewSource.View.MoveCurrentTo() with the selected
      //   //       item as specified by the value of pageState("SelectedItem")
      //}
 }
        protected override async Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            _loadState = e;
            await base.OnLoadStateAsync(e, isFirstRun);

            // Subsequent navigations to a page that uses a CollectionViewModelBase might already have an initialized page and thus not fire the appropriate 
            // event on the already loaded first view. This check is to manually pass the load state event to the current in focuse ViewModel.
            if (e.NavigationEventArgs.NavigationMode == NavigationMode.New && e.IsViewInitialized)
                await this.SetCurrentAsync(this.CurrentViewModel ?? this.ViewModels.FirstOrDefault());
        }
Esempio n. 12
0
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     var param = e.NavigationParameter as SettingPageNavigationParameter;
     if (param != null)
     {
         _xml = param.PillsXml;
         _periodCollection = new ObservableCollection<string>(DataHelper.GetPeriodsFromXml(_xml));
         PeriodsListView.ItemsSource = _periodCollection;
     }
 }
Esempio n. 13
0
        protected override async Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            if (isFirstRun)
            {
                if(this.ViewParameter is string && !this.ViewParameter.ToString().Equals(this.Item?.ID, StringComparison.CurrentCultureIgnoreCase))
                    await this.RefreshAsync();
            }

            await base.OnLoadStateAsync(e, isFirstRun);
        }
Esempio n. 14
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            string navigationParameter = e.NavigationParameter as string;

            if (navigationParameter != null && navigationParameter == "signout")
            {
                // Don't let the user go back if they've signed out
                Frame.BackStack.Clear();
            }

            SwitchToProgressState();
            MessageDialog dialog = null;

            try
            {
                bool authorized = await App.IsUserAuthenticated();

                if (!authorized)
                {
                    SwitchToSignInState();
                }
                else
                {
                    // Make sure the push channel is up to date
                    await App.InitNotificationsAsync();

                    // Go to the Inbox page
                    Frame.Navigate(typeof(InboxPage));
                }
            }
            catch (MobileServiceInvalidOperationException ex)
            {
                if (ex.Response.StatusCode == HttpStatusCode.NotFound)
                {
                    // Internet might be down
                    dialog = new MessageDialog("Can't connect, please check your internet connection");
                }
                else
                {
                    dialog = new MessageDialog("Unknown error");
                }
            }

            if (dialog != null)
            {
                await App.TryDeleteNotificationAsync();

                dialog.Commands.Add(new UICommand("Retry", (IUICommand) =>
                {
                    NavigationHelper_LoadState(sender, e);
                }));

                await dialog.ShowAsync();
            }
        }
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     cmbUserType.ItemsSource = UserTypeExtensions.GetUserTypes();
     cmbUserType.SelectedIndex = App.User.Type.AsInt();
     txtUsername.Text = App.User.Username;
     txtPassword.Password = App.User.Password;
     txtRepeatPassword.Password = App.User.Password;
     txtName.Text = App.User.Fullname;
     txtEmail.Text = App.User.Email;
     txtPhone.Text = App.User.PhoneNumber;
 }
Esempio n. 16
0
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     if (mainController == null)
     {
         mainController = new MainController(this);
         this.DataContext = mainController;
     }
     else
     {
         mainController.GoToFirstDay();
     }
 }
Esempio n. 17
0
        protected override Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            if (isFirstRun)
            {
            }

            // Watch for user auth changes to update the welcome message
            Platform.Current.AuthManager.UserAuthenticatedStatusChanged += AuthenticationManager_UserAuthenticated;

            // If the view parameter contains any navigation requests, forward on to the global navigation service
            if (e.NavigationEventArgs.NavigationMode == NavigationMode.New && e.Parameter is NavigationRequest)
                Platform.Current.Navigation.NavigateTo(e.Parameter as NavigationRequest);

            return base.OnLoadStateAsync(e, isFirstRun);
        }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="Common.NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {          
            var item = await DataSource.GetItemAsync((String)e.NavigationParameter);

            this.DefaultViewModel["Item"] = item;

            DataItem dataItem = (DataItem)item;
            if (dataItem.GroupType == GroupType.Person) pageTitle.Text = "Indigenous Servicemen Photo: " + item.UniqueId;
         
            if (string.IsNullOrWhiteSpace(item.Description))
                description.Visibility = Visibility.Collapsed;
            if (string.IsNullOrWhiteSpace(item.Content))
                content.Visibility = Visibility.Collapsed;

            ItemVideo.Visibility = dataItem.GroupType == GroupType.Video ? Visibility.Visible : Visibility.Collapsed;
            ItemImage.Visibility = dataItem.GroupType == GroupType.Video ? Visibility.Collapsed : Visibility.Visible;
            SetupMap(dataItem);
        }
Esempio n. 19
0
        /// <summary>
        /// Заполняет страницу содержимым, передаваемым в процессе навигации.  Также предоставляется любое сохраненное состояние
        /// при повторном создании страницы из предыдущего сеанса.
        /// </summary>
        /// <param name="sender">
        /// Источник события; как правило, <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Данные события, предоставляющие параметр навигации, который передается
        /// <see cref="Frame.Navigate(Type, Object)"/> при первоначальном запросе этой страницы и
        /// словарь состояний, сохраненных этой страницей в ходе предыдущего
        /// сеанса.  Это состояние будет равно NULL при первом посещении страницы.</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            EditPeriodPage_NavigationParameter param = e.NavigationParameter as EditPeriodPage_NavigationParameter;
            if (param != null)
            {
                PageTitleTextBox.Text = param.periodName;
                _pills = new ObservableCollection<Pill>(param.pills);
                PillsListView.ItemsSource = _pills;
            }

            var lastPage = Frame.ForwardStack.LastOrDefault();
            if (lastPage != null && lastPage.SourcePageType.Equals(typeof(NewPillPage)))
            {
                Pill newPill = NewPillPage.Pill;
                if (_pills == null) _pills = new ObservableCollection<Pill>();
                _pills.Add(newPill);
            }

        }
Esempio n. 20
0
        protected override async Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            if (e.NavigationEventArgs.NavigationMode == Windows.UI.Xaml.Navigation.NavigationMode.New)
            {
                string param = null;

                // Use any page parameters as the initial search query
                if (e.NavigationEventArgs.Parameter is string)
                    param = e.NavigationEventArgs.Parameter.ToString().Trim();

                if (this.SearchText != param)
                {
                    // Perform the search if there is a new search to perform
                    this.SearchText = param;
                    await this.RefreshAsync();
                }
            }

            await base.OnLoadStateAsync(e, isFirstRun);
        }
        private async void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var stack = Frame.GetNavigationState();

            if (!IsNetworkAvailable())
            {
                await new MessageDialog("Please check your internet connection!").ShowAsync();
            }

            var settings = new SettingsHelper();
            if (!settings.GetRememberMeFromSettings()) return;

            var username = settings.GetUsernameFromSettings();
            var password = settings.GetPasswordFromSettings();

            txtUsername.Text = username;
            txtPassword.Password = password;
            chkRemember.IsChecked = true;

            await Login(username, password, false);
        }
Esempio n. 22
0
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
 }
Esempio n. 23
0
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>.
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Create an appropriate data model for your problem domain to replace the sample data
 }
Esempio n. 24
0
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     this.accessTokenSource = (TaskCompletionSource <string>)e.NavigationParameter;
 }
Esempio n. 25
0
 /// <summary>
 /// Popola la pagina con il contenuto passato durante la navigazione.  Vengono inoltre forniti eventuali stati
 /// salvati durante la ricreazione di una pagina in una sessione precedente.
 /// </summary>
 /// <param name="sender">
 /// Origine dell'evento. In genere <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Dati evento che forniscono il parametro di navigazione passato a
 /// <see cref="Frame.Navigate(Type, Object)"/> quando la pagina è stata inizialmente richiesta e
 /// un dizionario di stato mantenuto da questa pagina nel corso di una sessione
 /// precedente.  Lo stato è null la prima volta che viene visitata una pagina.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     Description.Text = string.Format(Description.Text, getVersion());
 }
Esempio n. 26
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     var vm = (MainViewModel)this.DataContext;
     await vm.InitNewsAsync();
 }
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session. The state will be null the first time a page is visited.</param>
        private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            this.mode = ConnectionDataMode.Edit;

            string id = e.NavigationParameter as string;

            this.sshRadioButton.IsChecked = true;
            this.authenticationMethodComboBox.SelectedIndex = 0;
            PrivateKeysDataSource privateKeysDataSource = (PrivateKeysDataSource)App.Current.Resources["privateKeysDataSource"];

            if (privateKeysDataSource != null)
            {
                var privateKeys = from privateKey in privateKeysDataSource.PrivateKeys
                                  orderby privateKey.FileName
                                  select privateKey.FileName;
                this.privateKeyComboBox.ItemsSource = privateKeys;
            }

            if (id == null)
            {
                this.mode = ConnectionDataMode.QuickConnect;
                this.nameOptions.Visibility = Visibility.Collapsed;
            }
            else if (id.Length == 0)
            {
                this.mode = ConnectionDataMode.New;
            }
            else
            {
                ConnectionData connectionData = FavoritesDataSource.GetFavorite(id);
                if (connectionData == null)
                {
                    this.Frame.GoBack();
                    return;
                }

                this.nameTextBox.Text = connectionData.Name;
                switch (connectionData.Type)
                {
                case ConnectionType.Ssh:
                    this.sshRadioButton.IsChecked    = true;
                    this.telnetRadioButton.IsChecked = false;
                    break;

                case ConnectionType.Telnet:
                    this.sshRadioButton.IsChecked    = false;
                    this.telnetRadioButton.IsChecked = true;
                    break;
                }
                this.hostTextBox.Text     = connectionData.Host;
                this.portTextBox.Text     = connectionData.Port.ToString();
                this.usernameTextBox.Text = connectionData.Username;
                this.authenticationMethodComboBox.SelectedIndex  = (int)connectionData.Authentication;
                this.privateKeyComboBox.SelectedItem             = connectionData.PrivateKeyName;
                this.privateKeyAgentForwardingCheckBox.IsChecked = connectionData.PrivateKeyAgentForwarding;
                this.id = connectionData.Id;
            }

            this.SetupPageTitle();
            this.SetupAppBar();
        }
Esempio n. 28
0
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>.
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Create an appropriate data model for your problem domain to replace the sample data
     //var sampleDataGroup = await SampleDataSource.GetGroupAsync("Group-1");
     //ViewModel[FirstGroupName] = sampleDataGroup;
 }
Esempio n. 29
0
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // as soon as the use reaches the page, populate the UI by calling the web API
     GetTodoList();
 }
Esempio n. 30
0
 /// <summary>
 ///     使用在导航过程中传递的内容填充页。  在从以前的会话
 ///     重新创建页时,也会提供任何已保存状态。
 /// </summary>
 /// <param name="sender">
 ///     事件的来源; 通常为 <see cref="NavigationHelper" />
 /// </param>
 /// <param name="e">
 ///     事件数据,其中既提供在最初请求此页时传递给
 ///     <see cref=" Frame.Navigate1(Type, Object)" /> 的导航参数,又提供
 ///     此页在以前会话期间保留的状态的
 ///     字典。 首次访问页面时,该状态将为 null。
 /// </param>
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     defaultViewModel["user"] = user;
 }
Esempio n. 31
0
 /// <summary>
 /// Заполняет страницу содержимым, передаваемым в процессе навигации.  Также предоставляется любое сохраненное состояние
 /// при повторном создании страницы из предыдущего сеанса.
 /// </summary>
 /// <param name="sender">
 /// Источник события; как правило, <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Данные события, предоставляющие параметр навигации, который передается
 /// <see cref="Frame.Navigate(Type, Object)"/> при первоначальном запросе этой страницы и
 /// словарь состояний, сохраненных этой страницей в ходе предыдущего
 /// сеанса.  Это состояние будет равно NULL при первом посещении страницы.</param>
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Присвоить this.DefaultViewModel["Group"] связываемую группу
     // TODO: Присвоить this.DefaultViewModel["Items"] коллекцию связываемых элементов
 }
Esempio n. 32
0
 /// <summary>
 /// 反墓碑化处理
 /// </summary>
 internal abstract void NavigationHelper_LoadState(object sender, LoadStateEventArgs e);
Esempio n. 33
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     MapService.ServiceToken = "qZO7GwUqKeWcjJiEOva1qA​";
     MyMap.MapTapped        += myMap_MapTapped;
 }
Esempio n. 34
0
        public async void OnLoadState(object sender, LoadStateEventArgs e)
        {
            await this.DefaultViewModel.OnLoadState();

            prog1.IsActive = false;
        }
Esempio n. 35
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 public void OnLoadState(object sender, LoadStateEventArgs e)
 {
     Podcast = Data.GetPodcast((String)e.NavigationParameter);
     UpdateFields();
 }
Esempio n. 36
0
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     await(DataContext as ConvenienceViewModelBase).Load();
 }
Esempio n. 37
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var popup = new Popup();

            popup.Child = null;
            DefaultViewModel.ResetFlags();
            var currentSettings   = SettingsViewModel.Current;
            var currentDataSource = DataSourceFactory.Current;

            // This can happen when navigating back after creating a feed, sleep, change or measure
            // I.e. don't allow the user to return to the 'create' page for that item once it is created
            if (e.NavigationParameter != null &&
                string.Equals(Constants.NAVIGATION_PARAMETER_CLEARLASTBACKENTRY,
                              e.NavigationParameter.ToString(),
                              StringComparison.OrdinalIgnoreCase))
            {
                Frame.BackStack.RemoveAt(1);
            }

            // Set the default display units based on the user setting
            // Conversion of values between units is handled by the Model <-> ViewModel extensions
            DefaultViewModel.CurrentWeightUnit = currentSettings.UseMetricUnits
                                                        ? ResourceLoader.GetString(Constants.RESOURCEKEY_UNIT_WEIGHT_METRIC)
                                                        : ResourceLoader.GetString(Constants.RESOURCEKEY_UNIT_WEIGHT_IMPERIAL);
            DefaultViewModel.CurrentLengthUnit = currentSettings.UseMetricUnits
                                                        ? ResourceLoader.GetString(Constants.RESOURCEKEY_UNIT_LENGTH_METRIC)
                                                        : ResourceLoader.GetString(Constants.RESOURCEKEY_UNIT_LENGTH_IMPERIAL);

            await BackgroundTaskRegistrar.RegisterBackgroundTask(ResourceLoader.GetString(Constants.RESOURCEKEY_DIALOG_BACKGROUNDTASKSDISABLED));

            // Push any local changes, i.e. changes made while offline, to the server
            await currentDataSource.PushLocalChangesToServer();

            var babyId = await RetrieveMostRecentlyAccessedBaby(currentSettings, currentDataSource);

            DefaultViewModel.Babies.Add(CurrentBaby);

            // Retrieve the activity schedule for the current baby,
            // may have already been downloaded by the background task
            var currentBabiesSchedule = (await currentDataSource.GetActivitySchedule(babyId)).AsViewModel(currentSettings.UseMetricUnits,
                                                                                                          CurrentBaby.AsModel());

            DefaultViewModel.NextActivity = GetNextActivityFromSchedule(CurrentBaby, currentBabiesSchedule);

            RetrieveCurrentFeed(currentSettings, currentBabiesSchedule);
            RetrieveCurrentSleep(currentSettings, currentBabiesSchedule);

            DefaultViewModel.MainLoadingComplete = true;

            await RetrieveAllBabies(currentSettings, currentDataSource);

            await RetrieveLatestMeasurementsForCurrentBaby(currentSettings, currentDataSource, babyId);

            // Retrieve the status of the current baby
            if (currentBabiesSchedule.LastFeed != null)
            {
                DefaultViewModel.MostRecentActivities.Add(currentBabiesSchedule.LastFeed);
            }
            if (currentBabiesSchedule.LastSleep != null)
            {
                DefaultViewModel.MostRecentActivities.Add(currentBabiesSchedule.LastSleep);
            }
            if (currentBabiesSchedule.LastChange != null)
            {
                DefaultViewModel.MostRecentActivities.Add(currentBabiesSchedule.LastChange);
            }

            await RetrieveDataTrendsForCurrentBaby(currentDataSource, babyId);
        }
Esempio n. 38
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            bool failed       = false;
            var  errorMessage = string.Empty;

            try
            {
                prYuanwen.IsActive   = true;
                prYuanwen.Visibility = Visibility.Visible;
                lvYuanwen.Visibility = Visibility.Collapsed;

                var setting = new AppSettingsViewModel();
                if (setting != null)
                {
                    switch (setting.AudioSetting)
                    {
                    case "美音":
                        AudioType = Mp3Type.American;
                        break;

                    case "英音":
                        AudioType = Mp3Type.English;
                        break;

                    default:
                        AudioType = Mp3Type.American;
                        break;
                    }
                }

                bookTextKey = (string)e.NavigationParameter;

                var message = new ValueSet();
                message.Add("bookTextKey", bookTextKey);
                BackgroundMediaPlayer.SendMessageToBackground(message);

                var bookTextInfo = await GetBookTextDataSource.GetBookTextAsync(null, bookTextKey);

                this.DefaultViewModel["BookText"] = bookTextInfo;
                bookTitle = bookTextInfo.Value.Name;
                var sampleDataGroup =
                    await GetYuanWenListDataSource.GetYuanWenAsync(bookTextKey : bookTextKey);

                this.DefaultViewModel[FirstGroupName] = sampleDataGroup;

                var mp3file = await DownloadAudioFile();

                string[] fileInfo = new[] { bookTitle, mp3file, bookTextKey, "!autoplay" };
                message = new ValueSet
                {
                    {
                        "SetSource",
                        fileInfo
                    }
                };
                BackgroundMediaPlayer.SendMessageToBackground(message);
            }
            catch (Exception ex)
            {
                errorMessage = Helper.HandlerExceptionMessage(ex);
                failed       = true;
            }
            finally
            {
                prYuanwen.IsActive   = false;
                prYuanwen.Visibility = Visibility.Collapsed;
                lvYuanwen.Visibility = Visibility.Visible;
            }
            if (failed)
            {
                MessageDialog md2 = new MessageDialog(errorMessage, Constants.NETWORK_CONNECTION);
                await md2.ShowAsync();
            }
        }
Esempio n. 39
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     this.DefaultViewModel["Items"] = PCL.Model.MainViewModel.Current.Items;
     PCL.Model.MainViewModel.Current.FetchXMLFeed();
 }
Esempio n. 40
0
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>.
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Create an appropriate data model for your problem domain to replace the sample data
     var sampleDataGroup = await SampleDataSource.GetGroupAsync("Group-1");
     this.DefaultViewModel[FirstGroupName] = sampleDataGroup;
 }
Esempio n. 41
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            //try
            //DeleteButtonEd.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            activId = (int)e.NavigationParameter;
            FootballMatch Data = await DataSource.GetItemAsync((int)e.NavigationParameter);

            dataGroupsMatchPlayerTeam1 = new ObservableCollection <DataGroupMatchPlayers>();
            dataGroupsMatchPlayerTeam2 = new ObservableCollection <DataGroupMatchPlayers>();
            DataGroupMatchPlayers dp = null;

            loadingRectangle.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            foreach (Player pl in Data.team1_players)
            {
                dp = new DataGroupMatchPlayers(Data, Data.team1, pl);
                foreach (MatchPlayer mp in Data.matchPlayers)
                {
                    if (dp.player.id == mp.Player_idValue)
                    {
                        dp.matchPlayer = mp;
                        if (mp.objectStatus != (int)DataSource.status.Deleted && mp.objectStatus != (int)DataSource.status.needDelete)
                        {
                            dp.showProperties = true;
                        }
                    }
                }
                if (dp.matchPlayer.IdValue == -1)
                {
                    dp.matchPlayer.Match_idValue  = Data.id;
                    dp.matchPlayer.Player_idValue = pl.id;
                    dp.matchPlayer.Team_idValue   = Data.team1.id;
                    dp.matchPlayer.TeamsheetValue = 0;
                }
                dataGroupsMatchPlayerTeam1.Add(dp);
            }
            foreach (Player pl in Data.team2_players)
            {
                dp = new DataGroupMatchPlayers(Data, Data.team2, pl);
                foreach (MatchPlayer mp in Data.matchPlayers)
                {
                    if (dp.player.id == mp.Player_idValue)
                    {
                        dp.matchPlayer = mp;
                        if (mp.objectStatus != (int)DataSource.status.Deleted && mp.objectStatus != (int)DataSource.status.needDelete)
                        {
                            dp.showProperties = true;
                        }
                    }
                }
                if (dp.matchPlayer.IdValue == -1)
                {
                    dp.matchPlayer.Match_idValue  = Data.id;
                    dp.matchPlayer.Player_idValue = pl.id;
                    dp.matchPlayer.Team_idValue   = Data.team2.id;
                    dp.matchPlayer.TeamsheetValue = 0;
                }
                dataGroupsMatchPlayerTeam2.Add(dp);
            }

            this.DefaultViewModel["Match"] = Data;
            if (dataGroupsMatchPlayerTeam1.Count() > 0)
            {
                this.DefaultViewModel["Team1MatchPlayers"] = dataGroupsMatchPlayerTeam1;
            }
            if (dataGroupsMatchPlayerTeam2.Count() > 0)
            {
                this.DefaultViewModel["Team2MatchPlayers"] = dataGroupsMatchPlayerTeam2;
            }
            TeamComboBox.SelectedIndex = 0;
        }
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Assign a bindable group to this.DefaultViewModel["Group"]
     // TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"]
 }
        protected override Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            if (isFirstRun)
            {
            }

            this.CheckIfValid();

            return base.OnLoadStateAsync(e, isFirstRun);
        }
Esempio n. 44
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     this.DataContext = e.NavigationParameter as Results;
 }
Esempio n. 45
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            int Id   = (int)e.NavigationParameter;
            var Item = await RestaurantPageSource.GetRestaurantAsync(Id);

            this.ProgressRing.IsActive = false;

            if (Item == null)
            {
                if (Frame.CanGoBack)
                {
                    Frame.GoBack();

                    await ShowErrorAsync();
                }
                else
                {
                    if (!Frame.Navigate(typeof(MainPage), "FoodLook 2"))
                    {
                        throw new Exception();
                    }
                    Frame.BackStack.Clear();

                    await ShowErrorAsync();
                }
            }
            else
            {
                this.DefaultViewModel[Restaurant] = Item;
                this.DefaultViewModel[Label]      = Item.Label;

                LikeButtonToggle();
                FavoriteButtonToggle();

                this.RestaurantPageCommandBar.Visibility = Visibility.Visible;

                if (Item.Website == null)
                {
                    this.WebsiteBlock.Visibility = Visibility.Collapsed;
                }
                if (Item.Email == null)
                {
                    this.EmailBlock.Visibility = Visibility.Collapsed;
                }
                if (Item.Facebook == null)
                {
                    this.FacebookBlock.Visibility = Visibility.Collapsed;
                }
                if (Item.Instagram == null)
                {
                    this.InstagramBlock.Visibility = Visibility.Collapsed;
                }
                if (!Item.Parking)
                {
                    this.ParkingImage.Opacity = 0.4;
                }
                if (!Item.PaymentCards)
                {
                    this.PaymentCardsImage.Opacity = 0.4;
                }
                if (!Item.LiveMusic)
                {
                    this.LiveMusicImage.Opacity = 0.4;
                }
                if (Item.Telephone == null)
                {
                    this.PhoneButton.Visibility = Visibility.Collapsed;
                }

                this.RestaurantPagePivot.Visibility = Visibility.Visible;
            }
        }
Esempio n. 46
0
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Create an appropriate data model for your problem domain to replace the sample data
     //var sampleDataGroups = await SampleDataSource.GetGroupsAsync();
     //this.DefaultViewModel["Groups"] = sampleDataGroups;
 }
Esempio n. 47
0
        /// <summary>
        /// Gets the view model for this <see cref="Page"/>.
        /// This can be changed to a strongly typed view model.
        /// </summary>
        //public ObservableDictionary DefaultViewModel
        //{
        //    get { return this.defaultViewModel; }
        //}

        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>.
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            //var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);
            //this.DefaultViewModel["Item"] = item;
        }
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private void HandleNavigationHelperLoadState(Object sender, LoadStateEventArgs e)
        {
            var sampleDataGroups = AppSampleData.Current.SampleData.Groups;

            DefaultViewModel["Groups"] = sampleDataGroups;
        }
Esempio n. 49
0
 /// <summary>
 /// Füllt die Seite mit Inhalt auf, der bei der Navigation übergeben wird.  Gespeicherte Zustände werden ebenfalls
 /// bereitgestellt, wenn eine Seite aus einer vorherigen Sitzung neu erstellt wird.
 /// </summary>
 /// <param name="sender">
 /// Die Quelle des Ereignisses, normalerweise <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Ereignisdaten, die die Navigationsparameter bereitstellen, die an
 /// <see cref="Frame.Navigate(Type, object)"/> als diese Seite ursprünglich angefordert wurde und
 /// ein Wörterbuch des Zustands, der von dieser Seite während einer früheren
 /// beibehalten wurde.  Der Zustand ist beim ersten Aufrufen einer Seite NULL.</param>
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Ein geeignetes Datenmodell für die domänenspezifische Anforderung erstellen, um die Beispieldaten auszutauschen
     var item = await SampleDataSource.GetItemAsync((string)e.NavigationParameter);
     this.DefaultViewModel["Item"] = item;
 }
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
 }
Esempio n. 51
0
        /// <summary>
        ///使用在导航过程中传递的内容填充页。 在从以前的会话
        /// 重新创建页时,也会提供任何已保存状态。
        /// </summary>
        /// <param name="sender">
        /// 事件的来源; 通常为 <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">事件数据,其中既提供在最初请求此页时传递给
        /// <see cref="Frame.Navigate(Type, Object)"/> 的导航参数,又提供
        /// 此页在以前会话期间保留的状态的
        /// 的字典。 首次访问页面时,该状态将为 null。</param>
        private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)

        {
            Windows.Storage.ApplicationDataContainer roamingSettings =
                Windows.Storage.ApplicationData.Current.RoamingSettings;
            if (roamingSettings.Values.ContainsKey("fc_0"))
            {

                c3_0.Text = roamingSettings.Values["c3_0"].ToString();
                c2_0.Text = roamingSettings.Values["c2_0"].ToString();
                fa_0.Text = roamingSettings.Values["fa_0"].ToString();
                fb_0.Text = roamingSettings.Values["fb_0"].ToString();
                fc_0.Text = roamingSettings.Values["fc_0"].ToString();
                fd_0.Text = roamingSettings.Values["fd_0"].ToString();

                c3_2.Text = roamingSettings.Values["c3_2"].ToString();
                c2_2.Text = roamingSettings.Values["c2_2"].ToString();
                fa_2.Text = roamingSettings.Values["fa_2"].ToString();
                fb_2.Text = roamingSettings.Values["fb_2"].ToString();
                fc_2.Text = roamingSettings.Values["fc_2"].ToString();
                fd_2.Text = roamingSettings.Values["fd_2"].ToString();

                c3_1.Text = roamingSettings.Values["c3_1"].ToString();
                c2_1.Text = roamingSettings.Values["c2_1"].ToString();
                fa_1.Text = roamingSettings.Values["fa_1"].ToString();
                fb_1.Text = roamingSettings.Values["fb_1"].ToString();
                fc_1.Text = roamingSettings.Values["fc_1"].ToString();
                fd_1.Text = roamingSettings.Values["fd_1"].ToString();

            }
        }
Esempio n. 52
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     await RefreshUI();
 }
Esempio n. 53
0
        protected override async Task OnLoadStateAsync(LoadStateEventArgs e, bool isFirstRun)
        {
            if (isFirstRun)
            {
                if (this.ViewParameter is string && !this.ViewParameter.ToString().Equals(this.Item?.ID, StringComparison.CurrentCultureIgnoreCase))
                {
                    await this.RefreshAsync();

                    if (this.Item != null)
                    {
                        var jump = new Services.JumpItemInfo();
                        jump.Arguments = this.Item.ID;
                        jump.GroupName = Strings.Resources.TextRecent;
                        jump.Name = this.Item.Title;
                        jump.Logo = new Uri(this.Item.ImageThumbLandscapeSmall, UriKind.Absolute);
                        await Platform.Current.Jumplist.AddItemAsync(jump);
                    }
                }
            }

            await base.OnLoadStateAsync(e, isFirstRun);
        }
Esempio n. 54
0
        /// <summary>
        /// 使用在导航过程中传递的内容填充页。  在从以前的会话
        /// 重新创建页时,也会提供任何已保存状态。
        /// </summary>
        /// <param name="sender">
        /// 事件的来源; 通常为 <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">事件数据,其中既提供在最初请求此页时传递给
        /// <see cref="Frame.Navigate(Type, Object)"/> 的导航参数,又提供
        /// 此页在以前会话期间保留的状态的
        /// 字典。 首次访问页面时,该状态将为 null。</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            if (e.NavigationParameter == null)
            {
                return;
            }

            if (e.NavigationParameter.GetType().Equals(typeof(string)))
            {
                string CS = e.NavigationParameter.ToString();
                this.DefaultViewModel["CS"] = CS;

                //处理浏览器
                _htmltianqiV.Navigate(new Uri("ms-appx-web:///DataModel/dwhs/bwc_dwhs_listname.html"));
            }
            if (e.NavigationParameter.GetType().Equals(typeof(VoiceCommandActivatedEventArgs)))
            {
                VoiceCommandActivatedEventArgs commandArgs_thisone     = e.NavigationParameter as VoiceCommandActivatedEventArgs;
                SpeechRecognitionResult        speechRecognitionResult = commandArgs_thisone.Result;

                string voiceCommandName = speechRecognitionResult.RulePath[0];
                string textSpoken       = speechRecognitionResult.Text;
                string navigationTarget = speechRecognitionResult.SemanticInterpretation.Properties["NavigationTarget"][0];

                string key = textSpoken.Replace("换算", "").Replace("单位", "").Replace("器", "").Trim();
                string uk  = "bwc_dwhs_listname";
                if (key.IndexOf("长度") >= 0)
                {
                    uk = "bwc_dwhs_changdu";
                }
                if (key.IndexOf("重量") >= 0)
                {
                    uk = "bwc_dwhs_zhongliang";
                }
                if (key.IndexOf("面积") >= 0)
                {
                    uk = "bwc_dwhs_mianji";
                }
                if (key.IndexOf("体积") >= 0)
                {
                    uk = "bwc_dwhs_tiji";
                }
                if (key.IndexOf("温度") >= 0)
                {
                    uk = "bwc_dwhs_wendu";
                }
                if (key.IndexOf("压力") >= 0)
                {
                    uk = "bwc_dwhs_yali";
                }
                if (key.IndexOf("能量") >= 0)
                {
                    uk = "bwc_dwhs_nengliang";
                }
                if (key.IndexOf("功率") >= 0)
                {
                    uk = "bwc_dwhs_gonglv";
                }
                _htmltianqiV.Navigate(new Uri("ms-appx-web:///DataModel/dwhs/" + uk + ".html"));
            }
        }
Esempio n. 55
0
 /// <summary>
 /// Füllt die Seite mit Inhalt auf, der bei der Navigation übergeben wird.  Gespeicherte Zustände werden ebenfalls
 /// bereitgestellt, wenn eine Seite aus einer vorherigen Sitzung neu erstellt wird.
 /// </summary>
 /// <param name="sender">
 /// Die Quelle des Ereignisses, normalerweise <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Ereignisdaten, die die Navigationsparameter bereitstellen, die an
 /// <see cref="Frame.Navigate(Type, object)"/> als diese Seite ursprünglich angefordert wurde und
 /// ein Wörterbuch des Zustands, der von dieser Seite während einer früheren
 /// beibehalten wurde.  Der Zustand ist beim ersten Aufrufen einer Seite NULL.</param>
 private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Ein geeignetes Datenmodell für die domänenspezifische Anforderung erstellen, um die Beispieldaten auszutauschen
     var sampleDataGroups = await SampleDataSource.GetGroupsAsync();
     this.DefaultViewModel["Groups"] = sampleDataGroups;
 }
Esempio n. 56
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     Windows.Graphics.Display.DisplayInformation.AutoRotationPreferences = Windows.Graphics.Display.DisplayOrientations.Landscape;
     var noawait = Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
 }
Esempio n. 57
0
 /// <summary>
 /// Populates the page with content passed during navigation. Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session. The state will be null the first time a page is visited.</param>
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     InitPlayToManager();
 }
Esempio n. 58
0
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     SetFontSize();
     MakeList();
 }
 private void navigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     // TODO: Assign a collection of bindable groups to this.DefaultViewModel["Groups"]
 }
Esempio n. 60
0
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     user_name = e.NavigationParameter.ToString();
     user_name_txtblock.Text = "Hello " + user_name.ToUpper();
 }