public string MethodDistributer(System.Windows.Controls.UserControl ControlUI, string MethodName, string Parameter, Tecan.TouchTools.Interfaces.ITouchToolsServices services)
        {
            MessageBox.Show("Enter");
            PlateViewer plateViewer = null;
            TextBox txtInfo = null;
            if (MethodName.Equals("ShowSettingForm"))
            {
                MessageBox.Show("ShowSettingForm");
                return string.Empty;

            #if DEBUG
                GlobalVars.Instance.SampleCount = 44;
                GlobalVars.Instance.SampleCountPerPlate = 24;
            #endif
                var container = ControlUI.FindName("lstPCRType");
                ListBox lstPCRType = (ListBox)container;
                InitialPCRTypes(lstPCRType);
                lstPCRType.SelectionChanged += lstPCRVolume_SelectionChanged;

                container = ControlUI.FindName("lstPlateID");
                ListBox lstPlateID = (ListBox)container;
                InitialPlateIDs(lstPlateID);
                lstPlateID.SelectionChanged += lstPlateID_SelectionChanged;

                //grid
                container = ControlUI.FindName("plateViewer");
                Grid grid = (Grid)container;
                plateViewer = new PlateViewer(new Size(400, 360), new Size(50,40));
                grid.Children.Add(plateViewer);

                //button
                container = ControlUI.FindName("btnConfirm");
                Button btnConfirm = (Button)container;
                btnConfirm.Click += btnConfirm_Click;

                //textbox
                container = ControlUI.FindName("txtInfo");
                txtInfo = (TextBox)container;

            }
            return string.Empty;
        }
 private void SetElementViewModel(string name, object model, System.Windows.Documents.FlowDocument document)
 {
     if (document == null)
         return;
     System.Windows.FrameworkElement element = document.FindName(name) as System.Windows.FrameworkElement;
     if (element == null)
         return;
     element.DataContext = model;
 }
        /// <summary>
        /// The MethodDistributer is a reuired Method from the Interface.        
        /// </summary>
        /// <param name="ControlUI">The control UI.</param>
        /// <param name="MethodName">Name of the method.</param>
        /// <param name="Parameter">The parameter.</param>
        /// <param name="services">The services.</param>
        /// <returns></returns>
        public string MethodDistributer(System.Windows.Controls.UserControl ControlUI, string MethodName, string Parameter, Tecan.TouchTools.Interfaces.ITouchToolsServices services)
        {
            if (MethodName.Equals("CallDisableEnableNextButtonMethod"))
            {
                Log.Info("find txtInfo");

                //first, we prepare the txtInfo
                var container = ControlUI.FindName("txtInfo");
                GlobalVars.Instance.TextInfo = (TextBox)container;

                try
                {
                    GlobalVars.Instance.SampleCount = ReadSampleCount(ControlUI);
                    GlobalVars.Instance.SampleCountPerPlate = int.Parse(GlobalVars.Instance["sampleCountPerPlate"]);
                }
                catch(Exception ex)
                {
                    SetInfo(ex.Message);
                    return "";
                }

                var canvas = ControlUI.FindName("canvas");
                if (canvas != null)
                {
                    Grid grid = (Grid)canvas;
                    grid.Children.Clear();
                    Log.Info("CallDisableEnableNextButtonMethod & canvas found!");
                    PlateViewer plateViewer = new PlateViewer(new Size(480,360), new Size(20, 20));
                    GlobalVars.Instance.PlateViewer = plateViewer;
                    grid.Children.Add(plateViewer);
                    Log.Info("canvas not null");
                }

                Log.Info("set inputGrid visibility");
                container = ControlUI.FindName("inputGrid");
                if(container != null)
                {
                    Grid inputGrid = (Grid)container;
                    inputGrid.Visibility = Visibility.Visible;
                }

                container = ControlUI.FindName("lstPCRType");
                if (container != null)
                {
                    ListBox lstPCRType = (ListBox)container;
                    InitialPCRTypes(lstPCRType);
                    lstPCRType.SelectionChanged += lstPCRVolume_SelectionChanged;
                }

                container = ControlUI.FindName("lstPlateID");
                ListBox lstPlateID = (ListBox)container;
                InitialPlateIDs(lstPlateID);
                lstPlateID.SelectionChanged += lstPlateID_SelectionChanged;

                //button
                container = ControlUI.FindName("btnConfirm");
                Button btnConfirm = (Button)container;
                btnConfirm.Click += btnConfirm_Click;
            }
            //here we disable next button

            GlobalVars.Instance.Service = services;
            EnableNextButton(false);
            return string.Empty;
        }