public MainPageVMState GetState() { var state = new MainPageVMState(); if (AllChannelList != null) { state.Channels = AllChannelList.ToList(); state.SelectedIndex = AllChannelList.IndexOf(SelectedChannel); } return(state); }
public void SetState(MainPageVMState state) { IsChannelListLoading = true; if (state.Channels != null) { AllChannelList = new ObservableCollection <Services.Channel>(state.Channels); } IsChannelListLoading = false; if (state.SelectedIndex != null) { try { SelectedChannel = AllChannelList?[state.SelectedIndex.Value]; } catch (ArgumentOutOfRangeException) { SelectedChannel = null; } } }