コード例 #1
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();
        }
コード例 #2
0
        private void BonjourListBox_MouseClick(object sender, MouseEventArgs e)

        {
            /* we cant use any of the this.Selected* properites because we are using the MultiSimple selection mode
             *
             * instead, we have to determine which item was clicked on directly
             *
             * */



            int i = 0;

            if (e.Y > 0)

            {
                i = e.Y / this.ItemHeight;

                i += this.TopIndex;

                if (this.Items.Count > i)

                {
                    DestinationListItem fli = (DestinationListItem)this.Items[i];

                    fli.Select();
                }
            }
        }
コード例 #3
0
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase db)
        {
            FolderWatchSubscription sub = db as FolderWatchSubscription;

            if (sub != null)
            {
                this.textBoxPath.Text = sub.Path;
                this.checkBoxSubdirectories.Checked = sub.IncludeSubfolders;
            }
        }
コード例 #4
0
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase fd)
        {
            this.doValidation = true;

            this.comboBoxMinimumPriority.Items.Add(new PriorityChoice(null));
            Array priorities = Enum.GetValues(typeof(Growl.Connector.Priority));

            Array.Sort(priorities, new PrioritySortComparer());
            foreach (Growl.Connector.Priority priority in priorities)
            {
                this.comboBoxMinimumPriority.Items.Add(new PriorityChoice(priority));
            }
            this.comboBoxQuietDays.Items.Add(ToastyForwardDestination.QuietHoursDayChoice.Everyday);
            this.comboBoxQuietDays.Items.Add(ToastyForwardDestination.QuietHoursDayChoice.Weekdays);
            this.comboBoxQuietDays.Items.Add(ToastyForwardDestination.QuietHoursDayChoice.Weekends);

            // set initial values
            this.textBoxDescription.Text               = String.Empty;
            this.textBoxDescription.Enabled            = true;
            this.textBoxDeviceID.Text                  = String.Empty;
            this.textBoxDeviceID.Enabled               = true;
            this.comboBoxMinimumPriority.SelectedIndex = 0;
            this.comboBoxMinimumPriority.Enabled       = true;
            this.comboBoxQuietDays.SelectedIndex       = 0;

            ToastyForwardDestination tfd = fd as ToastyForwardDestination;

            if (tfd != null)
            {
                this.textBoxDescription.Text = tfd.Description;
                this.textBoxDeviceID.Text    = tfd.DeviceID;
                if (tfd.MinimumPriority != null && tfd.MinimumPriority.HasValue)
                {
                    foreach (object item in this.comboBoxMinimumPriority.Items)
                    {
                        PriorityChoice pc = (PriorityChoice)item;
                        if (pc.Priority == tfd.MinimumPriority)
                        {
                            this.comboBoxMinimumPriority.SelectedItem = item;
                        }
                    }
                }
                this.checkBoxOnlyWhenIdle.Checked   = tfd.OnlyWhenIdle;
                this.checkBoxQuietHours.Checked     = tfd.EnableQuietHours;
                this.comboBoxQuietDays.SelectedItem = tfd.QuietHoursDaysChoice;
                this.dateTimePickerStart.Value      = tfd.QuietHoursStart;
                this.dateTimePickerEnd.Value        = tfd.QuietHoursEnd;
            }

            ValidateInputs();

            this.textBoxDescription.Focus();
        }
コード例 #5
0
        /// <summary>
        /// Initializes the configuration UI when a forwarder is being added or edited.
        /// </summary>
        /// <param name="isSubscription">will always be <c>false</c> for <see cref="ForwardDestination"/>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 dli, DestinationBase db)
        {
            // set text box values
            serverText.Text    = "";
            serverText.Enabled = true;

            XbmcDestination xbmc = db as XbmcDestination;

            if (xbmc != null)
            {
                serverText.Text = xbmc.Server;
            }

            ValidateInputs();

            serverText.Focus();
        }
コード例 #6
0
        void BonjourListBox_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }

            if (this.Items != null && this.Items.Count > 0)
            {
                object obj = this.Items[e.Index];

                // handle background
                if ((e.State & DrawItemState.Selected) != 0)
                {
                    e.Graphics.FillRectangle(Brushes.LightGray, e.Bounds);
                    //ControlPaint.DrawFocusRectangle(e.Graphics, e.Bounds);
                }
                else
                {
                    e.DrawBackground();
                }

                string text = obj.ToString();
                int    newX = e.Bounds.X;
                DestinationListItem item = obj as DestinationListItem;
                if (item != null)
                {
                    if (item.Image != null)
                    {
                        e.Graphics.DrawImage(item.Image, e.Bounds.X + 1, e.Bounds.Y + 1, IMAGE_SIZE, IMAGE_SIZE);
                    }
                    newX = e.Bounds.Left + IMAGE_SIZE + this.Margin.Right;

                    text = Utility.GetResourceString(item.Text);
                }

                // handle text
                Rectangle       rect  = new Rectangle(newX, e.Bounds.Y, e.Bounds.Right - newX, e.Bounds.Height);
                TextFormatFlags flags = TextFormatFlags.EndEllipsis | TextFormatFlags.NoClipping | TextFormatFlags.VerticalCenter;
                TextRenderer.DrawText(e.Graphics, text, e.Font, rect, this.foreColor, flags);
            }
        }
コード例 #7
0
        /// <summary>
        /// Initializes the configuration UI when a webhook is being added or edited.
        /// </summary>
        /// <param name="isSubscription">will always be <c>false</c> for <see cref="ForwardDestination"/>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 dli, DestinationBase db)
        {
            // set text box values
            this.textBoxName.Text    = String.Empty;
            this.textBoxName.Enabled = true;
            this.textBoxUrl.Text     = String.Empty;
            this.textBoxUrl.Enabled  = true;

            WebhookDestination whd = db as WebhookDestination;

            if (whd != null)
            {
                this.textBoxName.Text = whd.Description;
                this.textBoxUrl.Text  = whd.Url;
            }

            ValidateInputs();

            this.textBoxName.Focus();
        }
コード例 #8
0
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase fd)
        {
            this.doValidation = true;

            this.panelSMTPSettings.Visible = false;

            PrefPriority[] priorityChoices = PrefPriority.GetList(false);
            this.comboBoxMinimumPriority.Items.Add(Properties.Resources.AddProwl_AnyPriority);
            for (int i = 0; i < priorityChoices.Length; i++)
            {
                this.comboBoxMinimumPriority.Items.Add(priorityChoices[i]);
            }
            this.comboBoxMinimumPriority.SelectedIndex = 0;

            // set text box values
            this.textBoxDescription.Text               = String.Empty;
            this.textBoxDescription.Enabled            = true;
            this.textBoxUsername.Text                  = String.Empty;
            this.textBoxUsername.Enabled               = true;
            this.comboBoxMinimumPriority.SelectedIndex = 0;
            this.comboBoxMinimumPriority.Enabled       = true;

            EmailForwardDestination efd = fd as EmailForwardDestination;

            if (efd != null)
            {
                this.textBoxDescription.Text = efd.Description;
                this.textBoxUsername.Text    = efd.To;
                if (efd.MinimumPriority != null && efd.MinimumPriority.HasValue)
                {
                    this.comboBoxMinimumPriority.SelectedItem = PrefPriority.GetByValue(efd.MinimumPriority.Value);
                }
                this.checkBoxOnlyWhenIdle.Checked = efd.OnlyWhenIdle;
                this.smtp = efd.SMTPConfiguration;
            }
            this.labelSMTPValues.Text = String.Format("{0}", this.smtp.Host);

            ValidateInputs();

            this.textBoxDescription.Focus();
        }
コード例 #9
0
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase fd)
        {
            this.doValidation = true;

            PrefPriority[] priorityChoices = PrefPriority.GetList(false);
            this.comboBoxMinimumPriority.Items.Add(Properties.Resources.AddProwl_AnyPriority);
            for (int i = 0; i < priorityChoices.Length; i++)
            {
                this.comboBoxMinimumPriority.Items.Add(priorityChoices[i]);
            }
            this.comboBoxMinimumPriority.SelectedIndex = 0;

            // set text box values
            this.textBoxUsername.Text    = String.Empty;
            this.textBoxUsername.Enabled = true;
            this.textBoxPassword.Text    = String.Empty;
            this.textBoxPassword.Enabled = true;
            this.textBoxFormat.Text      = TwitterForwardDestination.DefaultFormat;
            this.textBoxFormat.Enabled   = true;
            this.comboBoxMinimumPriority.SelectedIndex = 0;
            this.comboBoxMinimumPriority.Enabled       = true;

            TwitterForwardDestination tfd = fd as TwitterForwardDestination;

            if (tfd != null)
            {
                this.textBoxUsername.Text         = tfd.Username;
                this.textBoxPassword.Text         = tfd.Password;
                this.textBoxFormat.Text           = tfd.Format;
                this.checkBoxOnlyWhenIdle.Checked = tfd.OnlyWhenIdle;
                if (tfd.MinimumPriority != null && tfd.MinimumPriority.HasValue)
                {
                    this.comboBoxMinimumPriority.SelectedItem = PrefPriority.GetByValue(tfd.MinimumPriority.Value);
                }
            }

            ValidateInputs();

            this.textBoxUsername.Focus();
        }
コード例 #10
0
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase fd)
        {
            this.doValidation = true;

            // set text box values
            this.textBoxDescription.Text    = String.Empty;
            this.textBoxDescription.Enabled = true;
            this.textBoxOutletUrl.Text      = String.Empty;
            this.textBoxOutletUrl.Enabled   = true;

            NotifyIOSubscription nios = fd as NotifyIOSubscription;

            if (nios != null)
            {
                this.textBoxDescription.Text = nios.Description;
                this.textBoxOutletUrl.Text   = nios.OutletUrl;
            }

            ValidateInputs();

            this.textBoxDescription.Focus();
        }
コード例 #11
0
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase fd)
        {
            this.doValidation = true;

            PrefPriority[] priorityChoices = PrefPriority.GetList(false);
            this.comboBoxMinimumPriority.Items.Add(Properties.Resources.AddProwl_AnyPriority);
            for (int i = 0; i < priorityChoices.Length; i++)
            {
                this.comboBoxMinimumPriority.Items.Add(priorityChoices[i]);
            }
            this.comboBoxMinimumPriority.SelectedIndex = 0;

            // set text box values
            this.textBoxDescription.Text               = String.Empty;
            this.textBoxDescription.Enabled            = true;
            this.textBoxAPIKey.Text                    = String.Empty;
            this.textBoxAPIKey.Enabled                 = true;
            this.comboBoxMinimumPriority.SelectedIndex = 0;
            this.comboBoxMinimumPriority.Enabled       = true;

            ProwlForwardDestination pfd = fd as ProwlForwardDestination;

            if (pfd != null)
            {
                this.textBoxDescription.Text = pfd.Description;
                this.textBoxAPIKey.Text      = pfd.APIKey;
                if (pfd.MinimumPriority != null && pfd.MinimumPriority.HasValue)
                {
                    this.comboBoxMinimumPriority.SelectedItem = PrefPriority.GetByValue(pfd.MinimumPriority.Value);
                }
                this.checkBoxOnlyWhenIdle.Checked = pfd.OnlyWhenIdle;
            }

            ValidateInputs();

            this.textBoxDescription.Focus();
        }
コード例 #12
0
 public Growl.Destinations.DestinationSettingsPanel GetSettingsPanel(DestinationListItem fdli)
 {
     return new Growl.UI.ForwardDestinationInputs();
 }
コード例 #13
0
 private void ShowInputs(DestinationListItem dli)
 {
     ShowInputs(dli, dli.Handler);
 }
コード例 #14
0
        private void ShowInputs(DestinationListItem dli, IDestinationHandler handler)
        {
            this.panelBonjour.Visible = false;
            this.panelDetails.Visible = true;

            DestinationSettingsPanel panel = handler.GetSettingsPanel(this.dbEdit);
            this.settingsPanel = panel;
            panel.ValidChanged += new DestinationSettingsPanel.ValidChangedEventHandler(panel_ValidChanged);
            this.panelDetails.Controls.Add(panel);
            panel.Visible = true;
            panel.Initialize(this.isSubscription, dli, this.dbEdit);

            this.buttonSave.Visible = true;
        }
コード例 #15
0
        public override void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase fd)

        {
            this.doValidation = true;

            this.isSubscription = isSubscription;



            this.comboBoxFormat.Items.Add(Properties.Resources.Protocol_Type_GNTP);

            this.comboBoxFormat.Items.Add(Properties.Resources.Protocol_Type_UDP);



            // set text box values

            BonjourListItem bli = fdli as BonjourListItem;

            if (bli != null)

            {
                this.isBonjour = true;

                DetectedService ds = bli.DetectedService;

                this.selectedService = ds;



                string host = ds.Hostname;

                int port = ds.Service.Port;



                this.textBoxDescription.Text = ds.Service.Name;

                this.textBoxDescription.Enabled = false;

                this.textBoxAddress.Text = host;

                this.textBoxAddress.Enabled = false;

                this.textBoxPort.Text = port.ToString();

                this.textBoxPort.Enabled = false;

                this.comboBoxFormat.SelectedIndex = 0;

                this.comboBoxFormat.Enabled = false;

                this.textBoxPassword.Focus();
            }

            else

            {
                this.textBoxDescription.Text = String.Empty;

                this.textBoxDescription.Enabled = true;

                this.textBoxAddress.Text = String.Empty;

                this.textBoxAddress.Enabled = true;

                this.textBoxPort.Text = Growl.Connector.GrowlConnector.TCP_PORT.ToString();

                this.textBoxPort.Enabled = true;

                this.comboBoxFormat.SelectedIndex = 0;

                this.comboBoxFormat.Enabled = true;

                this.textBoxDescription.Focus();
            }



            // edits

            if (fd != null)

            {
                this.textBoxDescription.Text = fd.Description;

                this.comboBoxFormat.Enabled = false;

                GNTPSubscription subscription = fd as GNTPSubscription;

                if (subscription != null)

                {
                    this.textBoxAddress.Text = subscription.IPAddress;

                    this.textBoxPort.Text = subscription.Port.ToString();

                    this.textBoxPassword.Text = subscription.Password;

                    this.comboBoxFormat.SelectedItem = Properties.Resources.Protocol_Type_GNTP;

                    this.comboBoxFormat.Visible = false;
                }

                GNTPForwardDestination gntp = fd as GNTPForwardDestination;

                if (gntp != null)

                {
                    this.textBoxAddress.Text = gntp.IPAddress;

                    this.textBoxPort.Text = gntp.Port.ToString();

                    this.textBoxPassword.Text = gntp.Password;

                    this.comboBoxFormat.SelectedItem = Properties.Resources.Protocol_Type_GNTP;
                }

                BonjourForwardDestination bonjour = fd as BonjourForwardDestination;

                if (bonjour != null)

                {
                    this.textBoxAddress.Text = bonjour.IPAddress;

                    this.textBoxPort.Text = bonjour.Port.ToString();

                    this.textBoxPassword.Text = bonjour.Password;

                    this.comboBoxFormat.SelectedItem = Properties.Resources.Protocol_Type_GNTP;

                    this.textBoxDescription.Enabled = false;

                    this.textBoxAddress.Enabled = false;

                    this.textBoxPort.Enabled = false;

                    this.textBoxPassword.Focus();
                }

                UDPForwardDestination udp = fd as UDPForwardDestination;

                if (udp != null)

                {
                    this.textBoxAddress.Text = udp.IPAddress;

                    this.textBoxPort.Text = udp.Port.ToString();

                    this.textBoxPassword.Text = udp.Password;

                    this.comboBoxFormat.SelectedItem = Properties.Resources.Protocol_Type_UDP;
                }
            }



            if (isSubscription)

            {
                this.labelFormat.Visible = false;

                this.comboBoxFormat.Visible = false;
            }



            ValidateInputs();
        }
コード例 #16
0
        public DestinationSettingsPanel GetSettingsPanel(DestinationListItem dbli)

        {
            return(new PhonyBalloonySettings());
        }
コード例 #17
0
        public void AddItem(DestinationListItem item)

        {
            this.Items.Add(item);
        }
 public DestinationSettingsPanel GetSettingsPanel(DestinationListItem dbli)
 {
     return new Growl.UI.ToastyForwardInputs();
 }
コード例 #19
0
 /// <summary>
 /// Gets the settings panel associated with this subscriber.
 /// </summary>
 /// <param name="dbli">The <see cref="DestinationListItem"/> as selected by the user</param>
 /// <returns><see cref="DestinationSettingsPanel"/></returns>
 /// <remarks>
 /// This is called when a user is adding a new subscription.
 /// </remarks>
 public DestinationSettingsPanel GetSettingsPanel(DestinationListItem fdli)
 {
     return(new FeedSubscriptionSettings());
 }
コード例 #20
0
        public DestinationSettingsPanel GetSettingsPanel(DestinationListItem dbli)

        {
            return(new FolderWatchSettings());
        }
コード例 #21
0
 public Growl.Destinations.DestinationSettingsPanel GetSettingsPanel(DestinationListItem fdli)
 {
     return new Growl.UI.NotifyIOSubscriptionInputs();
 }
コード例 #22
0
 /// <summary>
 /// Gets the settings panel associated with this forwarder.
 /// </summary>
 /// <param name="dbli">The <see cref="DestinationListItem"/> as selected by the user</param>
 /// <returns><see cref="DestinationSettingsPanel"/></returns>
 /// <remarks>
 /// This is called when a user is adding a new forwarding destination.
 /// </remarks>
 public DestinationSettingsPanel GetSettingsPanel(DestinationListItem dbli)
 {
     return(new WebhookInputs());
 }
コード例 #23
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)

        {
            OnValidChanged(true);
        }
コード例 #24
0
 public virtual void Initialize(bool isSubscription, DestinationListItem fdli, DestinationBase db)
 {
     throw new NotImplementedException();
 }
コード例 #25
0
             ValidChanged(isValid);
         }
     }
 }