Exemplo n.º 1
0
 private void ViewerItemClick(Object sender, System.EventArgs e)
 {
     if (Tree.SelectedNode != null)
     {
         if (viewerForm == null)
         {
             viewerForm = new ViewerForm();
             viewerForm.StartPosition = FormStartPosition.Manual;
         }
         DataNode node = Tree.SelectedNode.Tag as DataNode;
         viewerForm.Exp = node.Text;
         // use IsEditing to get unfiltered value
         bool ed = node.IsEditing;
         node.IsEditing   = true;
         viewerForm.Value = node.Value;
         node.IsEditing   = ed;
         Form mainform = (PluginBase.MainForm as Form);
         viewerForm.Left = mainform.Left + mainform.Width / 2 - viewerForm.Width / 2;
         viewerForm.Top  = mainform.Top + mainform.Height / 2 - viewerForm.Height / 2;
         viewerForm.ShowDialog();
     }
 }
Exemplo n.º 2
0
 public DataTreeControl(bool watchMode)
 {
     InitializeComponent();
     this.ValueNodeTextBox.ToolTipProvider = this;
     this.watchMode = watchMode;
     _model         = new DataTreeModel();
     _tree.Model    = _model;
     this.Controls.Add(_tree);
     _tree.Expanding            += new EventHandler <TreeViewAdvEventArgs>(TreeExpanding);
     _tree.SelectionChanged     += new EventHandler(TreeSelectionChanged);
     _tree.LoadOnDemand          = true;
     _tree.AutoRowHeight         = true;
     _tree.NodeMouseDoubleClick += new EventHandler <TreeNodeAdvMouseEventArgs>(_tree_NodeMouseDoubleClick);
     _contextMenuStrip           = new ContextMenuStrip();
     if (PluginBase.MainForm != null && PluginBase.Settings != null)
     {
         _contextMenuStrip.Font     = PluginBase.Settings.DefaultFont;
         _contextMenuStrip.Renderer = new DockPanelStripRenderer(false);
     }
     _tree.ContextMenuStrip      = _contextMenuStrip;
     this.NameTreeColumn.Header  = TextHelper.GetString("Label.Name");
     this.ValueTreeColumn.Header = TextHelper.GetString("Label.Value");
     copyMenuItem   = new ToolStripMenuItem(TextHelper.GetString("Label.Copy"), null, new EventHandler(this.CopyItemClick));
     viewerMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Viewer"), null, new EventHandler(this.ViewerItemClick));
     _contextMenuStrip.Items.AddRange(new ToolStripMenuItem[] { copyMenuItem, viewerMenuItem });
     if (watchMode)
     {
         watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Unwatch"), null, new EventHandler(this.WatchItemClick));
     }
     else
     {
         watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Watch"), null, new EventHandler(this.WatchItemClick));
     }
     _contextMenuStrip.Items.Add(watchMenuItem);
     TreeSelectionChanged(null, null);
     viewerForm = new ViewerForm();
     viewerForm.StartPosition = FormStartPosition.Manual;
 }