Exemple #1
0
        /// <summary>
        /// Initialize all components and bind events handler
        /// </summary>
        private void Init()
        {
            // read and init config
            LoadConfig();

            treeView1.AfterSelect += (x, y) =>
            {
                var project = y.Node.Tag as Project;
                SetTestInfo(project);
            };

            treeView1.AfterCheck += (x, y) =>
            {
                var node = y.Node;

                if (node.Nodes.Count > 0)
                {
                    foreach (var item in node.Nodes)
                    {
                        var subNode = item as TreeNode;
                        CheckMany(subNode, node.Checked);
                    }
                }
            };

            // capture hotkey event and handle them
            _eventCapture.Start    += Start;
            _eventCapture.Stop     += Stop;
            _eventCapture.Resume   += Resume;
            _eventCapture.Restart  += Restart;
            _eventCapture.Pause    += Pause;
            _eventCapture.Position += x =>
            {
                ClipBoardUtil.SetText($"{x.X},{x.Y}");
            };

            // init test runner dependencies and event callback handlers
            _testRunner.Printer      = Log;
            _testRunner.SnapShoter   = SnapShot;
            _testRunner.SetClipBoard = SetClipBoard;
            _testRunner.Infoer       = Info;
            _testRunner.SnapShoter   = SnapShot;
            _testRunner.Finished    += TestFinished;

            // init output consoles
            _mainConsole = new RichTextBoxConsole(main_box);
            _infoConsole = new RichTextBoxConsole(info_box);

            // init treeview render
            _treeViewRender = new TreeViewRender(treeView1);

            // init snapshoter
            _snapShoter = new SnapShoter(config.SnapshotDir);

            // mount project
            LoadProjects();

            // begin capture hotkey event
            _eventCapture.StartCapture();
        }
Exemple #2
0
 /// <summary>
 /// Test runner clipboard event handler
 /// </summary>
 /// <param name="msg"></param>
 private void SetClipBoard(string msg)
 {
     this.InvokeAfterHandleCreated(() => ClipBoardUtil.SetText(msg));
 }