Beispiel #1
0
 private void menuPaste_Click(object sender, EventArgs e)
 {
     if ((this.treeView1.SelectedNode != null) && !this.treeView1.SelectedNode.HasTagValue())
     {
         try
         {
             string text = Clipboard.GetText();
             if (!string.IsNullOrEmpty(text))
             {
                 TreeNode selectedNode = this.treeView1.SelectedNode;
                 foreach (XmlCommand command in XmlHelper.XmlDeserialize<List<XmlCommand>>(text, Encoding.UTF8))
                 {
                     TreeNode node = new TreeNode(command.CommandName, int_2, int_3);
                     node.SetTagValue(command);
                     selectedNode.Nodes.Add(node);
                     this.method_1();
                 }
             }
         }
         catch (Exception exception)
         {
             MessageBox.Show(exception.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
     }
 }
Beispiel #2
0
 private void method_4(string[] string_2, bool bool_1)
 {
     foreach (string str in string_2)
     {
         List<XmlCommand> list = null;
         try
         {
             list = XmlHelper.XmlDeserializeFromFile<List<XmlCommand>>(str, Encoding.UTF8);
         }
         catch (Exception exception)
         {
             throw new InvalidOperationException(string.Format("在读取文件 {0} 时失败,错误原因:\r\n{1}", str, exception.Message), exception);
         }
         if (comparison_0 == null)
         {
             comparison_0 = new Comparison<XmlCommand>(MainForm.smethod_0);
         }
         list.Sort(comparison_0);
         TreeNode node = null;
         string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(str);
         if (bool_1)
         {
             node = this.treeView1.Nodes.CompareText(fileNameWithoutExtension);
         }
         if (node == null)
         {
             node = new TreeNode(fileNameWithoutExtension, int_0, int_1);
             this.treeView1.Nodes.Add(node);
         }
         else
         {
             node.Text = fileNameWithoutExtension;
             node.Nodes.Clear();
         }
         foreach (XmlCommand command in list)
         {
             TreeNode node2 = new TreeNode(command.CommandName, int_2, int_3);
             node2.SetTagValue(command);
             node.Nodes.Add(node2);
         }
     }
 }
Beispiel #3
0
 private void menuAdd_Click(object sender, EventArgs e)
 {
     TreeNode selectedNode = this.treeView1.SelectedNode;
     if (selectedNode != null)
     {
         TreeNode node3 = selectedNode.IsTagEmpty() ? selectedNode : selectedNode.Parent;
         EditCommandDialogFix dialog = new EditCommandDialogFix();
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             XmlCommand command = dialog.method_4();
             TreeNode node2 = new TreeNode(command.CommandName, int_2, int_3);
             node2.SetTagValue(command);
             node3.Nodes.Add(node2);
             this.treeView1.SelectedNode = node2;
             node2.EnsureVisible();
             this.method_1();
         }
     }
 }