@@ -423,33 +423,6 @@ public static Image CreateImage(this IImage image)
423423 return new Image { Source = image . ImageSource } ;
424424 }
425425
426- /// <summary>
427- /// Translates a WinForms menu to WPF.
428- /// </summary>
429- public static ICollection TranslateToWpf ( this ToolStripItem [ ] items )
430- {
431- return items . OfType < ToolStripMenuItem > ( ) . Select ( item => TranslateMenuItemToWpf ( item ) ) . ToList ( ) ;
432- }
433-
434- static System . Windows . Controls . MenuItem TranslateMenuItemToWpf ( ToolStripMenuItem item )
435- {
436- var r = new System . Windows . Controls . MenuItem ( ) ;
437- r . Header = MenuService . ConvertLabel ( item . Text ) ;
438- r . InputGestureText = MenuService . ConvertKeys ( item . ShortcutKeys ) ;
439- //r.InputGestureText = new KeyGesture(Key.F6).GetDisplayStringForCulture(Thread.CurrentThread.CurrentUICulture);
440- if ( item . ImageIndex >= 0 )
441- r . Icon = ClassBrowserIconService . GetImageByIndex ( item . ImageIndex ) . CreateImage ( ) ;
442- if ( item . DropDownItems . Count > 0 ) {
443- foreach ( ToolStripMenuItem subItem in item . DropDownItems ) {
444- r . Items . Add ( TranslateMenuItemToWpf ( subItem ) ) ;
445- }
446- } else {
447- r . Click += delegate { item . PerformClick ( ) ; } ;
448- }
449- r . IsChecked = item . Checked ;
450- return r ;
451- }
452-
453426 /// <summary>
454427 /// Returns the index of the first element for which <paramref name="predicate"/> returns true.
455428 /// If none of the items in the list fits the <paramref name="predicate"/>, -1 is returned.
@@ -467,7 +440,7 @@ public static int FindIndex<T>(this IList<T> list, Func<T, bool> predicate)
467440 /// <summary>
468441 /// Adds item to the list if the item is not null.
469442 /// </summary>
470- public static void AddIfNotNull < T > ( this IList < T > list , T itemToAdd )
443+ public static void AddIfNotNull < T > ( this IList < T > list , T itemToAdd ) where T : class
471444 {
472445 if ( itemToAdd != null )
473446 list . Add ( itemToAdd ) ;
0 commit comments