/// <summary> /// Set the header based on the currently selected log. /// </summary> /// <param name="host">The type of host.</param> /// <param name="presenter">The presenter to use.</param> public override void Update(FunctionHost host, IFunctionPresenter presenter) { LogViewerDocument document = App.Instance.Content.ActiveDocument as LogViewerDocument; IsVisible = (document != null); IsEnabled = (document != null && document.SelectedLog != null); }
/// <summary> /// View the logs for the selected log parameters. /// </summary> /// <param name="sender">The object that raised the event.</param> /// <param name="e">Event arguments.</param> private void ViewLogs(object sender, EventArgs e) { try { LogListenerManagerWindow dlg = sender as LogListenerManagerWindow; if (App.Instance.SalesForceApp.CurrentProject != null && dlg != null && dlg.SelectedLogParameters != null) { IDocument[] documents = App.Instance.Content.GetDocumentsByEntity(dlg.SelectedLogParameters); if (documents.Length > 0) { App.Instance.Content.ActiveDocument = documents[0]; } else { using (App.Wait("Opening log viewer")) { LogViewerDocument document = new LogViewerDocument( App.Instance.SalesForceApp.CurrentProject, dlg.SelectedLogParameters); document.Refresh(); App.Instance.Content.OpenDocument(document); } } } dlg.Close(); } catch (Exception err) { App.HandleException(err); } }
/// <summary> /// Open the find dialog. /// </summary> public override void Execute() { LogViewerDocument document = App.Instance.Content.ActiveDocument as LogViewerDocument; if (document != null) { document.SearchText(); } }
/// <summary> /// Go to the selected log text. /// </summary> public override void Execute() { LogViewerDocument document = App.Instance.Content.ActiveDocument as LogViewerDocument; if (document != null && document.SelectedLogUnit != null) { document.SelectText(document.SelectedLogUnit); } }
/// <summary> /// Delete the selected log. /// </summary> public override void Execute() { LogViewerDocument document = App.Instance.Content.ActiveDocument as LogViewerDocument; if (document != null && document.SelectedLog != null) { if (App.MessageUser("Are you sure you want to delete the selected log?", "Confirm delete", System.Windows.MessageBoxImage.Warning, new string[] { "Yes", "No" }) == "Yes") { using (App.Wait("Deleting log")) { App.Instance.SalesForceApp.CurrentProject.Client.Diagnostic.DeleteLogs(new Log[] { document.SelectedLog }); document.Refresh(); } } } }