/// <summary> /// Initializes the plugins that have been loaded during application startup. /// </summary> public void InitializePlugIns() { foreach (IPlugIn plugIn in _plugins.Values) { try { if (HostWindow != null) { HostWindow.SetStatus(null, "Initializing " + plugIn.PluginName); } plugIn.InitializePlugIn(); } catch (Exception exp) { if (HostWindow == null) { throw; } HostWindow.DisplayMessageBox( null, string.Format("Error Initializing {0}:{1}{2}", plugIn.PluginName, Environment.NewLine, exp), "Plugin Error", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, 0, null, null); } } }
/// <summary> /// Execute the command. /// </summary> public override void Execute() { try { HostWindow.SetPointerState(Cursors.WaitCursor); Settings.ResetConnection(); HostWindow.SetStatus(null, "Connection reset"); } finally { HostWindow.SetPointerState(Cursors.Default); } }
/// <summary>Execute the command.</summary> public override void Execute() { IQueryBatchProvider batchProvider = HostWindow.ActiveChildForm as IQueryBatchProvider; if (batchProvider == null) { HostWindow.DisplaySimpleMessageBox(null, "No results to save as a 'DataSet'.", "Save Results as DataSet XML Error"); } else { DataSet ds = null; if (batchProvider.Batch != null) { if (batchProvider.Batch.Queries.Count > 1) { BatchQuerySelectForm querySelectForm = Services.Resolve <BatchQuerySelectForm>(); querySelectForm.Fill(batchProvider.Batch); querySelectForm.ShowDialog(); if (querySelectForm.DialogResult == DialogResult.OK) { ds = querySelectForm.SelectedQuery.Result; } } else if (batchProvider.Batch.Queries.Count == 1) { ds = batchProvider.Batch.Queries[0].Result; } } if (ds == null) { return; } using (SaveFileDialog saveFileDialog = new SaveFileDialog()) { saveFileDialog.Title = "Save Results as DataSet XML"; saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer); saveFileDialog.Filter = Properties.Settings.Default.XmlFileDialogFilter; if (saveFileDialog.ShowDialog(HostWindow.Instance) == DialogResult.OK) { ds.WriteXml(saveFileDialog.FileName, XmlWriteMode.WriteSchema); string msg = string.Format("Saved results to file: '{0}'", saveFileDialog.FileName); HostWindow.SetStatus(HostWindow.ActiveChildForm, msg); } } } }