private void SwitchPage(MonitorPage targetPage)
        {
            CurrentPage = targetPage;

            switch (targetPage)
            {
            case MonitorPage.Data:
            {
                FramePageDisplay.Content = _DataPage;
                ButtonRefresh.IsEnabled  = true;
                ButtonSettings.IsEnabled = true;

                if (_DataPage.DataTime != DateTime.MinValue)
                {
                    LabelPageTitle.Content = "Data on " + UTCToLocal(
                        _DataPage.DataTime).ToString("dd/MM/yyyy 'at' HH:mm", null);
                }
                else
                {
                    LabelPageTitle.Content = "No Data";
                }
                break;
            }

            case MonitorPage.Settings:
            {
                SettingsPage settingsPage = new SettingsPage();
                settingsPage.SettingsCheckStarted   += SettingsPage_SettingsCheckStarted;
                settingsPage.SettingsCheckCompleted += SettingsPage_SettingsCheckCompleted;
                settingsPage.ExitButtonClicked      += SettingsPage_ExitButtonClicked;
                settingsPage.SettingsDismissed      += SettingsPage_SettingsDismissed;

                FramePageDisplay.Content = settingsPage;
                ButtonRefresh.IsEnabled  = false;
                ButtonSettings.IsEnabled = false;
                LabelPageTitle.Content   = "Settings";
                break;
            }

            default: break;
            }

            if (Properties.Settings.Default.DataEndpoint == null)
            {
                ButtonMore.IsEnabled = false;
            }
            else
            {
                ButtonMore.IsEnabled = true;
            }
        }
Example #2
0
        public void Interface_SwitchPage(MonitorPage pages)
        {
            if (currentPage == pages)
            {
                return;
            }
            //disappear
            var sb             = new Storyboard();
            var animationClose = new DoubleAnimation();

            animationClose.From     = 1;
            animationClose.To       = 0;
            animationClose.Duration = new Duration(TimeSpan.FromMilliseconds(300));
            //set target and restore z index
            switch (currentPage)
            {
            case MonitorPage.Welcome:
                Storyboard.SetTarget(animationClose, this.uiPageWelcome);
                Panel.SetZIndex(this.uiPageWelcome, -1);
                break;

            case MonitorPage.Timer:
                Storyboard.SetTarget(animationClose, this.uiPageTimer);
                Panel.SetZIndex(this.uiPageTimer, -1);
                break;

            case MonitorPage.Participant:
                Storyboard.SetTarget(animationClose, this.uiPageParticipant);
                Panel.SetZIndex(this.uiPageParticipant, -1);
                break;

            case MonitorPage.MapPool:
                Storyboard.SetTarget(animationClose, this.uiPageMapPool);
                Panel.SetZIndex(this.uiPageMapPool, -1);
                break;

            case MonitorPage.Grouping:
                Storyboard.SetTarget(animationClose, this.uiPageGrouping);
                Panel.SetZIndex(this.uiPageGrouping, -1);
                break;

            case MonitorPage.MapPicker:
                Storyboard.SetTarget(animationClose, this.uiPageMapPicker);
                Panel.SetZIndex(this.uiPageMapPicker, -1);
                break;

            case MonitorPage.Competition:
                Storyboard.SetTarget(animationClose, this.uiPageCompetition);
                Panel.SetZIndex(this.uiPageCompetition, -1);
                break;

            default:
                break;
            }
            Storyboard.SetTargetProperty(animationClose, new PropertyPath("Opacity"));
            sb.Children.Add(animationClose);

            //appear
            var animationShow = new DoubleAnimation();

            animationShow.From     = 0;
            animationShow.To       = 1;
            animationShow.Duration = new Duration(TimeSpan.FromMilliseconds(300));
            switch (pages)
            {
            case MonitorPage.Welcome:
                Storyboard.SetTarget(animationShow, this.uiPageWelcome);
                Panel.SetZIndex(this.uiPageWelcome, 1);
                break;

            case MonitorPage.Timer:
                Storyboard.SetTarget(animationShow, this.uiPageTimer);
                Panel.SetZIndex(this.uiPageTimer, 1);
                break;

            case MonitorPage.Participant:
                Storyboard.SetTarget(animationShow, this.uiPageParticipant);
                Panel.SetZIndex(this.uiPageParticipant, 1);
                break;

            case MonitorPage.MapPool:
                Storyboard.SetTarget(animationShow, this.uiPageMapPool);
                Panel.SetZIndex(this.uiPageMapPool, 1);
                break;

            case MonitorPage.Grouping:
                Storyboard.SetTarget(animationShow, this.uiPageGrouping);
                Panel.SetZIndex(this.uiPageGrouping, 1);
                break;

            case MonitorPage.MapPicker:
                Storyboard.SetTarget(animationShow, this.uiPageMapPicker);
                Panel.SetZIndex(this.uiPageMapPicker, 1);
                break;

            case MonitorPage.Competition:
                Storyboard.SetTarget(animationShow, this.uiPageCompetition);
                Panel.SetZIndex(this.uiPageCompetition, 1);
                break;

            default:
                break;
            }
            Storyboard.SetTargetProperty(animationShow, new PropertyPath("Opacity"));
            sb.Children.Add(animationShow);

            sb.Begin();
            currentPage = pages;
        }