protected override void ShowPersonalization(object sender, CommandEventArgs e) { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); string defaultPersonalization = null; if (Configuration != null && Configuration.Presentation != null) { defaultPersonalization = Configuration.Presentation; } using (ColumnPickerDialog columnPickerDialog = new ColumnPickerDialog(defaultPersonalization)) { columnPickerDialog.Grid = Grid; columnPickerDialog.Groupable = false; if (columnPickerDialog.ShowDialog(ParentWindow) != DialogResult.OK) { return; } ColumnCollection = new ColumnInfoCollection(columnPickerDialog.GetColumns()); UpdateFields(true); SavePersonalization(this); } }
protected override void AddColumns() { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); // Health Grid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; InstanceStateProperty propertyTranslator = PropertyTranslator as InstanceStateProperty; GridControlImageTextColumn stateColumn = new GridControlImageTextColumn(); stateColumn.CellContentsRequested += new EventHandler <GridControlImageTextColumn.ImageTextEventArgs>(StateCellContentsRequested); string str = $"{propertyTranslator.TargetType.Name}-*-{propertyTranslator.TargetType.Id}-*-Health"; AddColumn(stateColumn, ConsoleResources.GetString("State", CurrentCulture), new Field("Health", typeof(int), str, Field.SortInfos.Sortable | Field.SortInfos.Sort, 0), false); // Maintenance Mode DataGridViewColumn MaintenanceModeColumn = AddColumn(new GridControlImageTextColumn( new Dictionary <string, Image> { { true.ToString(), (Image)ConsoleResources.GetObject("MaintenanceModeImage", CurrentCulture) }, { false.ToString(), new Bitmap(16, 16) } }, new Dictionary <string, string> { { true.ToString(), ConsoleResources.GetString("InMaintenanceMode", CurrentCulture) }, { false.ToString(), ConsoleResources.GetString("NotInMaintenanceMode", CurrentCulture) } }) { DefaultKey = string.Empty, Width = 22, ShowText = false, DefaultHeaderCellType = typeof(GridControlImageColumnHeaderCell) }, typeof(bool), ConsoleResources.GetString("MaintenanceModeText", CurrentCulture), "InMaintenanceMode", false, false); GridControlImageColumnHeaderCell headerCell = (GridControlImageColumnHeaderCell)MaintenanceModeColumn.HeaderCell; headerCell.Image = (Image)ConsoleResources.GetObject("MaintenanceModeImage", CurrentCulture); headerCell.ImagePadding = new Padding(2); AddColumn(new GridControlTextColumn(), typeof(string), "Name", "DisplayName", false, true); foreach (ManagementPackProperty property in ManagementGroup.EntityTypes.GetClass(new Guid("ea99500d-8d52-fc52-b5a5-10dcd1e9d2bd")).GetProperties()) // Microsoft.Windows.Computer) { Dbg.Log($"adding {property.DisplayName}"); Type type = property.SystemType; Type contentType = null; if (type == typeof(string) || type == typeof(int)) { contentType = type; } string headerText = property.DisplayName ?? property.Name; if (contentType == null) { if (type == typeof(Enum)) { type = typeof(string); } Field sortField = new Field(null, type, property, 0); DataGridViewColumn dataGridViewColumn = AddColumn(new GridControlTextColumn(), headerText, sortField, true); dataGridViewColumn.Visible = true; dataGridViewColumn.FillWeight = 1f; } else { DataGridViewColumn dataGridViewColumn = AddColumn(contentType, headerText, property, true); dataGridViewColumn.Visible = true; dataGridViewColumn.FillWeight = 1f; } } }
protected override void OnSystemColorsChanged(EventArgs e) { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); RefreshColors(); }
private void OnTaskStatusChange(Guid batchId, IList <Microsoft.EnterpriseManagement.Runtime.TaskResult> results, bool completed) { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); if (results == null) { return; } if (!IsHandleCreated) { return; } lock (onTaskStatusChangeLock) { Guid taskId = Guid.Empty; try { taskId = results?.FirstOrDefault()?.TaskId ?? Guid.Empty; OnTaskStatusChangeDelegate taskCallback = MPTasks[taskId].TaskCallbacks[batchId]; if (taskId != Guid.Empty && taskCallback != null) { if (taskCallback.Target is System.Windows.Forms.Control callbackControl) { try { callbackControl.Invoke(taskCallback, new object[] { results, completed }); } catch { } } } if (completed && taskId != Guid.Empty) { MPTasks[taskId].TaskCallbacks.Remove(batchId); } } catch { } if (taskId != Guid.Empty) { try { int tasksInProgress = MPTasks[taskId].TaskCallbacks.Count; if (tasksInProgress == 0) { Invoke(new Action <string>(UpdateTaskStatus), new object[] { "" }); } else { string msg = $"{tasksInProgress} task{(tasksInProgress == 1 ? "" : "s")} {(tasksInProgress == 1 ? "is" : "are")} waiting to complete..."; Invoke(new Action <string>(UpdateTaskStatus), new object[] { msg }); } Dbg.Log($"Callback dictionary size: {tasksInProgress}"); } catch { Invoke(new Action <string>(UpdateTaskStatus), new object[] { "" }); } } } }
private void UpdatePersonalizeCommandStatus(object sender, CommandStatusEventArgs e) { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); e.CommandStatus.Enabled = true; }
private void OnShowPersonalization(object sender, CommandEventArgs e) { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); ShowPersonalization(sender, e); }
protected void AddActions_Personalization() { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); AddTaskItem(TaskCommands.ActionsTaskGroup, ViewCommands.Personalize); }
private void OnShowViewProperties(object sender, CommandEventArgs e) { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); OnViewPropertiesCommand(sender, e); }
private void OnViewPropertiesStatus(object sender, CommandStatusEventArgs e) { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); UpdateViewPropertiesCommandStatus(sender, e); }
protected void AddContextMenu_InstanceProperties(ContextMenuHelper contextMenu) { Dbg.Log($"Entering {MethodBase.GetCurrentMethod().Name}"); contextMenu.AddContextMenuItem(ViewCommands.Properties, new EventHandler <CommandEventArgs>(OnShowInstanceProperties), new EventHandler <CommandStatusEventArgs>(OnInstancePropertiesStatus)); }