示例#1
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            base.OnNavigatedFrom(e);

            LifeCycleViewModel.OnViewHidden();
            UnsubscribeFromMessages();
        }
示例#2
0
 public override void ViewDidDisappear(bool animated)
 {
     Mvx.TaggedTrace(MvxTraceLevel.Diagnostic, LogTag, "ViewDidDisappear - Start");
     base.ViewDidDisappear(animated);
     LifeCycleViewModel.OnViewHidden();
     UnsubscribeFromMessages();
 }
示例#3
0
 protected virtual void OnBackButtonPressed(object sender, BackRequestedEventArgs e)
 {
     if (!e.Handled && Frame.CanGoBack)
     {
         LifeCycleViewModel.OnViewClosed();
         e.Handled = true;
     }
 }
示例#4
0
        protected override void OnPause()
        {
            Mvx.TaggedTrace(MvxTraceLevel.Diagnostic, LogTag, "OnPause - Start");
            base.OnPause();

            LifeCycleViewModel.OnViewHidden();
            UnsubscribeFromMessages();
        }
示例#5
0
 protected override void OnResume()
 {
     Mvx.TaggedTrace(MvxTraceLevel.Diagnostic, LogTag, "OnResume - Start");
     base.OnResume();
     if (!Subscribed)
     {
         SubscribeToMessages();
     }
     LifeCycleViewModel?.OnViewShown(_navigationMode);
     _navigationMode = CoreNavigationMode.Back;
 }
示例#6
0
        public override void ViewWillAppear(bool animated)
        {
            Mvx.TaggedTrace(MvxTraceLevel.Diagnostic, LogTag, "ViewWillAppear - Start");
            base.ViewWillAppear(animated);

            if (!Subscribed)
            {
                SubscribeToMessages();
            }
            LifeCycleViewModel?.OnViewShown(navigationMode);
            navigationMode = CoreNavigationMode.Back;
        }
示例#7
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            DataContext = null;
            DataContext = ViewModel;
            if (!Subscribed)
            {
                SubscribeToMessages();
            }

            LifeCycleViewModel.OnViewShown((CoreNavigationMode)e.NavigationMode);
        }
示例#8
0
        private string GetCycleInterval(LifeCycleViewModel viewModel, int cycle)
        {
            var result = viewModel.Cycles.FirstOrDefault(x => x.Cycle == cycle);

            if (result == null)
            {
                return("");
            }
            if (cycle == 3)
            {
                return(result.PeriodFloor + " - ...");
            }
            else
            {
                return(result.PeriodFloor + " - " + result.PeriodCeiling);
            }
        }
示例#9
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            DataContext = null;
            DataContext = ViewModel;

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = Frame.CanGoBack
                ? AppViewBackButtonVisibility.Visible
                : AppViewBackButtonVisibility.Collapsed;

            if (!Subscribed)
            {
                SubscribeToMessages();
            }

            LifeCycleViewModel.OnViewShown((CoreNavigationMode)e.NavigationMode);
        }
示例#10
0
        private void SetViewModelToUI(LifeCycleViewModel viewModel)
        {
            lblLifeWayNumberValue.Text = GetLifeWayNumberValue(viewModel);
            var cycle1 = GetCycle(viewModel, 1);

            if (cycle1.IsSelected)
            {
                lblCycleOne.ForeColor           = Color.Red;
                lblCycleOneInterval.ForeColor   = Color.Red;
                lblCycleOneMonthValue.Text      = cycle1.Number.ToString();
                lblCycleOneMonthValue.ForeColor = Color.Red;
                lblCycleOneMonthValue.Tag       = cycle1;//??
            }
            else
            {
                lblCycleOne.ForeColor           = Color.Black;
                lblCycleOneInterval.ForeColor   = Color.Black;
                lblCycleOneMonthValue.Text      = "";
                lblCycleOneMonthValue.ForeColor = Color.Black;
                lblCycleOneMonthValue.Tag       = null;
            }
            lblCycleOneInterval.Text = GetCycleInterval(viewModel, 1);

            var cycle2 = GetCycle(viewModel, 2);

            if (cycle2.IsSelected)
            {
                lblCycleTwo.ForeColor          = Color.Red;
                lblCycleTwoInterval.ForeColor  = Color.Red;
                lblCycleTwoDateValue.Text      = cycle2.Number.ToString();
                lblCycleTwoDateValue.ForeColor = Color.Red;
                lblCycleTwoDateValue.Tag       = cycle2;
            }
            else
            {
                lblCycleTwo.ForeColor          = Color.Black;
                lblCycleTwoInterval.ForeColor  = Color.Black;
                lblCycleTwoDateValue.Text      = "";
                lblCycleTwoDateValue.ForeColor = Color.Black;
                lblCycleTwoDateValue.Tag       = null;
            }
            lblCycleTwoInterval.Text = GetCycleInterval(viewModel, 2);

            var cycle3 = GetCycle(viewModel, 3);

            if (cycle3.IsSelected)
            {
                lblCycleThree.ForeColor          = Color.Red;
                lblCycleThreeInterval.ForeColor  = Color.Red;
                lblCycleThreeYearValue.Text      = cycle3.Number.ToString();
                lblCycleThreeYearValue.ForeColor = Color.Red;
                lblCycleThreeYearValue.Tag       = cycle3;
            }
            else
            {
                lblCycleThree.ForeColor          = Color.Black;
                lblCycleThreeInterval.ForeColor  = Color.Black;
                lblCycleThreeYearValue.Text      = "";
                lblCycleThreeYearValue.ForeColor = Color.Black;
                lblCycleThreeYearValue.Tag       = null;
            }
            lblCycleThreeInterval.Text = GetCycleInterval(viewModel, 3);
        }
示例#11
0
 private LifeCycleTagObject GetCycle(LifeCycleViewModel viewModel, int cycle)
 {
     return(viewModel.Cycles.FirstOrDefault(x => x.Cycle == cycle && x.IsMaster == viewModel.IsMaster));
 }
示例#12
0
 private string GetLifeWayNumberValue(LifeCycleViewModel viewModel)
 {
     return(viewModel.LifeWayNumber + (viewModel.IsMaster ? " - " + viewModel.MasterLifeWayNumber + "/" + viewModel.LifeWayNumber : ""));
 }