private void CheckDuplicateButton(ButtonType type, TaskDialogItem itemToExclude) { if( type != ButtonType.Custom && Owner != null ) { foreach( TaskDialogButton button in Owner.Buttons ) { if( button != this && button != itemToExclude && button.ButtonType == type ) throw new InvalidOperationException(Properties.Resources.DuplicateButtonTypeError); } } }
/// <summary> /// Initializes a new instance of the <see cref="TaskDialogItemClickedEventArgs"/> class with the specified item. /// </summary> /// <param name="item">The <see cref="TaskDialogItem"/> that was clicked.</param> public TaskDialogItemClickedEventArgs(TaskDialogItem item) { _item = item; }
internal override void CheckDuplicate(TaskDialogItem itemToExclude) { CheckDuplicateButton(_type, itemToExclude); base.CheckDuplicate(itemToExclude); }
internal void SetItemEnabled(TaskDialogItem item) { if( IsDialogRunning ) { NativeMethods.SendMessage(Handle, (int)(item is TaskDialogButton ? NativeMethods.TaskDialogMessages.EnableButton : NativeMethods.TaskDialogMessages.EnableRadioButton), new IntPtr(item.Id), new IntPtr(item.Enabled ? 1 : 0)); } }
internal void ClickItem(TaskDialogItem item) { if( !IsDialogRunning ) throw new InvalidOperationException(Properties.Resources.TaskDialogNotRunningError); NativeMethods.SendMessage(Handle, (int)(item is TaskDialogButton ? NativeMethods.TaskDialogMessages.ClickButton : NativeMethods.TaskDialogMessages.ClickRadioButton), new IntPtr(item.Id), IntPtr.Zero); }
private void CheckDuplicateId(TaskDialogItem itemToExclude, int id) { if( id != 0 ) { IEnumerable items = ItemCollection; if( items != null ) { foreach( TaskDialogItem item in items ) { if( item != this && item != itemToExclude && item.Id == id ) throw new InvalidOperationException(Properties.Resources.DuplicateItemIdError); } } } }
internal virtual void CheckDuplicate(TaskDialogItem itemToExclude) { CheckDuplicateId(itemToExclude, _id); }