Exemplo n.º 1
0
        private void WireUpEvents()
        {
            tree.MouseDown += (s, e) =>
            {
                if (e.Button == MouseButtons.Right)
                {
                    ContextNode = tree.GetNodeAt(e.X, e.Y) as TestSuiteTreeNode;
                }
            };

            tree.AfterSelect += (s, e) =>
            {
                if (_propertiesDialog != null)
                {
                    if (_propertiesDialog.Pinned)
                    {
                        _propertiesDialog.DisplayProperties((TestSuiteTreeNode)e.Node);
                    }
                    else
                    {
                        _propertiesDialog.Close();
                    }
                }
            };

            tree.DragDrop += (s, e) =>
            {
                if (IsValidFileDrop(e.Data))
                {
                    FileDrop?.Invoke((string[])e.Data.GetData(DataFormats.FileDrop));
                }
            };

            tree.DragEnter += (s, e) =>
            {
                e.Effect = IsValidFileDrop(e.Data)
                    ? DragDropEffects.Copy
                    : DragDropEffects.None;
            };

            treeMenu.Popup += (s, e) =>
            {
                TestSuiteTreeNode targetNode = ContextNode ?? (TestSuiteTreeNode)tree.SelectedNode;
                TestSuiteTreeNode theoryNode = targetNode?.GetTheoryNode();


                runMenuItem.DefaultItem = runMenuItem.Enabled && targetNode != null && targetNode.Included &&
                                          (targetNode.Test.RunState == RunState.Runnable || targetNode.Test.RunState == RunState.Explicit);

                showCheckBoxesMenuItem.Checked = tree.CheckBoxes;

                //failedAssumptionsMenuItem.Visible =
                failedAssumptionsMenuItem.Enabled = theoryNode != null;
                failedAssumptionsMenuItem.Checked = theoryNode?.ShowFailedAssumptions ?? false;

                propertiesMenuItem.Enabled = targetNode != null;
            };

            treeMenu.Collapse += (s, e) => ContextNode = null;
        }
Exemplo n.º 2
0
 private void ShowPropertiesDialog(TestSuiteTreeNode node)
 {
     if (propertiesDialog == null)
     {
         Form owner = this.FindForm();
         propertiesDialog               = new TestPropertiesDialog(node);
         propertiesDialog.Owner         = owner;
         propertiesDialog.Font          = owner.Font;
         propertiesDialog.StartPosition = FormStartPosition.Manual;
         propertiesDialog.Left          = Math.Max(0, owner.Left + (owner.Width - propertiesDialog.Width) / 2);
         propertiesDialog.Top           = Math.Max(0, owner.Top + (owner.Height - propertiesDialog.Height) / 2);
         propertiesDialog.Show();
         propertiesDialog.Closed += new EventHandler(OnPropertiesDialogClosed);
     }
     else
     {
         propertiesDialog.DisplayProperties(node);
     }
 }
Exemplo n.º 3
0
 public void ShowPropertiesDialog(TestSuiteTreeNode node)
 {
     TestPropertiesDialog.DisplayProperties(node);
 }