public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            _getHumans = (bool)e.Parameter;
            await GetFirstUsersPage();
        }
Exemplo n.º 2
0
 public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
 {
     base.OnNavigatedTo(e, viewModelState);
     this.UserId      = (long)e.Parameter;
     this.User.Value  = new UserItem(await this.TwitterClient.GetUser(this.UserId));
     this.TwitterClient.RefreshUserTweetItems(this.NavigationService, this.UserId);
 }
Exemplo n.º 3
0
        public override void OnNavigatedTo(NavigatedToEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.JoinedGroupList = this.CurrentUser.JoinedGroupList;
            this.ManagedGroupList = this.CurrentUser.ManagedGroupList;
        }
        public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            Contacts = null;
            _contactsCount = await OfficeService.GetContactsCount();
            await GetFirstPage();
        }
        /// <summary>
        /// Handles the Navigated event of the Frame control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NavigatedToEventArgs"/> instance containing the event data.</param>
        private void OnFrameNavigatedTo(object sender, NavigatedToEventArgs e)
        {
            // Update the page type and parameter of the last navigation
            _sessionStateService.SessionState[LastNavigationPageKey]      = _frame.Content.GetType().FullName;
            _sessionStateService.SessionState[LastNavigationParameterKey] = e.Parameter;

            NavigateToCurrentViewModel(e);
        }
        public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            if (e.NavigationMode == NavigationMode.New)
            {
                SelectedDate = DateTimeOffset.Now.Date;
            }

            await GetEventsForSelectedDate();
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.UserID = (long)e.Parameter;

            if (e.NavigationMode == Windows.UI.Xaml.Navigation.NavigationMode.New)
            {
                this.InitData();
            }
        }
Exemplo n.º 8
0
        private void OnFrameNavigatedTo(object sender, NavigationEventArgs e)
        {
            if (_navigatedToEventHandlers.Count > 0)
            {
                var args = new NavigatedToEventArgs(e);

                foreach (var handler in _navigatedToEventHandlers)
                {
                    handler(this, args);
                }
            }
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e)
        {
            var topicID = (long)e.Parameter;
            this.TopicID = topicID;

            base.OnNavigatedTo(e);

            if (e.NavigationMode == Windows.UI.Xaml.Navigation.NavigationMode.New)
            {
                this.LoadTopic();
                this.LoadComments();
            }
        }
        public override async void OnNavigatedTo(NavigatedToEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.GroupID = (long)e.Parameter;

            if (e.NavigationMode == NavigationMode.New)
            {
                this.LoadGroup();
                this.GroupTopicsViewModel = new RefreshableViewModel<Topic>(this.LoadTopics, 30);
                this.GroupUsersViewModel = new RefreshableViewModel<User>(this.LoadUsers, 100);
            }
        }
Exemplo n.º 11
0
        public void OnNavigatedTo_With_RestorableStateAttribute()
        {
            var viewModelState = new Dictionary<string, object>();
            viewModelState.Add("Title", "MyMock");
            viewModelState.Add("Description", "MyDescription");

            var vm = new MockViewModelWithRestorableStateAttributes();

            NavigatedToEventArgs args = new NavigatedToEventArgs();
            args.NavigationMode = NavigationMode.Back;

            vm.OnNavigatedTo(args, viewModelState);

            Assert.AreEqual(vm.Title, viewModelState["Title"]);
            Assert.AreEqual(vm.Description, viewModelState["Description"]);
        }
        public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            _meeting = JsonConvert.DeserializeObject<Meeting>((string)e.Parameter);

            MeetingTimeCandidates = new ObservableCollection<MeetingTimeCandidate>();

            using (new Loading(this))
            {
                var items = await GetTimeCandidates("8:00:00", "11:00:00");

                items = items.Union(await GetTimeCandidates("11:00:00", "15:00:00"));
                items = items.Union(await GetTimeCandidates("15:00:00", "18:00:00"));

                items.ForEach(x => MeetingTimeCandidates.Add(x));
            }
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            if (e.NavigationMode == NavigationMode.New)
            {
                var tuple = Deserialize<Tuple<EventMessage, string, string>>((string)e.Parameter);

                Message = tuple.Item1;
                _action = tuple.Item2.ToLower();
                Comment = tuple.Item3;

                _mailHasBeenSent = false;

                IsContentText = Message.Body.ContentType.EqualsCaseInsensitive("text");

                PopulateRecipients();
            }
        }
Exemplo n.º 14
0
        public void OnNavigatedTo_With_No_RestorableStateAttributes()
        {
            var viewModelState = new Dictionary<string, object>();
            viewModelState.Add("Title", "MyMock");
            viewModelState.Add("Description", "MyDescription");

            var viewState = new Dictionary<string, object>();
            viewState.Add("Tests.Mocks.MockViewModelWithNoResumableStateAttributes1", viewModelState);

            var vm = new MockViewModelWithNoRestorableStateAttributes();

            NavigatedToEventArgs args = new NavigatedToEventArgs();
            args.NavigationMode = NavigationMode.Back;

            vm.OnNavigatedTo(args, viewState);

            Assert.IsNull(vm.Title);
            Assert.IsNull(vm.Description);
        }
        /// <summary>
        /// This method is triggered after navigating to a view model. It is used to load the view model state that was saved previously.
        /// </summary>
        /// <param name="e">The <see cref="NavigatedToEventArgs"/> instance containing the event data.</param>
        private void NavigateToCurrentViewModel(NavigatedToEventArgs e)
        {
            var frameState   = _sessionStateService.GetSessionStateForFrame(_frame);
            var viewModelKey = "ViewModel-" + _frame.BackStackDepth;

            if (e.NavigationMode == NavigationMode.New)
            {
                // Clear existing state for forward navigation when adding a new page/view model to the
                // navigation stack
                var nextViewModelKey   = viewModelKey;
                int nextViewModelIndex = _frame.BackStackDepth;
                while (frameState.Remove(nextViewModelKey))
                {
                    nextViewModelIndex++;
                    nextViewModelKey = "ViewModel-" + nextViewModelIndex;
                }
            }

            var newView = _frame.Content as FrameworkElement;

            if (newView == null)
            {
                return;
            }
            var newViewModel = newView.DataContext as INavigationAware;

            if (newViewModel != null)
            {
                Dictionary <string, object> viewModelState;
                if (frameState.ContainsKey(viewModelKey))
                {
                    viewModelState = frameState[viewModelKey] as Dictionary <string, object>;
                }
                else
                {
                    viewModelState = new Dictionary <string, object>();
                }
                newViewModel.OnNavigatedTo(e, viewModelState);
                frameState[viewModelKey] = viewModelState;
            }
        }
Exemplo n.º 16
0
 public void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
 {
    // throw new NotImplementedException();
 }
 public void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewState)
 {
     OnNavigatedToDelegate(e.Parameter, e.NavigationMode, viewState);
 }
Exemplo n.º 18
0
        private void OnFrameNavigatedTo(object sender, NavigationEventArgs e)
        {
            if (_navigatedToEventHandlers.Count > 0)
            {
                var args = new NavigatedToEventArgs(e);

                foreach (var handler in _navigatedToEventHandlers)
                    handler(this, args);
            }
        }
        //public ICalendarControlViewModel CalendarControlViewModel
        //{
        //    get { return _calendarControlViewModel; }
        //}

        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
//            CalendarControlViewModel.OnNavigatedTo(e, viewModelState);
        }
Exemplo n.º 20
0
        public override void OnNavigatedTo(NavigatedToEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.Keywords = e.Parameter as string;
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            if (e.NavigationMode != NavigationMode.Back)
            {
                base.OnNavigatedTo(e, viewModelState);
            }

            if (e.NavigationMode == NavigationMode.New)
            {
                Meeting = Deserialize<Meeting>((string)e.Parameter);
            }

            Populate();
        }
Exemplo n.º 22
0
        /// <summary>
        /// This method is triggered after navigating to a view model. It is used to load the view model state that was saved previously.
        /// </summary>
        /// <param name="e">The <see cref="NavigatedToEventArgs"/> instance containing the event data.</param>
        private void NavigateToCurrentViewModel(NavigatedToEventArgs e)
        {
            var frameState = _sessionStateService.GetSessionStateForFrame(_frame);
            var viewModelKey = "ViewModel-" + _frame.BackStackDepth;

            if (e.NavigationMode == NavigationMode.New)
            {
                // Clear existing state for forward navigation when adding a new page/view model to the
                // navigation stack
                var nextViewModelKey = viewModelKey;
                int nextViewModelIndex = _frame.BackStackDepth;
                while (frameState.Remove(nextViewModelKey))
                {
                    nextViewModelIndex++;
                    nextViewModelKey = "ViewModel-" + nextViewModelIndex;
                }
            }

            var newView = _frame.Content as FrameworkElement;
            if (newView == null) return;
            var newViewModel = newView.DataContext as INavigationAware;
            if (newViewModel != null)
            {
                Dictionary<string, object> viewModelState;
                if (frameState.ContainsKey(viewModelKey))
                {
                    viewModelState = frameState[viewModelKey] as Dictionary<string, object>;
                }
                else
                {
                    viewModelState = new Dictionary<string, object>();
                }
                newViewModel.OnNavigatedTo(e, viewModelState);
                frameState[viewModelKey] = viewModelState;
            }
        }
Exemplo n.º 23
0
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            this.Article = e.Parameter as Article;
        }
Exemplo n.º 24
0
        public void OnNavigatedTo_With_RestorableStateCollection()
        {
            var childViewModelState = new Dictionary<string, object>();
            childViewModelState.Add("Title", "MyChildMock");
            childViewModelState.Add("Description", "MyChildDescription");

            var viewModelState = new Dictionary<string, object>();
            viewModelState.Add("Tests.Mocks.MockViewModelWithResumableStateCollection1", childViewModelState);

            var viewState = new Dictionary<string, object>();
            viewState.Add("MyEntityId", viewModelState);

            var vm = new MockViewModelWithRestorableStateCollection()
            {
                ChildViewModels = new List<BindableBase>()
                {
                    new MockViewModelWithRestorableStateAttributes
                    {
                        Title = "MyChildMock",
                        Description = "MyChildDescription"
                    }
                }
            };
            NavigatedToEventArgs args = new NavigatedToEventArgs();
            args.NavigationMode = NavigationMode.Back;

            vm.OnNavigatedTo(args, viewState);

            var childViewModel = (MockViewModelWithRestorableStateAttributes)vm.ChildViewModels.FirstOrDefault();

            Assert.AreEqual(childViewModel.Title, childViewModelState["Title"]);
            Assert.AreEqual(childViewModel.Description, childViewModelState["Description"]);
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            LoginUrl = _authenticationService.LoginUrl;
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            _recurrence = JsonConvert.DeserializeObject<Meeting.EventRecurrence>((string)e.Parameter);

            PopulatePatternViews();

            switch (_recurrence.Range.Type.ToLower())
            {
                case OData.NoEnd:    IsNoEnd = true; break;
                case OData.Numbered: IsNumbered = true; break;
                case OData.EndDate:  IsEndBy = true; break;
            }

            StartDate = DateTimeOffset.Parse(_recurrence.Range.StartDate);
            EndDate = DateTime.Parse(_recurrence.Range.EndDate);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Handles the Navigated event of the Frame control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="NavigatedToEventArgs"/> instance containing the event data.</param>
        private void OnFrameNavigatedTo(object sender, NavigatedToEventArgs e)
        {
            // Update the page type and parameter of the last navigation
            _sessionStateService.SessionState[LastNavigationPageKey] = _frame.Content.GetType().FullName;
            _sessionStateService.SessionState[LastNavigationParameterKey] = e.Parameter;

            NavigateToCurrentViewModel(e);
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e, Dictionary<string, object> viewModelState)
        {
            base.OnNavigatedTo(e, viewModelState);

            if (e.NavigationMode == NavigationMode.New)
            {
                if (e.Parameter != null)
                {
                    _meeting = Deserialize<Meeting>(e.Parameter);
                }
                else
                {
                    _meeting = CreateNewMeeting();
                }
            }

            if (IsSerial)
            {
                RecurrenceDate = DateTimeUtils.BuildRecurrentDate(_meeting.Recurrence);
            }

            PopulateAttendees();
        }
Exemplo n.º 29
0
        private void RootFrame_Navigated(object sender, MtNavigationEventArgs e)
        {
            var ui = e.Content as FrameworkElement;
            if (ui == null)
            {
                return;
            }
            var vm = ui.DataContext as NavigationViewModelBase;
            if (vm == null)
            {
                return;
            }

            var args = new NavigatedToEventArgs
            {
                NavigationMode = e.NavigationMode,
                Parameter = e.Parameter
            };

            vm.OnNavigatedTo(args);
        }
        public override void OnNavigatedTo(NavigatedToEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.GroupID = Convert.ToInt64(e.Parameter);
        }