/// <summary>
 /// Change header text of menu item if it is already created.
 /// </summary>
 /// <param name="actionType"></param>
 /// <param name="args"></param>
 private void OnMenuHeaderPropertyChanged(StdCommandActionType actionType, DependencyPropertyChangedEventArgs args)
 {
     if (this._contextMenu != null)
     {
         this.GetMenuItem(actionType).Header = args.NewValue;
     }
 }
예제 #2
0
 public ClipboardSecurityExceptionEventArgs(SecurityException exception,
                                            StdCommandActionType stdCommandActionType)
 {
     this.Exception            = exception;
     this.StdCommandActionType = stdCommandActionType;
 }
 /// <summary>
 /// Add <paramref name="menuItem"/> to context menu associated with TextBox.
 /// Add <paramref name="menuItem"/> to private dictionary with key <paramref name="actionType"/>
 /// so you can always get MenuItem with method <see cref="GetMenuItem"/> by action type.
 /// </summary>
 /// <param name="actionType"></param>
 /// <param name="menuItem"></param>
 private void AddMenuItem(StdCommandActionType actionType, MenuItem menuItem)
 {
     this._contextMenu.Items.Add(menuItem);
     this._clipboardActions.Add(actionType, menuItem);
 }
 /// <summary>
 /// Get created MenuItem. If Menu is not created then LINQ exception will throw.
 /// </summary>
 /// <param name="actionType"></param>
 /// <returns></returns>
 private MenuItem GetMenuItem(StdCommandActionType actionType)
 {
     return(this._clipboardActions.Where(x => x.Key == actionType).Select(x => x.Value).Single());
 }
예제 #5
0
 /// <summary>
 /// Method for handle SecurityException with clipboard.
 /// </summary>
 /// <param name="exception"></param>
 /// <param name="actionType"></param>
 protected void OnClipboardSecurityException(SecurityException exception, StdCommandActionType actionType)
 {
     this._clipboardSecurityExceptionNotify.OnClipboardSecurityExceptionEvent(
         new ClipboardSecurityExceptionEventArgs(exception, actionType));
 }