Beispiel #1
0
 /// <summary>
 /// 确定
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmdOK_Click(object sender, EventArgs e)
 {
     if (_IsUpdateMode)
     {
         if (_IsElement)
         {
             MongoDBHelper.ModifyElement(_FullPath, AddBsonElement.getElement().Value, (BsonElement)_SelectNode.Tag);
         }
         else
         {
             MongoDBHelper.ModifyArrayValue(_FullPath, AddBsonElement.getElement().Value, _SelectNode.Index);
         }
         if (String.IsNullOrEmpty(AddBsonElement.getElement().Name))
         {
             _SelectNode.Text = String.Empty;
         }
         else
         {
             _SelectNode.Text = AddBsonElement.getElement().Name;
         }
     }
     else
     {
         String AddMessage = String.Empty;
         if (_IsElement)
         {
             AddMessage = MongoDBHelper.AddElement(_FullPath, AddBsonElement.getElement());
         }
         else
         {
             MongoDBHelper.AddArrayValue(_FullPath, AddBsonElement.getElement().Value);
         }
         if (!String.IsNullOrEmpty(AddMessage))
         {
             MyMessageBox.ShowMessage("Exception", AddMessage);
             return;
         }
         TreeNode NewNode;
         if (String.IsNullOrEmpty(AddBsonElement.getElement().Name))
         {
             //Array Or Document
             NewNode = new TreeNode();
         }
         else
         {
             NewNode = new TreeNode(AddBsonElement.getElement().Name);
         }
         if (_IsElement)
         {
             NewNode.Tag = AddBsonElement.getElement();
         }
         else
         {
             NewNode.Tag = AddBsonElement.getElement().Value;
         }
         _SelectNode.Nodes.Add(NewNode);
     }
     this.Close();
 }