Пример #1
0
        //Confirm button
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            if (!InternetAvailability.IsAvailable())
            {
                MessageBox.Show("Error! No internet connection");
                return;
            }

            SyndicationFeed feed = null;

            if (!RSSFeed.TryParseFeed(inputURL.Text, out feed))
            {
                MessageBox.Show("Error! Invalid feed URL");
                return;
            }

            int update = 0;

            int.TryParse(UpdatePeriod.Text, out update);
            if (update <= 0)
            {
                MessageBox.Show("Error! Invalid update period");
                return;
            }

            // determine channel
            Channel parent = null;

            if (Groups.SelectedIndex > 0)
            {
                parent = Groups.SelectedItem as Channel;
            }

            // begin creation/modification
            if (originalFeed == null)
            {
                main.CreateFeed(inputAlias.Text, feed.Title.Text, inputURL.Text, update, parent);
            }
            else
            {
                main.ModifyFeed(originalFeed, inputAlias.Text, feed.Title.Text, inputURL.Text, update, parent);
            }
            Close();
        }