コード例 #1
0
 /// <summary>
 /// Paste Element
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void PasteElementToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (trvData.DatatreeView.SelectedNode.FullPath.EndsWith(MongoDBHelper.Array_Mark))
     {
         MongoDBHelper.PasteValue(trvData.DatatreeView.SelectedNode.FullPath);
         TreeNode NewValue = new TreeNode(MongoDBHelper.ConvertToString((BsonValue)MongoDBHelper._ClipElement));
         NewValue.Tag = MongoDBHelper._ClipElement;
         trvData.DatatreeView.SelectedNode.Nodes.Add(NewValue);
     }
     else
     {
         String PasteMessage = MongoDBHelper.PasteElement(trvData.DatatreeView.SelectedNode.FullPath);
         if (String.IsNullOrEmpty(PasteMessage))
         {
             //GetCurrentDocument()的第一个元素是ID
             MongoDBHelper.AddBsonDocToTreeNode(trvData.DatatreeView.SelectedNode,
                                                new BsonDocument().Add((BsonElement)MongoDBHelper._ClipElement));
         }
         else
         {
             MyMessageBox.ShowMessage("Exception", PasteMessage);
         }
     }
     IsNeedRefresh = true;
 }