/// <summary> /// Edits the specified object's value using the editor style indicated by the <see cref="M:System.Drawing.Design.UITypeEditor.GetEditStyle"></see> method. /// </summary> /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that can be used to gain additional context information.</param> /// <param name="provider">An <see cref="T:System.IServiceProvider"></see> that this editor can use to obtain services.</param> /// <param name="value">The object to edit.</param> /// <returns> /// The new value of the object. If the value of the object has not changed, this should return the same object it was passed. /// </returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { using (DomainPathSelector selector = new DomainPathSelector(null)) { if (selector.ShowDialog() == DialogResult.OK && selector.SelectedPath != null) { return(selector.SelectedPath); } } return(value); }
/// <summary> /// Handles the Click event of the btnDomainPathSelector control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnDomainPathSelector_Click(object sender, EventArgs e) { using (DomainPathSelector selector = new DomainPathSelector(null)) { if (selector.ShowDialog() == DialogResult.OK && selector.SelectedPath != null) { DomainItem item = selector.SelectedDomainItem; if (item != null) { txtDomain.Text = item.Path; return; } } txtDomain.Text = String.Empty; } }
/// <summary> /// Handles the Click event of the btnDomainPathSelector control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void btnDomainPathSelector_Click(object sender, EventArgs e) { using (DomainPathSelector selector = new DomainPathSelector(CandleSettings.CurrentDomainId)) { if (selector.ShowDialog() == DialogResult.OK && selector.SelectedPath != null) { DomainItem item = selector.SelectedDomainItem; if (item != null) { txtDomainPath.Text = item.Path; } else { txtDomainPath.Text = String.Empty; } } } }