public FavoritePage()
        {
            InitializeComponent();
            Model = App.Main;

            Model.LiveUpdateList.Clear();

            foreach (var item in Model.FavoriteChannels)
                Model.LiveUpdateList.Add(item);
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Model = App.Main;
            SelectedItem = e.Parameter as ChannelItem;

            DefaultViewModel.Add("Model", Model);
            DefaultViewModel.Add("Channel", SelectedItem);

            UpdatePlayStatus();
            UpdateChannelStatus();
        }
Пример #3
0
        public MainPage()
        {
            InitializeComponent();

            // Main model
            Model = App.Main;
            Model.PropertyChanged += Model_PropertyChanged;

            // Load saved settings
            ToggleShuffle.IsChecked = (bool?)ApplicationData.Current.RoamingSettings.Values["ShuffleChannels"];
            var showLogin = ApplicationData.Current.LocalSettings.Values["ShowMainLogin"] as bool?;
            if (!showLogin.HasValue && Model.ListenKey == null) LoginFeature.Visibility = Visibility.Visible;
            ButtonLogin.Visibility = Model.ListenKey == null ? Visibility.Visible : Visibility.Collapsed;
        }
        public AccountPage()
        {
            InitializeComponent();

            Model = App.Main;

            bool isSignedIn = Model.ListenKey != null;

            if (isSignedIn)
            {
                if (ApplicationData.Current.LocalSettings.Values["AccountEmail"] != null)
                {
                    TextEmail.Text = ApplicationData.Current.LocalSettings.Values["AccountEmail"].ToString();
                }

                if (ApplicationData.Current.LocalSettings.Values["FullName"] != null)
                {
                    TextFullName.Text = ApplicationData.Current.LocalSettings.Values["FullName"].ToString();
                }

                TextIsPremium.Text = Model.IsPremium ? "Yes, premium experience" : "No, free experience";

                Stack1.Visibility = Visibility.Visible;
                Stack2.Visibility = Visibility.Collapsed;
            }
            else
            {
                Stack2.Visibility = Visibility.Visible;
                Stack1.Visibility = Visibility.Collapsed;
            }

            var streams = Model.IsPremium ? ChannelsHelper.PremiumStreamFormats : ChannelsHelper.FreeStreamFormats;
            ComboFormats.ItemsSource = streams;

            if (ApplicationData.Current.LocalSettings.Values["StreamFormat"] != null)
            {
                ComboFormats.SelectedItem = streams.FirstOrDefault(i => i[1] == ApplicationData.Current.LocalSettings.Values["StreamFormat"].ToString());
            }
            else
            {
                ComboFormats.SelectedIndex = 0;
            }
        }