private void VioletPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (VioletPicker == null)
                return;

            string subscriptionName = "";
            if (VioletPicker.SelectedIndex == 0)
                subscriptionName = PolicyKit.MyStream;
            else if (VioletPicker.SelectedIndex == 1)
                subscriptionName = PolicyKit.FavouriteStream;
            else if (VioletPicker.SelectedIndex == 2)
                subscriptionName = PolicyKit.DiscoveryStream;

            if (subscriptionName != PolicyKit.VioletPageSubscription)
            {
                PolicyKit.VioletPageSubscription = subscriptionName;
                PolicyChangedEventArgs policyArgs = new PolicyChangedEventArgs();
                policyArgs.PolicyName = "VioletPageSubscription";
                PolicyKit.SaveSettings();
                PolicyKit.PolicyChanged.DispatchEvent(this, policyArgs);
            }
        }
Esempio n. 2
0
        private void OnSubscriptionSettingsClick(object sender, EventArgs e)
        {
            var settingsView = new SubscriptionSettingsView();
            settingsDialog = ModalPopup.Show(settingsView, AppResources.MainPageSubscriptionTitleText, new List<string> {AppResources.GenericConfirmText, AppResources.GenericCancelText });
            settingsDialog.DismissWithButtonClick += (s, args) =>
            {
                int buttonIndex = (args as ModalPopupEventArgs).ButtonIndex;
                if (buttonIndex == 0)
                {
                    string subscriptionName = "";
                    if (settingsView.MyStreamButton.IsChecked == true)
                        subscriptionName = PolicyKit.MyStream;
                    else if (settingsView.DiscoveryStreamButton.IsChecked == true)
                        subscriptionName = PolicyKit.DiscoveryStream;
                    else if (settingsView.FavouriteStreamButton.IsChecked == true)
                        subscriptionName = PolicyKit.FavouriteStream;

                    if (subscriptionName != PolicyKit.VioletPageSubscription)
                    {
                        PolicyKit.VioletPageSubscription = subscriptionName;
                        PolicyChangedEventArgs policyArgs = new PolicyChangedEventArgs();
                        policyArgs.PolicyName = "VioletPageSubscription";
                        PolicyKit.SaveSettings();
                        PolicyKit.PolicyChanged.DispatchEvent(this, policyArgs);
                    }
                }

                settingsDialog = null;
            };
        }
        private void OnPolicyChanged(object sender, PolicyChangedEventArgs e)
        {
            if (e.PolicyName != "VioletPageSubscription")
                return;

            ReloadStreams();
        }