コード例 #1
0
        /// <summary>
        /// Creates a new instance of the subscriber.
        /// </summary>
        /// <returns>New <see cref="FeedSubscription"/></returns>
        /// <remarks>
        /// This is called when the user is adding a new subscription and clicks the 'Save' button.
        /// </remarks>
        public override DestinationBase Create()
        {
            FeedSubscription fs = new FeedSubscription(this.textBoxName.Text, this.textBoxUrl.Text, Convert.ToInt32(this.comboBoxPoll.SelectedValue), this.textBoxUsername.Text, this.textBoxPassword.Text, true);

            fs.Subscribe();
            return(fs);
        }
コード例 #2
0
        /// <summary>
        /// Initializes the configuration UI when a subscription is being added or edited.
        /// </summary>
        /// <param name="isSubscription">will always be <c>true</c> for <see cref="Subscription"/>s</param>
        /// <param name="dli">The <see cref="DestinationListItem"/> that the user selected</param>
        /// <param name="db">The <see cref="DestinationBase"/> of the item if it is being edited;<c>null</c> otherwise</param>
        /// <remarks>
        /// When an instance is being edited (<paramref name="dli"/> != null), make sure to repopulate any
        /// inputs with the current values.
        ///
        /// By default, the 'Save' button is disabled and you must call <see cref="DestinationSettingsPanel.OnValidChanged"/>
        /// in order to enable it when appropriate.
        /// </remarks>
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase db)
        {
            this.doValidation = true;

            // set text box values
            this.textBoxUrl.Text     = String.Empty;
            this.textBoxUrl.Enabled  = true;
            this.textBoxName.Text    = String.Empty;
            this.textBoxName.Enabled = true;

            this.comboBoxPoll.DataSource    = PollInterval.GetList();
            this.comboBoxPoll.DisplayMember = "Display";
            this.comboBoxPoll.ValueMember   = "Value";

            this.textBoxUsername.Text    = String.Empty;
            this.textBoxUsername.Enabled = true;
            this.textBoxPassword.Text    = String.Empty;
            this.textBoxPassword.Enabled = true;

            FeedSubscription fs = db as FeedSubscription;

            if (fs != null)
            {
                this.textBoxUrl.Text            = fs.FeedUrl;
                this.textBoxName.Text           = fs.Description;
                this.comboBoxPoll.SelectedValue = fs.PollInterval;
                this.textBoxUsername.Text       = fs.Username;
                this.textBoxPassword.Text       = fs.Password;
            }
            ValidateInputs();

            this.textBoxName.Focus();
        }
コード例 #3
0
        /// <summary>
        /// Updates the specified subscription instance.
        /// </summary>
        /// <param name="db">The <see cref="FeedSubscription"/> to update</param>
        /// <remarks>
        /// This is called when a user is editing an existing subscription and clicks the 'Save' button.
        /// </remarks>
        public override void Update(DestinationBase db)
        {
            FeedSubscription fs = db as FeedSubscription;

            if (fs != null)
            {
                fs.UpdateConfiguration(this.textBoxName.Text, this.textBoxUrl.Text, Convert.ToInt32(this.comboBoxPoll.SelectedValue), this.textBoxUsername.Text, this.textBoxPassword.Text);
            }
        }
コード例 #4
0
        public override DestinationBase Clone()
        {
            FeedSubscription clone = new FeedSubscription(this.Description, this.FeedUrl, this.PollInterval, this.Username, this.Password, this.Enabled);

            return(clone);
        }
コード例 #5
0
 public override DestinationBase Clone()
 {
     FeedSubscription clone = new FeedSubscription(this.Description, this.FeedUrl, this.PollInterval, this.Username, this.Password, this.Enabled);
     return clone;
 }
コード例 #6
0
 /// <summary>
 /// Creates a new instance of the subscriber.
 /// </summary>
 /// <returns>New <see cref="FeedSubscription"/></returns>
 /// <remarks>
 /// This is called when the user is adding a new subscription and clicks the 'Save' button.
 /// </remarks>
 public override DestinationBase Create()
 {
     FeedSubscription fs = new FeedSubscription(this.textBoxName.Text, this.textBoxUrl.Text, Convert.ToInt32(this.comboBoxPoll.SelectedValue), this.textBoxUsername.Text, this.textBoxPassword.Text, true);
     fs.Subscribe();
     return fs;
 }