public void DrawSummaryForHighlightedRow(CheckableDataGridViewRow row, SummaryTextComponent summaryComponent, Action runOnUrlClick) { Program.Invoke(this, delegate { LicenseDataGridViewRow lRow = row as LicenseDataGridViewRow; if (lRow == null || lRow.XenObject == null) { return; } summaryPanel.Title = lRow.XenObject.Name; summaryPanel.HelperUrl = Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT; summaryPanel.HelperUrlVisible = lRow.HelperUrlRequired && !Controller.ReadOnlyView; summaryPanel.WarningVisible = lRow.WarningRequired; summaryPanel.WarningText = lRow.WarningText; summaryPanel.SummaryText = summaryComponent; switch (lRow.RowStatus) { case LicenseDataGridViewRow.Status.Information: summaryPanel.WarningIcon = Resources._000_Alert2_h32bit_16; break; case LicenseDataGridViewRow.Status.Warning: summaryPanel.WarningIcon = Resources._000_error_h32bit_16; break; default: summaryPanel.WarningIcon = Resources._000_Tick_h32bit_16; break; } summaryPanel.InformationVisible = false; summaryPanel.RunOnUrlClick = runOnUrlClick; }); }
public void PopulateGrid(List <IXenObject> itemsToShow, List <IXenObject> selectedItems) { if (itemsToShow.Count < 1) { DisableAllButtons(); return; } // show pool members as individual hosts if needed (i.e. can activate free license) var allItemsToShow = new List <IXenObject>(); foreach (var xenObject in itemsToShow) { if (LicenseDataGridViewRow.RowShouldBeExpanded(xenObject)) { allItemsToShow.AddRange(xenObject.Connection.Cache.Hosts); } else { allItemsToShow.Add(xenObject); } } AddToGrid(allItemsToShow); foreach (LicenseDataGridViewRow row in ConvertXenObjects(allItemsToShow).ConvertAll(r => r as LicenseDataGridViewRow)) { UpdateButtonEnablement(new List <LicenseDataGridViewRow> { row }); } CheckPreSelectedRows(selectedItems); SelectAndSummariseSelectedRow(allItemsToShow, selectedItems); }
private void checkableDataGridView_RowUpdated(object sender, CheckableDataGridViewRowEventArgs e) { LicenseCheckableDataGridView senderGrid = sender as LicenseCheckableDataGridView; if (senderGrid == null || e.RowIndex >= senderGrid.Rows.Count || e.RowIndex < 0) { return; } LicenseDataGridViewRow lRow = senderGrid.Rows[e.RowIndex] as LicenseDataGridViewRow; if (lRow == null) { return; } Controller.SetStatusIcon(e.RowIndex, lRow.RowStatus); if (!e.RefreshGrid && senderGrid.SelectedRows.Count > 0 && senderGrid.SelectedRows[0].Index == e.RowIndex) { Controller.SummariseSelectedRow(checkableDataGridView.GetCheckableRow(e.RowIndex)); } if (e.RefreshGrid) { senderGrid.SortAndRefresh(); } }
public void DrawStatusIcon(int rowIndex, LicenseDataGridViewRow.Status status) { Program.Invoke(Program.MainWindow, delegate { SuspendLayout(); try { DataGridViewCell cell = new DataGridViewImageCell { ValueIsIcon = true, ValueType = typeof (Bitmap), Value = new Bitmap(1,1) }; if (status == LicenseDataGridViewRow.Status.Information) cell.Value = Resources._000_Alert2_h32bit_16; if (status == LicenseDataGridViewRow.Status.Warning) cell.Value = Resources._000_error_h32bit_16; if (status == LicenseDataGridViewRow.Status.Ok) cell.Value = Resources._000_Tick_h32bit_16; DataGridViewImageColumn col = Columns[statusColumnKey] as DataGridViewImageColumn; if (col == null) return; if (rowIndex < Rows.Count && rowIndex >= 0) { var r = Rows[rowIndex]; if (r.Cells.Count > col.Index) { if (r.Cells[col.Index] is DataGridViewImageCell) r.Cells[col.Index] = cell; } } } finally { ResumeLayout(); } }); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); var rows = new List <DataGridViewRow>(); foreach (string warning in _warnings) { var row = new LicenseDataGridViewRow(); row.Cells.Add(new DataGridViewTextBoxCell { Value = warning }); rows.Add(row); } dataGridViewEx1.Rows.AddRange(rows.ToArray()); }
public void DrawSummaryForHighlightedRow(CheckableDataGridViewRow row, SummaryTextComponent summaryComponent, Action runOnUrlClick) { Program.Invoke(this, delegate { LicenseDataGridViewRow lRow = row as LicenseDataGridViewRow; if (lRow == null) { return; } summaryPanel.Title = lRow.XenObject.Name; summaryPanel.HelperUrl = Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT; summaryPanel.HelperUrlVisible = true; summaryPanel.WarningVisible = lRow.WarningRequired; summaryPanel.WarningText = lRow.WarningText; summaryPanel.SummaryText = summaryComponent; summaryPanel.WarningIcon = lRow.RowStatus == LicenseDataGridViewRow.Status.Warning ? SystemIcons.Error.ToBitmap() : Resources._000_WarningAlert_h32bit_32; summaryPanel.InformationVisible = false; summaryPanel.RunOnUrlClick = runOnUrlClick; }); }
public void DrawRowStatusIcon(int rowIndex, LicenseDataGridViewRow.Status rowStatus) { checkableDataGridView.SetStatusIcon(rowIndex, rowStatus); }
public void SetStatusIcon(int rowIndex, LicenseDataGridViewRow.Status status) { LicenseController.SetStatusIcon(rowIndex, status); }
public void StringBasedRepsonsesToRowState(TestCase tc) { Mock<SummaryTextComponent> baseComponent = new Mock<SummaryTextComponent>(); StringBuilder sb = new StringBuilder(); baseComponent.Setup(c => c.BuildSummary()).Returns(sb); Mock<Host> host = ObjectFactory.BuiltObject<Host>(ObjectBuilderType.ClearwaterHost, id); Mock<ILicenseStatus> ls = new Mock<ILicenseStatus>(); ls.Setup(l => l.CurrentState).Returns(tc.State); ls.Setup(l =>l.ExpiryDate).Returns(tc.Expiry); ls.Setup(l => l.LicenseExpiresIn).Returns(tc.ExpiresIn); CheckableDataGridViewRow row = new LicenseDataGridViewRow(host.Object, ls.Object); LicenseManagerSummaryLicenseExpiresDecorator decorator = new LicenseManagerSummaryLicenseExpiresDecorator(baseComponent.Object, row); decorator.BuildSummary(); Assert.That(sb.ToString().Contains(Messages.LICENSE_MANAGER_SUMMARY_LICENSE_EXPIRES)); Assert.That(sb.ToString().Contains(tc.Contains)); baseComponent.Verify(c=>c.BuildSummary(), Times.Once()); }
public void TestExpiredClearwater() { Mock<SummaryTextComponent> baseComponent = new Mock<SummaryTextComponent>(); StringBuilder sb = new StringBuilder(); baseComponent.Setup(c => c.BuildSummary()).Returns(sb); Mock<Host> host = ObjectFactory.BuiltObject<Host>(ObjectBuilderType.ClearwaterHost, id); ObjectManager.MockConnectionFor(id).Setup(c => c.IsConnected).Returns(true); Mock<ILicenseStatus> ls = new Mock<ILicenseStatus>(); ls.Setup(l => l.CurrentState).Returns(LicenseStatus.HostState.Expired); CheckableDataGridViewRow row = new LicenseDataGridViewRow(host.Object, ls.Object); LicenseManagerSummaryLicenseExpiresDecorator decorator = new LicenseManagerSummaryLicenseExpiresDecorator(baseComponent.Object, row); decorator.BuildSummary(); Assert.That(sb.Length, Is.EqualTo(0)); baseComponent.Verify(c => c.BuildSummary(), Times.Once()); }
public void SetStatusIcon(int rowIndex, LicenseDataGridViewRow.Status rowStatus) { View.DrawRowStatusIcon(rowIndex, rowStatus); }
public void SetStatusIcon(int rowIndex, LicenseDataGridViewRow.Status status) { LicenseView.DrawStatusIcon(rowIndex, status); }