/// <summary> /// 初始化 /// </summary> /// <param name="mDataViewInfo">Filter也是DataViewInfo的一个属性,所以这里加上参数</param> public frmQuery(MongoDBHelper.DataViewInfo mDataViewInfo) { InitializeComponent(); CurrentDataViewInfo = mDataViewInfo; SystemManager.SelectObjectTag = mDataViewInfo.strDBTag; _mongoCol = SystemManager.GetCurrentCollection(); }
/// <summary> /// Create a DataView Tab /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ViewDataRecord() { //由于Collection 和 Document 都可以触发这个事件,所以,先把Tag以前的标题头去掉 //Collectiong:XXXX 和 Document:XXXX 都统一成 XXXX String DataKey = SystemManager.SelectTagData; if (ViewTabList.ContainsKey(DataKey)) { tabView.SelectTab(ViewTabList[DataKey]); } else { MongoDBHelper.DataViewInfo mDataViewInfo = new MongoDBHelper.DataViewInfo(); mDataViewInfo.strDBTag = SystemManager.SelectObjectTag; mDataViewInfo.IsUseFilter = false; mDataViewInfo.IsReadOnly = config.IsReadOnly; mDataViewInfo.IsSafeMode = config.IsSafeMode; mDataViewInfo.mDataFilter = new DataFilter(); ctlDataView DataViewctl; switch (SystemManager.SelectTagType) { case MongoDBHelper.GRID_FILE_SYSTEM_TAG: DataViewctl = new ctlGFSView(mDataViewInfo); break; case MongoDBHelper.USER_LIST_TAG: DataViewctl = new ctlUserView(mDataViewInfo); break; default: DataViewctl = new ctlDocumentView(mDataViewInfo); break; } DataViewctl.mDataViewInfo = mDataViewInfo; TabPage DataTab = new TabPage(SystemManager.GetCurrentCollection().Name); DataTab.Tag = SystemManager.SelectObjectTag; DataTab.ToolTipText = SystemManager.SelectObjectTag; switch (SystemManager.SelectTagType) { case MongoDBHelper.COLLECTION_TAG: DataTab.ImageIndex = 2; break; case MongoDBHelper.USER_LIST_TAG: DataTab.ImageIndex = 3; break; default: DataTab.ImageIndex = 4; break; } DataTab.Controls.Add(DataViewctl); DataViewctl.Dock = DockStyle.Fill; tabView.Controls.Add(DataTab); ToolStripMenuItem DataMenuItem = new ToolStripMenuItem(SystemManager.GetCurrentCollection().Name); DataMenuItem.Tag = DataTab.Tag; DataMenuItem.Image = GetSystemIcon.TabViewImage.Images[DataTab.ImageIndex]; collectionToolStripMenuItem.DropDownItems.Add(DataMenuItem); DataMenuItem.Click += new EventHandler( (x, y) => { tabView.SelectTab(DataTab); } ); ViewTabList.Add(DataKey, DataTab); ViewInfoList.Add(DataKey, mDataViewInfo); DataViewctl.CloseTab += new System.EventHandler( (x, y) => { tabView.Controls.Remove(DataTab); ViewTabList.Remove(DataKey); ViewInfoList.Remove(DataKey); collectionToolStripMenuItem.DropDownItems.Remove(DataMenuItem); DataTab = null; } ); tabView.SelectTab(DataTab); } }
/// <summary> /// 初始化 /// </summary> /// <param name="_DataViewInfo"></param> public ctlDataView(MongoDBHelper.DataViewInfo _DataViewInfo) { InitializeComponent(); mDataViewInfo = _DataViewInfo; }
public frmExport(MongoDBHelper.DataViewInfo info) { InitializeComponent(); viewinfo = info; }