Example #1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            lblOfflineMode.Visibility = ApplicationState.Current.IsOffline ? Visibility.Visible : Visibility.Collapsed;
            StateHelper helper = new StateHelper(State);

            pivot.SelectedIndex = helper.GetValue("PivotItem", 0);
            allPageIndex        = helper.GetValue("AllPageIndex", 0);
            allItemsCount       = helper.GetValue("AllItemsCount", 0);
            allCriteria         = helper.GetValue <WorkoutPlanSearchCriteria>("AllCriteria", null);
            //allPlans = helper.GetValue("AllPlans", new ObservableCollection<WorkoutPlanViewModel>());
            allPlans = PagesState.Current.SearchedPlans ?? new ObservableCollection <WorkoutPlanViewModel>();
            lstAllPlans.ItemsSource = null;
            lstAllPlans.ItemsSource = allPlans;

            buildApplicationBar();
            if (viewModel == null || !ApplicationState.Current.Cache.TrainingPlans.IsLoaded)
            {
                lstMessages.ItemsSource  = null;
                lstFavorites.ItemsSource = null;
                viewModel   = new WorkoutPlansViewModel();
                DataContext = viewModel;

                viewModel.WorkoutPlansLoaded += new EventHandler(_viewModel_PlansLoaded);
                progressBar.ShowProgress(true, ApplicationStrings.WorkoutPlans_ProgressRetrievingPlans, false);
            }

            viewModel.LoadPlans();

            this.RestoreState();  // <- second line
        }
Example #2
0
        public void Restore(IDictionary <string, object> state)
        {
            StateHelper helper = new StateHelper(state);

            txtComment.Text            = helper.GetValue <string>("AddBlogCommentControl_Text", string.Empty);
            txtComment.SelectionStart  = helper.GetValue <int>("AddBlogCommentControl_SelectionStart", 0);
            txtComment.SelectionLength = helper.GetValue("AddBlogCommentControl_SelectionLength", 0);
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            //fillToday();
            buildApplicationBar();
            StateHelper stateHelper = new StateHelper(this.State);

            SelectedDate = stateHelper.GetValue("SelectedDate", SelectedDate);
            dayCtrl.Fill(SelectedDate);
            pivot.Title = SelectedDate.ToLongDateString();

            if (ApplicationState.Current.CurrentBrowsingTrainingDays.TrainingDays.ContainsKey(SelectedDate))
            {
                var info = ApplicationState.Current.CurrentBrowsingTrainingDays.TrainingDays[SelectedDate];

                viewModel      = new TrainingDayViewModel(info.TrainingDay);
                SelectedDayDTO = info.TrainingDay;
                viewModel.BlogCommentsLoaded += (s, a) =>
                {
                    progressBar.ShowProgress(false);
                    updateApplicationBarButtons();
                };
            }
            else
            {
                viewModel = new TrainingDayViewModel(null);
            }

            viewModel.Restore(State);
            DataContext = viewModel;
        }
Example #4
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.RestoreState();  // <- second line

            StateHelper helper = new StateHelper(State);

            if (Country == null)
            {
                Country = helper.GetValue <Country>("Country", null);
            }

            if (picture == null)
            {
                profileImage.Fill(Photo);
            }
            else
            {
                profileImage.Source = picture;
            }
            fillNotifications(ApplicationState.Current.EditProfileInfo.Settings);
            viewModel = new ProfileViewModel(ApplicationState.Current.EditProfileInfo);
            if (Country != null)
            {
                viewModel.Country = Country;
            }
            DataContext = viewModel;
            sizesCtrl.Fill(ApplicationState.Current.EditProfileInfo.Wymiary, null);
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            //lblOfflineMode1.Visibility = ApplicationState.Current.IsOffline ? Visibility.Visible : Visibility.Collapsed;
            //lblOfflineMode.Visibility =  lblOfflineMode2.Visibility = ApplicationState.Current.IsOffline && !SelectedPlan.IsContentLoaded ? Visibility.Visible : Visibility.Collapsed;

            viewModel         = new WorkoutPlanViewModel(SelectedPlan);
            viewModel.Loaded += (a, b) =>
            {
                progressBar.ShowProgress(false);
                updateApplicationBar();
            };
            DataContext = viewModel;

            StateHelper stateHelper = new StateHelper(this.State);
            var         pivotItem   = stateHelper.GetValue <int>("PivotSelectedTab", 0);

            if (pivotItem != 2)
            {//bug fixing. with 4 pivot items when we want to restore index 2 we have exception
                pivot.SelectedIndex = pivotItem;
            }
            this.RestoreState();  // <- second line
            votesControl.Restore(State);

            updateApplicationBar();
            loadComments();
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            var message = new MessageDTO();

            StateHelper stateHelper = new StateHelper(this.State);

            Receiver                      = stateHelper.GetValue("Receiver", Receiver);
            Topic                         = stateHelper.GetValue("Topic", Topic);
            message.Content               = stateHelper.GetValue("Content", string.Empty);
            message.Priority              = (MessagePriority)stateHelper.GetValue("Priority", 0);
            message.Topic                 = Topic;
            message.Receiver              = Receiver;
            viewModel                     = new MessageViewModel(message);
            viewModel.OperationCompleted += new EventHandler <OperationCompletedEventArgs>(viewModel_OperationCompleted);
            DataContext                   = viewModel;
            base.OnNavigatedTo(e);
        }
Example #7
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            StateHelper helper = new StateHelper(State);

            if (Country == null)
            {
                Country = helper.GetValue <Country>("Country", null);
            }
            if (viewModel == null)
            {
                viewModel = helper.GetValue("ViewModel", new CreateProfileViewModel());
            }
            viewModel.Country = Country;
            DataContext       = viewModel;

            //this.RestoreState();
        }
Example #8
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            StateHelper stateHelper = new StateHelper(this.State);

            User        = stateHelper.GetValue("User", User);
            viewModel   = new StatisticsViewModel(User);
            DataContext = viewModel;
        }
Example #9
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            //this.RestoreState();
            StateHelper helper = new StateHelper(State);

            Item        = helper.GetValue("Exercise", Item);
            DataContext = new VotingViewModel(Item);
        }
        public void RestoreState(IDictionary <string, object> state)
        {
            StateHelper helper = new StateHelper(state);

            if (helper.GetValue <bool>("StatusDlg", false))
            {
                showChangeStatusDlg(true, state);
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            StateHelper stateHelper = new StateHelper(this.State);
            var         item        = stateHelper.GetValue <DateTime>("CalendarCurrentDate", DateTime.Now);

            fillCalendar(item.MonthDate());
        }
Example #12
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            DataContext = this;
            //buildApplicationBar();
            StateHelper helper = new StateHelper(State);

            pivot.SelectedIndex = helper.GetValue("PivotItem", 0);
            loadCustomers();
            base.OnNavigatedTo(e);
        }
Example #13
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            lblOfflineMode.Visibility = ApplicationState.Current.IsOffline ? Visibility.Visible : Visibility.Collapsed;
            //if (viewModel == null)
            {
                viewModel   = new PeopleViewModel();
                DataContext = viewModel;
            }
            buildApplicationBar();
            StateHelper helper = new StateHelper(State);

            pivot.SelectedIndex  = helper.GetValue("PivotItem", 0);
            allPageIndex         = helper.GetValue("AllPageIndex", 0);
            allItemsCount        = helper.GetValue("AllItemsCount", 0);
            allCriteria          = helper.GetValue <UserSearchCriteria>("AllCriteria", null);
            allUsers             = helper.GetValue("AllUsers", new ObservableCollection <UserViewModel>());
            lstUsers.ItemsSource = allUsers;
            base.OnNavigatedTo(e);
        }
Example #14
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            StateHelper stateHelper = new StateHelper(this.State);
            var         pivotItem   = stateHelper.GetValue <int>("Position", -1);

            position = pivotItem;

            enusureRssFeed();
            base.OnNavigatedTo(e);
        }
Example #15
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            StateHelper stateHelper = new StateHelper(this.State);
            var         item        = stateHelper.GetValue <Guid>("SelectedItemId", Guid.Empty);
            var         comment     = stateHelper.GetValue <string>("CommentText", null);

            if (item != Guid.Empty && (CommentableObject == null || CommentableObject.InstanceId == item))
            {
                //todo:StrengthWorkout here?
                CommentableObject = (ICommentable)Entry.GetItem(item);

                if (comment != null)
                {
                    CommentableObject.Comment = comment;
                }
            }

            DataContext = this;
        }
Example #16
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            StateHelper stateHelper = new StateHelper(this.State);
            var         item        = stateHelper.GetValue <Guid>("SelectedItemId", Guid.Empty);
            var         comment     = stateHelper.GetValue <string>("CommentText", null);

            if (item != Guid.Empty && (CommentableObject == null || CommentableObject.InstanceId == item))
            {
                //CommentableObject = (ICommentable)ApplicationState.Current.TrainingDay.TrainingDay.StrengthWorkout.GetItem(item);
                CommentableObject = (ICommentable)Entry.GetItem(item);

                if (comment != null)
                {
                    CommentableObject.Comment = comment;
                }
            }
            ctrlTimer.IsStarted = EditMode && ApplicationState.Current.IsTimerEnabled;
            DataContext         = this;
        }
Example #17
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            StateHelper stateHelper = new StateHelper(this.State);

            var startTimer = stateHelper.GetValue <bool>("TimerEnabled", false);

            if (startTimer)
            {
                updateTime();
                StartTimer(false);
            }
            ctrlTimer.IsStarted = ApplicationState.Current.TrainingDay.TrainingDay.IsMine && ApplicationState.Current.IsTimerEnabled;
            var item = stateHelper.GetValue <Guid>("SelectedSetId", Guid.Empty);

            if (item != Guid.Empty && (SelectedSet == null || SelectedSet.InstanceId == item))
            {
                //SelectedSet = ApplicationState.Current.TrainingDay.TrainingDay.StrengthWorkout.GetSet(item);
                SelectedSet = Entry.GetSet(item);
            }
            SelectedSetView = CreateViewModel(SelectedSet);
            DataContext     = SelectedSetView;
        }
Example #18
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            //updateOfflineModeGui();
            viewModel = new CustomerViewModel(SelectedCustomer);
            //viewModel.OperationCompleted += new EventHandler(viewModel_OperationCompleted);
            DataContext = viewModel;
            sizesCtrl.Fill(viewModel.Wymiary, null);
            StateHelper stateHelper = new StateHelper(this.State);
            var         pivotItem   = stateHelper.GetValue <int>("PivotSelectedTab", 0);

            pivot.SelectedIndex = pivotItem;

            base.OnNavigatedTo(e);
        }
Example #19
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            string strGlobalId = NavigationContext.QueryString["GlobalId"];

            viewModel     = new TrainingPlanEntryViewModel(ApplicationState.Current.CurrentTrainingPlan.GetEntry(new Guid(strGlobalId)));
            lblTitle.Text = viewModel.Exercise.Name;
            DataContext   = viewModel;

            StateHelper stateHelper = new StateHelper(this.State);
            var         pivotItem   = stateHelper.GetValue <int>("PivotSelectedTab", 0);

            pivot.SelectedIndex = pivotItem;
        }
Example #20
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (ApplicationState.Current.TrainingDay != null)
            {
                show(false);
            }
            buildApplicationBar();
            if (pivot != null)
            {
                StateHelper stateHelper = new StateHelper(this.State);
                var         pivotItem   = stateHelper.GetValue <int>("PivotSelectedTab", 0);
                pivot.SelectedIndex = pivotItem;
            }
        }
Example #21
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            StateHelper stateHelper = new StateHelper(this.State);
            var         item        = stateHelper.GetValue <Guid>("SelectedItemId", Guid.Empty);

            if (item != Guid.Empty && (SelectedItem == null || SelectedItem.InstanceId == item))
            {
                //SelectedItem = ApplicationState.Current.TrainingDay.TrainingDay.Supplements.GetItem(item);
                SelectedItem = Entry.GetItem(item);
            }

            viewModel   = new SupplementItemViewModel(SelectedItem);
            DataContext = viewModel;
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            updateOfflineModeGui();

            ApplicationState.Current.CurrentBrowsingTrainingDays = new TrainingDaysHolder(SelectedUser);
            viewModel = new UserViewModel(SelectedUser);
            viewModel.OperationCompleted += new EventHandler(viewModel_OperationCompleted);
            DataContext = viewModel;
            sizesCtrl.Fill(viewModel.Wymiary, null);
            awardsCtrl.User = viewModel.User;
            StateHelper stateHelper = new StateHelper(this.State);
            var         pivotItem   = stateHelper.GetValue <int>("PivotSelectedTab", 0);

            pivot.SelectedIndex = pivotItem;

            base.OnNavigatedTo(e);
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            buildApplicationBar();
            this.RestoreState();  // <- second line
            string pageIdString;
            int    pageId = 0;

            if (NavigationContext.QueryString.TryGetValue("Page", out pageIdString))
            {
                int.TryParse(pageIdString, out pageId);
            }
            StateHelper stateHelper = new StateHelper(this.State);
            var         pivotItem   = stateHelper.GetValue <int>("PivotSelectedTab", pageId);

            pivot.SelectedIndex = pivotItem;

            fill();
        }
Example #24
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            StateHelper stateHelper = new StateHelper(this.State);
            var         item        = stateHelper.GetValue <Guid>("SelectedItemId", Guid.Empty);

            if (item != Guid.Empty && (SelectedItem == null || SelectedItem.InstanceId == item))
            {
                //SelectedItem = ApplicationState.Current.TrainingDay.TrainingDay.StrengthWorkout.GetStrengthTrainingItem(item);
                SelectedItem = Entry.GetStrengthTrainingItem(item);
            }
            fill();

            base.OnNavigatedTo(e);

            if (SelectedExercise != null)
            {//join exercise in superset
                SelectedItemView.JoinExercise(SelectedExercise.GlobalId);
                SelectedExercise = null;
            }
            ctrlTimer.IsStarted = EditMode && ApplicationState.Current.IsTimerEnabled;
        }