示例#1
0
        public void InvokeIfNeededTest1()
        {
            Control ctl  = new Control();
            Action  doit = new Action(() => ctl.Text = "Contorl");

            InvokeExtension.InvokeIfNeeded(ctl, doit);
        }
示例#2
0
 void mPlugin_TimeChanged()
 {
     InvokeExtension.Invoke(this, () =>
                            timeLabel.Text = mPlugin.ExperimentState == State.Running || mPlugin.ExperimentState == State.Finished ?
                                             string.Format("{0}m {1}s", (int)mPlugin.Time.TotalMinutes, mPlugin.Time.Seconds) :
                                             "Ready to start"
                            );
 }
示例#3
0
        //
        //编写测试时,还可使用以下特性:
        //
        //使用 ClassInitialize 在运行类中的第一个测试前先运行代码
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //使用 ClassCleanup 在运行完类中的所有测试后再运行代码
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //使用 TestInitialize 在运行每个测试前先运行代码
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //使用 TestCleanup 在运行完每个测试后运行代码
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///InvokeIfNeeded 的测试
        ///</summary>
        public void InvokeIfNeededTestHelper <T>()
        {
            Control         ctl  = new Control();
            Action <string> doit = new Action <string>((item) => ctl.Text = item);
            string          args = "Control";

            InvokeExtension.InvokeIfNeeded <string>(ctl, doit, args);
        }
示例#4
0
        void mPlugin_StateChanged()
        {
            InvokeExtension.Invoke(this, () => {
                stateLabel.Text   = "State: " + mPlugin.ExperimentState.ToString();
                prepCheck.Checked = mPlugin.Prep;

                timeLabel.Text = mPlugin.ExperimentState == State.Running || mPlugin.ExperimentState == State.Finished ?
                                 string.Format("{0}m {1}s", (int)mPlugin.Time.TotalMinutes, mPlugin.Time.Seconds) :
                                 "Ready to start";
            });
        }
示例#5
0
        /// <summary>
        ///InvokeIfNeeded 的测试
        ///</summary>
        public void InvokeIfNeededTest2Helper <T, S>()
        {
            Control ctl = new Control();
            Action <string, string> doit = new Action <string, string>((a, b) =>
            {
                ctl.Text = a;
                ctl.Tag  = b;
            });
            string arg1 = "";
            string arg2 = "";

            InvokeExtension.InvokeIfNeeded <string, string>(ctl, doit, arg1, arg2);
        }