CreateWrapper() private method

private CreateWrapper ( Control control ) : ITextBoxWrapper
control System.Windows.Forms.Control
return ITextBoxWrapper
コード例 #1
0
 public void SetAutocompleteMenu(Control control, AutocompleteMenu menu)
 {
     if (menu != null)
     {
         var wrapper = menu.CreateWrapper(control);
         if (wrapper == null)
         {
             return;
         }
         //
         menu.SubscribeForm(wrapper);
         AutocompleteMenuByControls[control] = this;
         //
         wrapper.LostFocus += menu.control_LostFocus;
         wrapper.Scroll    += menu.control_Scroll;
         wrapper.KeyDown   += menu.control_KeyDown;
         wrapper.MouseDown += menu.control_MouseDown;
     }
     else
     {
         AutocompleteMenuByControls.TryGetValue(control, out menu);
         AutocompleteMenuByControls.Remove(control);
         ITextBoxWrapper wrapper = null;
         WrapperByControls.TryGetValue(control, out wrapper);
         WrapperByControls.Remove(control);
         if (wrapper != null && menu != null)
         {
             wrapper.LostFocus -= menu.control_LostFocus;
             wrapper.Scroll    -= menu.control_Scroll;
             wrapper.KeyDown   -= menu.control_KeyDown;
             wrapper.MouseDown -= menu.control_MouseDown;
         }
     }
 }
コード例 #2
0
ファイル: AutocompleteMenu.cs プロジェクト: MarkMpn/Sql4Cds
 public void SetAutocompleteMenu(Control control, AutocompleteMenu menu)
 {
     if (menu != null)
     {
         if (WrapperByControls.ContainsKey(control))
         {
             var wrapper = WrapperByControls[control];
             if (wrapper == null)
             {
                 return;
             }
             //
             if (control.IsHandleCreated)
             {
                 menu.SubscribeForm(wrapper);
             }
             else
             {
                 control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
             }
             //
             AutocompleteMenuByControls[control] = this;
             //
             UnsubscribeWrapper(wrapper, menu);
             SubscribeWrapper(wrapper, menu);
         }
         else
         {
             var wrapper = menu.CreateWrapper(control);
             if (wrapper == null)
             {
                 return;
             }
             //
             if (control.IsHandleCreated)
             {
                 menu.SubscribeForm(wrapper);
             }
             else
             {
                 control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
             }
             //
             AutocompleteMenuByControls[control] = this;
             //
             UnsubscribeWrapper(wrapper, menu);
             SubscribeWrapper(wrapper, menu);
         }
     }
     else
     {
         AutocompleteMenuByControls.TryGetValue(control, out menu);
         AutocompleteMenuByControls.Remove(control);
         ITextBoxWrapper wrapper = null;
         WrapperByControls.TryGetValue(control, out wrapper);
         WrapperByControls.Remove(control);
         if (wrapper != null && menu != null)
         {
             UnsubscribeWrapper(wrapper, menu);
         }
     }
 }
コード例 #3
0
 public void SetAutocompleteMenu(Control control, AutocompleteMenu menu)
 {
     if (menu != null)
     {
         if (WrapperByControls.ContainsKey(control))
         {
             var wrapper = WrapperByControls[control];
             if (wrapper == null) return;
             //
             if (control.IsHandleCreated)
                 menu.SubscribeForm(wrapper);
             else
                 control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
             //
             AutocompleteMenuByControls[control] = this;
             //
             wrapper.LostFocus += menu.control_LostFocus;
             wrapper.Scroll += menu.control_Scroll;
             wrapper.KeyDown += menu.control_KeyDown;
             wrapper.MouseDown += menu.control_MouseDown;
         }
         else
         {
             var wrapper = menu.CreateWrapper(control);
             if (wrapper == null) return;
             //
             if (control.IsHandleCreated)
                 menu.SubscribeForm(wrapper);
             else
                 control.HandleCreated += (o, e) => menu.SubscribeForm(wrapper);
             //
             AutocompleteMenuByControls[control] = this;
             //
             wrapper.LostFocus += menu.control_LostFocus;
             wrapper.Scroll += menu.control_Scroll;
             wrapper.KeyDown += menu.control_KeyDown;
             wrapper.MouseDown += menu.control_MouseDown;
         }
     }
     else
     {
         AutocompleteMenuByControls.TryGetValue(control, out menu);
         AutocompleteMenuByControls.Remove(control);
         ITextBoxWrapper wrapper = null;
         WrapperByControls.TryGetValue(control, out wrapper);
         WrapperByControls.Remove(control);
         if (wrapper != null && menu != null)
         {
             wrapper.LostFocus -= menu.control_LostFocus;
             wrapper.Scroll -= menu.control_Scroll;
             wrapper.KeyDown -= menu.control_KeyDown;
             wrapper.MouseDown -= menu.control_MouseDown;
         }
     }
 }