private FeedColumnLayout FeedColumnLayoutFromCurrentSettings() { try { var layout = new FeedColumnLayout(); lock (Columns) { if (_sorter.SortColumnIndex >= 0 && _sorter.SortColumnIndex < Columns.Count) { layout.SortByColumn = Columns[_sorter.SortColumnIndex].Key; layout.SortOrder = _sorter.SortOrder; } int[] colOrder = GetColumnOrderArray(); var aCols = new List <string>(Columns.Count); var aColWidths = new List <int>(Columns.Count); for (int i = 0; i < Columns.Count; i++) { aCols.Add(Columns[colOrder[i]].Key); aColWidths.Add(Columns[colOrder[i]].Width); } layout.Columns = aCols; layout.ColumnWidths = aColWidths; } return(layout); } catch { return(null); } }
private void RaiseFeedColumnLayoutModifiedEvent(FeedColumnLayout layout) { if (ListLayoutModified != null) { try { ListLayoutModified(this, new ListLayoutEventArgs(layout)); } catch (Exception ex) { _log.Error("Event ListLayoutModified() failed", ex); } } }
/// <summary> /// Tests for relevant modifications related to the listview layout /// and raise the ListLayoutModified event /// </summary> public void CheckForLayoutModifications() { FeedColumnLayout layout = _layout; if (layout != null) { GuiInvoker.Invoke(this, delegate { FeedColumnLayout current = FeedColumnLayoutFromCurrentSettings(); if (!layout.Equals(current)) { RaiseFeedColumnLayoutModifiedEvent(current); } }); } }
private bool RaiseBeforeFeedColumnLayoutChangeEventCancel(FeedColumnLayout newLayout) { bool cancel = false; if (BeforeListLayoutChange != null) { var e = new ListLayoutCancelEventArgs(newLayout, false); try { BeforeListLayoutChange(this, e); cancel = e.Cancel; } catch (Exception ex) { _log.Error("Event BeforeListLayoutChange() failed", ex); } } return(cancel); }
/// <summary> /// Take over any layout modifications, so CheckForLayoutModifications() will /// not raise the ListLayoutModified event /// </summary> public void ApplyLayoutModifications() { _layout = FeedColumnLayoutFromCurrentSettings(); }
public ListLayoutCancelEventArgs(FeedColumnLayout newLayout, bool cancel) : base(cancel) { this._layout = newLayout; }
public ListLayoutEventArgs(FeedColumnLayout layout) : base() { this._layout = layout; }