/// <summary> /// Sets the UI widgets as per a given filter object /// </summary> /// <param name="ef">The given filter object</param> private void Initialize(EventCustomize ec) { bDefaults = false; lmcCustomView.ConsoleTree = ec.ConsoleTree; lmcCustomView.StandardMenus = ec.StandardMenus; lmcCustomView.StandardToolbar = ec.StandardToolbar; lmcCustomView.StatusBar = ec.StatusBar; lmcCustomView.TaskpadNavigationpads = ec.TaskpadNavigationpads; cbToolbars.Checked = ec.Toolbars; cbMenus.Checked = ec.Menus; }
public CustomizeViewForm(EventCustomize ec) : this() { // either set the defaults or initialize as per the existing settings if (ec == null) { SetDefaults(); } else { Initialize(ec); } }
/// <summary> /// Event raises when we click on any contextmenu item /// And then performs the specified action /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void cm_OnMenuClick(object sender, EventArgs e) { // assure that the sender is a MenuItem MenuItem mi = sender as MenuItem; if (mi == null) { return; } switch (mi.Text.Trim()) { case "&Save Log file as...": { if (exportLogsaveFileDialog.ShowDialog(this) == DialogResult.OK) { switch (exportLogsaveFileDialog.FilterIndex) { case 1: ExportLogFile(1, exportLogsaveFileDialog.FileName.ToString()); break; case 2: ExportLogFile(2, exportLogsaveFileDialog.FileName.ToString()); break; case 3: container.ShowError("Eventlog export to XML not implemented"); break; } } break; } case "&Add/Remove Columns...": { _displayedcolumn.Clear(); _availableColumns.Clear(); foreach (ColumnHeader ch in lvEvents.Columns) { if (ch.Width != 0) { _displayedcolumn.Add(ch.Text); } } string[] columnlist = null; if (memberType == EventViewerNodeType.PLUGIN) { columnlist = _PluginColumns; } else { columnlist = _LogColumns; } foreach (string col in columnlist) { bool isMatchFound = false; foreach (string column in _displayedcolumn) { if (column.Trim().Equals(col.Trim())) { isMatchFound = true; break; } } if (!isMatchFound) { _availableColumns.Add(col); } } AddRemoveColumnsForm arcf = new AddRemoveColumnsForm(_availableColumns, _displayedcolumn, memberType); if (arcf.ShowDialog(this) == DialogResult.OK) { if (memberType == EventViewerNodeType.LOG) { AddRemoveColumnsForm.Diplayedcolumns = AddRemoveColumnsForm.logDisplayedcolumns; } else if (memberType == EventViewerNodeType.PLUGIN) { AddRemoveColumnsForm.Diplayedcolumns = AddRemoveColumnsForm.pluginDisplayedcolumns; } if (AddRemoveColumnsForm.Diplayedcolumns != null && AddRemoveColumnsForm.Diplayedcolumns.Count != 0) { ShowHideColumns(); } } break; } case "C&ustomize View...": { CustomizeViewForm cvf = new CustomizeViewForm(ec); if (cvf.ShowDialog(this) == DialogResult.OK) { // if the user pressed ok, ask the form for the new EventCustomize instance // (this could be null if the user has reverted to default values) ec = cvf.Customizeview; } break; } case "Re&fresh": { FillComboWithLogCount(); break; } case "&Clear all Events": { OnClear_Clicked(sender, null); } break; case "&Filter...": { this.OnFilter_Clicked(sender, null); break; } case "Prop&erties": { this.OnEventProperties_Clicked(); break; } case "&Help": { ShowHelp(); break; } } }