コード例 #1
0
 public static void UpdateControl(this RadLabel lablel, string Text)
 {
     if (lablel.InvokeRequired)  // if currently on a different thread, invoke
     {
         lablel.BeginInvoke((MethodInvoker) delegate() { lablel.Text = Text; });
     }
     else
     {
         lablel.Text = Text;
     }
 }
コード例 #2
0
        public void UpdateLabel(RadLabel lb, string Text)
        {
            if (lb == null)
            {
                return;
            }

            if (lb.InvokeRequired)  // if currently on a different thread, invoke
            {
                lb.BeginInvoke((MethodInvoker) delegate() { lb.Text = Text; });
            }
            else
            {
                lb.Text = Text;
            }
        }
コード例 #3
0
            // when row is added/removed, fires to update gui with grid row count
            public void OnRowsChanged(RadGridView RadGrid, RadLabel gridRowCountDisp)
            {
                if (RadGrid == null)
                {
                    return;
                }
                if (gridRowCountDisp == null)
                {
                    return;
                }

                //RadGridView clicked = (RadGridView)sender;
                //RadLabel gridRowCountDisp = lblGrid;  // Define Label

                int rowcount = 0;

                // return grid row count
                if (RadGrid.InvokeRequired)
                {
                    RadGrid.BeginInvoke((MethodInvoker) delegate() { rowcount = RadGrid.Rows.Count(); });
                }
                else
                {
                    rowcount = RadGrid.Rows.Count();
                }


                // update label with grid row count
                if (gridRowCountDisp.InvokeRequired)
                {
                    gridRowCountDisp.BeginInvoke((MethodInvoker) delegate() { gridRowCountDisp.Text = rowcount + " Rows"; });
                }
                else
                {
                    gridRowCountDisp.Text = rowcount + " Rows";
                }
            }
コード例 #4
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");
        }