当前位置: 首页>>代码示例>>C#>>正文


C# Label.Invoke方法代码示例

本文整理汇总了C#中System.Windows.Forms.Label.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# Label.Invoke方法的具体用法?C# Label.Invoke怎么用?C# Label.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Label的用法示例。


在下文中一共展示了Label.Invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: changeLabel

 public void changeLabel(Label lbl, string str)
 {
     if (lbl.InvokeRequired)
     {
         String name = str;
         lbl.Invoke(new MethodInvoker(delegate { lbl.Text = name; }));
     }
 }
开发者ID:raveenrox,项目名称:HomeControllerServerInterface,代码行数:8,代码来源:mainUI.cs

示例2: Check

        public static string Check(Label pLabel)
        {
            // Get Mapler.me assembly
            FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(Environment.CurrentDirectory + "\\Mapler Client.exe");

            string ApplicationName = "Mapler_Client";
            string ApplicationVersion = fvi.ProductVersion;
            try
            {
                WebClient wc = new WebClient();
                wc.Proxy = null;
                string responseText = wc.DownloadString(string.Format("http://direct.craftnet.nl/app_updates/updates.php?appname={0}&appver={1}&v=2", ApplicationName, ApplicationVersion));
                string[] lines = responseText.Split(new string[] { "\r\n" }, StringSplitOptions.None);

                if (lines[0].StartsWith("ERROR:"))
                {
                    MessageBox.Show(string.Format("Error occurred while checking for new version: {0}", responseText), ApplicationName);
                }
                else
                {
                    pLabel.Invoke((MethodInvoker)delegate
                    {
                        pLabel.Text = "Received info...";
                    });
                    string latestVersion = lines[0];
                    string url = lines[1];
                    if (latestVersion != ApplicationVersion)
                    {
                        // Download version
                        _tempfile = Path.GetTempPath() + "maplerdownload.exe";

                        pLabel.Invoke((MethodInvoker)delegate
                        {
                            pLabel.Visible = false;
                            MaplerUpdater.frmMain.Instance.prgrsUpdate.Visible = true;
                        });

                        wc.DownloadProgressChanged += wc_DownloadProgressChanged;
                        wc.DownloadFileCompleted += wc_DownloadFileCompleted;
                        wc.DownloadFileAsync(new Uri(url), _tempfile);
                        return "Downloading...";
                    }
                    else
                    {
                        return "Boot";
                    }
                }
            }
            catch
            {
            }

            return "Boot";
        }
开发者ID:diamondo25,项目名称:mapler.me,代码行数:54,代码来源:AppUpdates.cs

示例3: setLabelTextFromThread

 /// <summary>
 /// Set label text from within a thread
 /// </summary>
 /// <param name="label">Label</param>
 /// <param name="text">Text to be set</param>
 public static void setLabelTextFromThread(Label label, string text)
 {
     label.Invoke((MethodInvoker)delegate
     {
         label.Text = text;
     });
 }
开发者ID:niobos,项目名称:BBox3SagemTool,代码行数:12,代码来源:ThreadUtils.cs

示例4: ReplaceLabelText

 public static void ReplaceLabelText(Label label, string text)
 {
     // Check if the label needs to be invoked.
     if (label.InvokeRequired)
         // Invoke the label control with an appropiate delegate.
         label.Invoke(new Action<Label, string>(ReplaceLabelText), label, text);
     else
         // Directly change the labels text.
         label.Text = text;
 }
开发者ID:Woodje,项目名称:MailClient,代码行数:10,代码来源:ComponentChanges.cs

示例5: ReplaceLabelForeColor

 public static void ReplaceLabelForeColor(Label label, Color color)
 {
     // Check if the label needs to be invoked.
     if (label.InvokeRequired)
         // Invoke the label control with an appropiate delegate.
         label.Invoke(new Action<Label, Color>(ReplaceLabelForeColor), label, color);
     else
         // Directly change the labels texts color.
         label.ForeColor = color;
 }
开发者ID:Woodje,项目名称:MailClient,代码行数:10,代码来源:ComponentChanges.cs

示例6: UpdateLabelText

 public static void UpdateLabelText(Label label, string newText)
 {
     if (label.InvokeRequired)
     {
         updateLabelTextDelegate del = new updateLabelTextDelegate(UpdateLabelText);
         label.Invoke(del, new object[] { label, newText });
     }
     else
     {
         label.Text = newText;
     }
 }
开发者ID:riguelbf,项目名称:portalSureg,代码行数:12,代码来源:CrossThread.cs

示例7: SetMainThreadHint

 public static void SetMainThreadHint(Label label, string msg)
 {
     if (label.InvokeRequired)
     {
         SetMainThreadHintLabelDelegate msgCallback = new SetMainThreadHintLabelDelegate(WindowFormDelegate.SetMainThreadHint);
         label.Invoke(msgCallback, new object[] { label, msg });
     }
     else
     {
         label.Text = msg;
     }
 }
开发者ID:romanu6891,项目名称:fivemen,代码行数:12,代码来源:WindowFormDelegate.cs

示例8: SetTextInLabel

 public static void SetTextInLabel(string text, Label label)
 {
     if (label.InvokeRequired)
     {
         SetLabelCallback d = new SetLabelCallback(SetTextInLabel);
         label.Invoke(d, new object[] { text, label });
     }
     else
     {
         label.Text = text;
     }
 }
开发者ID:Kentarre,项目名称:XmppClient,代码行数:12,代码来源:chatMain.cs

示例9: UpdateInfo

 public static void UpdateInfo(Label lbl, string info)
 {
   if (lbl.InvokeRequired)
   {
     lbl.Invoke(new UpdateInfoDelegate(UpdateInfo),
       new object[] { lbl, info }); 
   }
   else
   {
     lbl.Text = info;
   }
 }
开发者ID:adamenagy,项目名称:MultithreadApprenticeForm,代码行数:12,代码来源:Program.cs

示例10: SetLabel

 public void SetLabel(Label label, string text)
 {
     if (label.InvokeRequired)
     {
         SetLabelCallback d = new SetLabelCallback(SetLabel);
         label.Invoke(d, new object[] { label, text });
     }
     else
     {
         label.Text = text;
         label.Refresh();
         Invalidate();
     }
 }
开发者ID:TimVelo,项目名称:StackBuilder,代码行数:14,代码来源:FormUpdate.cs

示例11: Label_Text

 //Method for changing the winner name label
 public void Label_Text(Label label, string text)
 {
     if (label.InvokeRequired)
     {
         try
         {
             label.Invoke(delLabelText, new object[] { label, text });
         }
         catch (Exception e) {
             Console.WriteLine(e.StackTrace);
         }
     }
     else
     {
         label.Text = text;
     }
 }
开发者ID:dosjos,项目名称:VinLotteri,代码行数:18,代码来源:WinnerWindow.cs

示例12: UpdateLabelText

        private void UpdateLabelText(Label lbl, string txt)
        {
            if (lbl.InvokeRequired)
            {
                // This is a worker thread so delegate the task.
                lbl.Invoke(new UpdateLabelTextDelegate(this.UpdateLabelText), lbl, txt);
            }
            else
            {
                // This is the UI thread so perform the task.

                lbl.Text = txt.ToString();
            }
        }
开发者ID:7ASecond-Net,项目名称:Imogen,代码行数:14,代码来源:FrmProfileImage.cs

示例13: setLabel

 private void setLabel(Label control, string text)
 {
     if (control.InvokeRequired)
     {
         control.Invoke(new MethodInvoker(delegate
         {
             control.Text = text;
         }));
     }
     else
     {
         control.Text = text;
     }
 }
开发者ID:oofdui,项目名称:ContactCheckup-MassConvert,代码行数:14,代码来源:frmConvertPayorByRegisterDate.cs

示例14: setLabelText

 private void setLabelText(Label label, string text)
 {
     if (label.InvokeRequired)
     {
         lDelegate deleg = new lDelegate(setLabelText);
         label.Invoke(deleg, new object[] { label, text });
     }
     else
     {
         label.Text = text;
     }
 }
开发者ID:sonofgod13,项目名称:Modeling,代码行数:12,代码来源:Imitation.cs

示例15: UpdateLabel

 public static void UpdateLabel(Label label, string text)
 {
     // If the current thread is not the UI thread, InvokeRequired will be true
     if (label.InvokeRequired)
     {
         // If so, call Invoke, passing it a lambda expression which calls
         // UpdateText with the same label and text, but on the UI thread instead.
         label.Invoke((Action)(() => UpdateLabel(label, text)));
         return;
     }
     // If we're running on the UI thread, we'll get here, and can safely update
     // the label's text.
     label.Text = text;
 }
开发者ID:narugo,项目名称:SteamGrouper,代码行数:14,代码来源:Interface.cs


注:本文中的System.Windows.Forms.Label.Invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。