Пример #1
0
 public static MainPageState MainPageLoaded(MainPageState state, MainPageLoaded action)
 {
     return(new MainPageState
     {
         TopPosts = action.TopPosts
     });
 }
        public void LoadState(MainPageState state)
        {
            if (null != state.Stations)
            {
                _stations.AddRange(state.Stations);
            }
            if (null != state.Tracks)
            {
                _playList.AddRange(state.Tracks);
            }
            if (null != state.CurrentStationId)
            {
                // Set the backing field to avoid running the logic in the setter, property is manually notified
                _selectedStation = Stations.FirstOrDefault(s => s.Id == state.CurrentStationId.Value);
                RaisePropertyChanged(SelectedStationPropertyName);
            }

            if (null != state.CurrentTrackRadioPosition)
            {
                // LoadState happens before the window is available, thus we cannot access Player. Therefore set the backing field only.
                // The current track (if any) is loaded into the Player in AttachPlayerEvents
                _currentTrack = _playList.FirstOrDefault(t => t.RadioPosition == state.CurrentTrackRadioPosition.Value);
                RaisePropertyChanged(CurrentTrackPropertyName);
            }
        }
Пример #3
0
 /// <summary>
 /// Access state information for the page
 /// </summary>
 /// <param name="navigationParameter">Parameter passsed in Navigate request; here it's a lat/long pair</param>
 /// <param name="pageState">Saved page state</param>
 protected override void LoadState(Object navigationParameter, Dictionary <String, Object> pageState)
 {
     // Restore page state
     if ((pageState != null) && (pageState.ContainsKey("MainPageState")))
     {
         _pageState = pageState["MainPageState"] as MainPageState;
     }
 }
Пример #4
0
        public MainPageState SaveState()
        {
            var state = new MainPageState()
            {
                HostName   = this.HostName,
                PortNumber = this.PortNumber
            };

            return(state);
        }
Пример #5
0
        public void ShowOverlay(UserControl plugin)
        {
            if ((plugin != null) && (plugin is IOverlayPlugin) && (PageState == MainPageState.Root))
            {
                Overlay.Child = plugin;
                PageState     = MainPageState.Overlay;

                ThreadHelper.Sync(() => ((IOverlayPlugin)plugin).SignalStart());
            }
        }
Пример #6
0
        public void LoadState(MainPageState state)
        {
            if (!String.IsNullOrWhiteSpace(state.SearchText))
            {
                SearchText = state.SearchText;
            }

            _selectedSearchHistoryItemFromState = state.SelectedSearchHistoryItem;
            _selectedDownloadFromState          = state.SelectedDownload;
        }
Пример #7
0
        public void LoadState(MainPageState state)
        {
            if (!String.IsNullOrWhiteSpace(state.HostName))
            {
                HostName = state.HostName;
            }

            if (!String.IsNullOrWhiteSpace(state.PortNumber))
            {
                PortNumber = state.PortNumber;
            }
        }
Пример #8
0
        /// <summary>
        /// Update the selections from the main application page current settings
        /// </summary>
        internal static void SyncStateToMainPageState()
        {
            if (ApplicationState.CategoryPageInformation == null)
            {
                ApplicationState.CategoryPageInformation       = new CategoryPageState();
                ApplicationState.CategoryPageInformation.Apply = false;
            }
            MainPageState m = ApplicationState.MainPageInformation;

            ApplicationState.CategoryPageInformation.
            UpdateNames(m.Category, m.SourceUnitName, m.TargetUnitName);
        }
        public MainPage()
        {
            InitializeComponent();

            const int width  = 680;
            const int height = 340;

            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(width, height));
            ApplicationView.PreferredLaunchViewSize      = new Size(width, height);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            _state = new MainPageState();
            sbPupilInitial.Begin();
        }
Пример #10
0
        public void HideOverlay()
        {
            if (PageState == MainPageState.Overlay)
            {
                IOverlayPlugin ctrl = OverlayPlugin;

                if (ctrl != null)
                {
                    ctrl.SignalClosure();
                }

                PageState     = MainPageState.Root;
                Overlay.Child = null;
            }
        }
Пример #11
0
 public static MainPageState ReduceMainPageState(MainPageState state, IAction action)
 {
     if (action is NotConnectedAction)
     {
         return(NotConnected(state, (NotConnectedAction)action));
     }
     if (action is MainPageLoading)
     {
         return(MainPageLoading(state, (MainPageLoading)action));
     }
     if (action is MainPageLoaded)
     {
         return(MainPageLoaded(state, (MainPageLoaded)action));
     }
     return(state);
 }
Пример #12
0
        public MainPageState SaveState()
        {
            var state = new MainPageState()
            {
                SearchText = this.SearchText,
            };

            if (null != SelectedSearchHistory)
            {
                state.SelectedSearchHistoryItem = SelectedSearchHistory.Id;
            }

            if (null != SelectedDownload)
            {
                state.SelectedDownload = SelectedDownload.Id;
            }

            return(state);
        }
Пример #13
0
 public static MainPageState NotConnected(MainPageState state, NotConnectedAction action)
 {
     state.ShowNotConnected = true;
     return(state);
 }
Пример #14
0
 public static MainPageState MainPageLoading(MainPageState state, MainPageLoading action)
 {
     state.IsLoading = true;
     return(state);
 }
 /// <summary>
 /// Access state information for the page
 /// </summary>
 /// <param name="navigationParameter">Parameter passsed in Navigate request; here it's a lat/long pair</param>
 /// <param name="pageState">Saved page state</param>
 protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
 {
     // Restore page state
     if ((pageState != null) && (pageState.ContainsKey("MainPageState")))
     {
         _pageState = pageState["MainPageState"] as MainPageState;
     }
 }