public List<String> GetCurrentDBCollectionNames() { //var server = Program.MongoXMLManager.CurrentServer.Name; //var database = Program.MongoXMLManager.CurrentServer.CurrentDatabase.Name; var executor = new JavaScriptExecuter() ; executor.QueryExecutionConfiguration.NoFeedBack = true; //custom function defined in script file! var func = "GetCollectionNames();"; var results = executor.ExecuteMongo(func); if (!String.IsNullOrWhiteSpace(executor.MessageManager.GetJavascriptQueryError())) { ErrorManager.Write(executor.MessageManager.GetJavascriptQueryError()); } var r = results.Split( new String[]{"\r\n"}, StringSplitOptions.RemoveEmptyEntries) .ToList(); return r; }
public bool Init(Mode mode, String filePath = null) { this.text_box.KeyDown += new System.Windows.Forms.KeyEventHandler(this.KeyDownHandler); this.text_box.KeyUp += text_box_KeyUp; text_box.Margins[0].Width = 20; //mode whether new or existing switch (mode) { case Mode.New: EnsureQueryFilePathExists(); break; case Mode.Existing: this.QueryFilePath = filePath; EnsureQueryFilePathExists(); break; case Mode.Last: this.QueryFilePath = Program.MainXMLManager.LastFilePath; EnsureQueryFilePathExists(); break; case Mode.FileDialog: this.QueryFilePath = this.OpenOpenFileDialog(); EnsureQueryFilePathExists(); break; } //form tile this.Text = this.QueryFilePath; this.text_box.Text = FileManager.ReadFromFile(this.QueryFilePath); //resize window this.WindowState = FormWindowState.Maximized; this.Show(); //set output type SetQueryOutputDisplayType(); //instantiate child class _queryExecuter = new JavaScriptExecuter(); return true; }