/// <summary> /// Triggers row update event /// Pass in the replacement row /// </summary> /// <param name="toUpdate">Replacement Row</param> private void UpdateRow(CheckableDataGridViewRow toUpdate, bool refreshGrid) { if (toUpdate == null) { return; } int indexToUpdate; Program.AssertOnEventThread(); indexToUpdate = ReplaceStoredRow(toUpdate); if (indexToUpdate >= storedRows.Count || indexToUpdate < 0) { log.DebugFormat("Could not update row '{0}'; Stored rows contain '{1}' items", indexToUpdate, storedRows.Count); return; } View.DrawUpdatedRow(storedRows[indexToUpdate].CellText, storedRows[indexToUpdate].CellDataLoaded, storedRows[indexToUpdate].Disabled, indexToUpdate); View.TriggerRowUpdatedEvent(indexToUpdate, refreshGrid); }
private int ReplaceStoredRow(CheckableDataGridViewRow toUpdate) { if (storedRows == null) { return(-1); } CheckableDataGridViewRow lookupRow = storedRows.FirstOrDefault(r => r == toUpdate); if (lookupRow == null) { return(-1); } int indexToUpdate = lookupRow.Index; if (indexToUpdate >= storedRows.Count || indexToUpdate < 0) { log.DebugFormat("Unexpected index in ReplaceStoredRow row '{0}'; Stored rows contain '{1}' items", indexToUpdate, storedRows.Count); return(-1); } storedRows.Remove(storedRows[indexToUpdate]); storedRows.Insert(indexToUpdate, toUpdate); return(indexToUpdate); }
public void DrawRow(CheckableDataGridViewRow gvRow) { SuspendLayout(); try { CheckableDataGridViewRow row = gvRow; if (Rows.Contains(row)) { Rows.Remove(row); } row.Cells.Clear(); DataGridViewCheckBoxCell cbCell = new DataGridViewCheckBoxCell { Value = gvRow.Checked }; row.Cells.Add(cbCell); foreach (object cellValue in gvRow.CellText) { DataGridViewCellStyle style = row.Disabled ? RowStyle(true) : UpdatingRowStyle(row.CellDataLoaded); row.Cells.Add(GetCell(style, cellValue)); } Rows.Add(row); } finally { ResumeLayout(); } }
private void cRow_CellDataUpdated(object sender, EventArgs e) { CheckableDataGridViewRow row = sender as CheckableDataGridViewRow; if (row == null) { return; } UpdateRow(row, true); }
public void ToggleRowHighlighted(CheckableDataGridViewRow row) { int rowMatch = storedRows.FindIndex(r => r == row); if (rowMatch < 0) { return; } ToggleRowHighlighted(rowMatch); }
public bool Equals(CheckableDataGridViewRow other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(XenObject.Equals(other.XenObject)); }
private void RedrawRow(CheckableDataGridViewRow row) { //Should start the cell update => cell updated event => UpdateRow => trigger row updated event CheckableDataGridViewRow cRow = storedRows.FirstOrDefault(r => r == row); cRow.BeginCellUpdate(); if (cRow.Checked) { ToggleRowChecked(cRow.Index); } }
public void ToggleRowsChecked(List <CheckableDataGridViewRow> rows) { foreach (CheckableDataGridViewRow row in rows) { CheckableDataGridViewRow row1 = row; int rowMatch = storedRows.FindIndex(r => r == row1); if (rowMatch < 0) { return; } ToggleRowChecked(rowMatch); } }
public void DrawRowAsLocked(bool lockStatus, int rowIndex) { if (rowIndex < 0 || rowIndex >= Rows.Count) { return; } CheckableDataGridViewRow row = Rows[rowIndex] as CheckableDataGridViewRow; if (row != null) { row.LockDisabledState = lockStatus; } }
public void DrawSetRowInformation(int rowIndex, string information) { if (rowIndex < 0 || rowIndex >= Rows.Count) { return; } CheckableDataGridViewRow row = Rows[rowIndex] as CheckableDataGridViewRow; if (row != null) { row.DisabledReason = information; } }
public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } CheckableDataGridViewRow other = obj as CheckableDataGridViewRow; if (other == null) { return(false); } return(Equals(other)); }
private void CheckableDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } CheckableDataGridView senderGrid = sender as CheckableDataGridView; if (senderGrid == null) { return; } CheckableDataGridViewRow senderRow = senderGrid.Rows[e.RowIndex] as CheckableDataGridViewRow; if (senderRow == null) { return; } Controller.CellContentClicked(e.ColumnIndex, e.RowIndex, senderRow.Disabled); }
protected override KeyValuePair<bool, string> DisableOtherRowsInContext(CheckableDataGridViewRow checkedRow, CheckableDataGridViewRow otherRow) { if(Helpers.ClearwaterOrGreater(checkedRow.XenObject.Connection)) { return new KeyValuePair<bool, string>(!Helpers.ClearwaterOrGreater(otherRow.XenObject.Connection), Messages.SELECTION_CANNOT_BE_MIXED_WITH_CLEARWATER); } return new KeyValuePair<bool, string>(Helpers.ClearwaterOrGreater(otherRow.XenObject.Connection), Messages.SELECTION_CANNOT_BE_MIXED_WITH_CLEARWATER); }
public LicenseManagerSummaryDecorator(SummaryTextComponent component, CheckableDataGridViewRow row) : base(component) { Row = row as LicenseDataGridViewRow; Debug.Assert(Row != null && row != null, "Failure to cast CheckableDataGridViewRow to LicenseDataGridViewRow"); }
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 ToggleRowHighlighted(CheckableDataGridViewRow row) { int rowMatch = storedRows.FindIndex(r => r == row); if (rowMatch < 0) return; ToggleRowHighlighted(rowMatch); }
public void HighlightOnlyRow(CheckableDataGridViewRow row) { int rowMatch = storedRows.FindIndex(r => r == row); HighlightOnlyRow(rowMatch); }
private SummaryTextComponent BuildSummaryComponent(CheckableDataGridViewRow row) { LicenseManagerSummaryComponent component = new LicenseManagerSummaryComponent(); LicenseManagerSummaryDecorator licenseTypeDecorator = new LicenseManagerSummaryLicenseTypeDecorator(component, row); LicenseManagerSummaryDecorator licenseSocketsDecorator = new LicenseManagerSummaryLicenseSocketsDecorator(licenseTypeDecorator, row); LicenseManagerSummaryDecorator licenseExpiresDecorator = new LicenseManagerSummaryLicenseExpiresDecorator(licenseSocketsDecorator, row); LicenseManagerSummaryDecorator licenseServerDecorator = new LicenseManagerSummaryLicenseServerDecorator(licenseExpiresDecorator, row); return licenseServerDecorator; }
public void SummariseSelectedRow(CheckableDataGridViewRow dataToSummarise) { if(!dataToSummarise.XenObject.Connection.IsConnected) { View.DrawSummaryForHighlightedRow(dataToSummarise, new LicenseManagerSummaryComponent(), LaunchUrl(InvisibleMessages.UPSELL_SA)); SetSummaryInformation(Messages.POOL_OR_HOST_IS_NOT_CONNECTED); return; } SummaryTextComponent component = BuildSummaryComponent(dataToSummarise); View.DrawSummaryForHighlightedRow(dataToSummarise, component, LaunchUrl(InvisibleMessages.UPSELL_SA)); if(dataToSummarise.Disabled) SetSummaryInformation(dataToSummarise.DisabledReason); }
public bool Equals(CheckableDataGridViewRow other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return XenObject.Equals(other.XenObject); }
public void DrawRowMW(CheckableDataGridViewRow row) { Program.Invoke(Program.MainWindow, () => DrawRow(row)); }
protected virtual KeyValuePair<bool, string> DisableOtherRowsInContext(CheckableDataGridViewRow checkedRow, CheckableDataGridViewRow otherRow) { return new KeyValuePair<bool, string>(false, String.Empty); }
private IXenObject GetXenObject(CheckableDataGridViewRow row) { return row.XenObject is Pool ? Helpers.GetMaster(row.XenObject.Connection) : row.XenObject; }
private void RedrawRow(CheckableDataGridViewRow row) { //Should start the cell update => cell updated event => UpdateRow => trigger row updated event CheckableDataGridViewRow cRow = storedRows.FirstOrDefault(r => r == row); cRow.BeginCellUpdate(); if(cRow.Checked) ToggleRowChecked(cRow.Index); }
private IXenObject GetXenObject(CheckableDataGridViewRow row) { return(row.XenObject is Pool?Helpers.GetMaster(row.XenObject.Connection) : row.XenObject); }
public LicenseManagerSummaryLicenseExpiresDecorator(SummaryTextComponent component, CheckableDataGridViewRow row) : base(component, row) { }
public void DrawRow(CheckableDataGridViewRow gvRow) { SuspendLayout(); try { CheckableDataGridViewRow row = gvRow; if(Rows.Contains(row)) Rows.Remove(row); row.Cells.Clear(); DataGridViewCheckBoxCell cbCell = new DataGridViewCheckBoxCell { Value = gvRow.Checked }; row.Cells.Add(cbCell); foreach (object cellValue in gvRow.CellText) { DataGridViewCellStyle style = row.Disabled ? RowStyle(true) : UpdatingRowStyle(row.CellDataLoaded); row.Cells.Add(GetCell(style, cellValue)); } Rows.Add(row); } finally { ResumeLayout(); } }
protected virtual KeyValuePair <bool, string> DisableOtherRowsInContext(CheckableDataGridViewRow checkedRow, CheckableDataGridViewRow otherRow) { return(new KeyValuePair <bool, string>(false, String.Empty)); }
public void DrawHighlightedRow(CheckableDataGridViewRow row) { checkableDataGridView.HighlightRow(row); }
private int ReplaceStoredRow(CheckableDataGridViewRow toUpdate) { if (storedRows == null) return -1; CheckableDataGridViewRow lookupRow = storedRows.FirstOrDefault(r => r == toUpdate); if(lookupRow == null) return -1; int indexToUpdate = lookupRow.Index; if (indexToUpdate >= storedRows.Count || indexToUpdate < 0) { log.DebugFormat("Unexpected index in ReplaceStoredRow row '{0}'; Stored rows contain '{1}' items", indexToUpdate, storedRows.Count); } storedRows.Remove(storedRows[indexToUpdate]); storedRows.Insert(indexToUpdate, toUpdate); return indexToUpdate; }
protected override KeyValuePair<bool, string> DisableOtherRowsInContext(CheckableDataGridViewRow checkedRow, CheckableDataGridViewRow otherRow) { return new KeyValuePair<bool, string>( LicenseStatus.GetLicensingModel(checkedRow.XenObject.Connection) != LicenseStatus.GetLicensingModel(otherRow.XenObject.Connection), Messages.SELECTION_CANNOT_BE_MIXED_FOR_LICENSING); }
public void HighlightRow(CheckableDataGridViewRow row) { Controller.HighlightOnlyRow(row); }
/// <summary> /// Triggers row update event /// Pass in the replacement row /// </summary> /// <param name="toUpdate">Replacement Row</param> private void UpdateRow(CheckableDataGridViewRow toUpdate) { if (toUpdate == null) return; int indexToUpdate; lock (StoredRowsLock) { indexToUpdate = ReplaceStoredRow(toUpdate); if (indexToUpdate >= storedRows.Count || indexToUpdate < 0) { log.DebugFormat("Could not update row '{0}'; Stored rows contain '{1}' items", indexToUpdate, storedRows.Count); return; } View.DrawUpdatedRow(storedRows[indexToUpdate].CellText, storedRows[indexToUpdate].CellDataLoaded, storedRows[indexToUpdate].Disabled, indexToUpdate); } View.TriggerRowUpdatedEvent(indexToUpdate); }
public void DrawRowMW(CheckableDataGridViewRow row) { Program.Invoke(Program.MainWindow, ()=>DrawRow(row)); }
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; }); }
private void cRow_CellDataUpdated(CheckableDataGridViewRow row) { UpdateRow(row, true); }