コード例 #1
0
        private static InfoControler GetBuildInfoControler(Control controler)
        {
            InfoControler infocontroller = new InfoControler();

            infocontroller.Code           = controler.GetHashCode();
            infocontroller.NameController = controler.Name;
            infocontroller.IsEmpty        = true;
            infocontroller.DefaultColor   = controler.Background;
            return(infocontroller);
        }
コード例 #2
0
 //de la foma  en el codigo cliente debe usarlo AddListenControlers(textbox1,textbox2, combobox2......)
 public static void AddListenControlers(params Control[] Controls)
 {
     _listInfoController = new List <InfoControler>();
     foreach (var currentControl in Controls)
     {
         try
         {
             InfoControler infoControler     = GetBuildInfoControler(currentControl);
             Control       controlerConcreto = GetBuildControlerReal(currentControl, infoControler);
             infoControler.UsingControl = controlerConcreto;
             _listInfoController.Add(infoControler);
         }
         catch (Exception)
         { }
     }
 }
コード例 #3
0
 //de la foma  en el codigo cliente debe usarlo AddListenControlers(textbox1,textbox2, combobox2......)
 public static void AddListenControlers(UIElementCollection uiElements)
 {
     _listInfoController = new List <InfoControler>();
     foreach (var uiElement in uiElements)
     {
         try
         {
             Control       currentControl    = (Control)uiElement;
             InfoControler infoControler     = GetBuildInfoControler(currentControl);
             Control       controlerConcreto = GetBuildControlerReal(currentControl, infoControler);
             infoControler.UsingControl = controlerConcreto;
             _listInfoController.Add(infoControler);
         }
         catch (Exception)
         { }
     }
 }
コード例 #4
0
        private static Control GetBuildControlerReal(Control currentControl, InfoControler infoControler)
        {
            if (currentControl is TextBox)
            {
                TextBox foundText = currentControl as TextBox;
                foundText.KeyUp += infoControler.text_KeyUp;
                return(foundText);
            }

            if (currentControl is ComboBox)
            {
                ComboBox foundCombo = currentControl as ComboBox;
                foundCombo.SelectionChanged += infoControler.combo_SelectionChanged;
                return(foundCombo);
            }

            if (currentControl is DatePicker)
            {
                DatePicker foundDate = currentControl as DatePicker;
                foundDate.SelectedDateChanged += infoControler.datepicker_SelectedDateChanged;
                return(foundDate);
            }
            return(null);
        }