public static void UpdateControl(this RadButton la, string Text)
 {
     if (la.InvokeRequired)  // if currently on a different thread, invoke
     {
         la.BeginInvoke((MethodInvoker) delegate() { la.Text = Text; });
     }
     else
     {
         la.Text = Text;
     }
 }
Exemple #2
0
        public void UpdateButton(RadButton la, string Text)
        {
            if (la == null)
            {
                return;
            }

            if (la.InvokeRequired)  // if currently on a different thread, invoke
            {
                la.BeginInvoke((MethodInvoker) delegate() { la.Text = Text; });
            }
            else
            {
                la.Text = Text;
            }
        }
Exemple #3
0
        //_Dict dict = new _Dict();

        #endregion

        #region === Form Update ===

        public void Update(Control Control, object update = null)
        {
            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadRichTextEditor")
            {
                RadRichTextEditor txt = (RadRichTextEditor)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadLabel")
            {
                RadLabel txt = (RadLabel)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadButton")
            {
                RadButton txt = (RadButton)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadTextBox")
            {
                RadTextBox txt = (RadTextBox)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadCheckBox")
            {
                RadCheckBox txt = (RadCheckBox)Control; // editor to update passed by user

                bool CheckVal = (bool)update;

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Checked = CheckVal; });
                }
                else
                {
                    txt.Checked = CheckVal; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "IntegrationDataUpdate.IntegrationApp")
            {
                Form txt = (Form)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadBindingNavigator")
            {
                RadBindingNavigator txt = (RadBindingNavigator)Control; // editor to update passed by user

                string Text = ""; if (update != null)
                {
                    Text = update.ToString();
                }                        // optional field used to pass text to populate

                if (txt.InvokeRequired)  // if currently on a different thread, invoke
                {
                    txt.BeginInvoke((MethodInvoker) delegate() { txt.Text = Text; });
                }
                else
                {
                    txt.Text = Text; // Update Control Text
                }

                return;
            }

            //if (Control.GetType().ToString() == "Telerik.WinControls.UI.RadLabelElement")
            //{
            //    RadLabelElement txt = (RadLabelElement)Control; // editor to update passed by user

            //    string Text = ""; if (update != null) { Text = update.ToString(); }  // optional field used to pass text to populate

            //    if (txt.InvokeRequired)  // if currently on a different thread, invoke
            //    {
            //        txt.BeginInvoke((MethodInvoker)delegate () { txt.Text = Text; });
            //    }
            //    else
            //    {
            //        txt.Text = Text; // Update Control Text
            //    }

            //    return;
            //}



            ahk.MsgBox("Control Type: " + Control.GetType().ToString() + " Not Defined To Update YET");
        }