• C# 多线程 弹出模态MessageBox的一种方法


    在多线程中,有时候使用MessageBox.Show方法弹出对话框,弹出的Messagebox不是模态的,不能满足我的要求.经过研究,如下实现

      private void button1_Click(object sender, EventArgs e)
            {
                //定义一个求和的方法
                Func<int, int> sum = null;
    sum=(number) => { if (number == 1) { Thread.Sleep(1000); return 1; } else { return number + sum(number - 1); } }; //一个线程来求1-30的数字的和 System.Threading.Thread th = new Thread(new ThreadStart(() => { int aa = Sum(30); AppData.Do(() => { //MessageBox.Show( aa.ToString()); MessageBox.Show(this, aa.ToString()); }); })); th.Start(); //this.button1.Text = "Main"; MessageBox.Show("do something"); }

    csdn没分数了,我也是被逼的,要AppData.Do的实现方法,请到https://download.csdn.net/download/hanghangz/10436338处下载.

  • 相关阅读:
    application , application pool., W3wp ,httpapplication, domain
    HDFS
    spark
    Hive
    container docker
    Azure&& hdinsight
    Native Code
    拥抱重构
    六个重构方法可帮你提升80%的代码质量
    重构 小步进行曲
  • 原文地址:https://www.cnblogs.com/birds-zhu/p/9086211.html
Copyright © 2020-2023  润新知