Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 private void RaiseFeedColumnLayoutModifiedEvent(FeedColumnLayout layout)
 {
     if (ListLayoutModified != null)
     {
         try
         {
             ListLayoutModified(this, new ListLayoutEventArgs(layout));
         }
         catch (Exception ex)
         {
             _log.Error("Event ListLayoutModified() failed", ex);
         }
     }
 }
Exemplo n.º 3
0
        /// <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);
                    }
                });
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 /// <summary>
 /// Take over any layout modifications, so CheckForLayoutModifications() will
 /// not raise the ListLayoutModified event
 /// </summary>
 public void ApplyLayoutModifications()
 {
     _layout = FeedColumnLayoutFromCurrentSettings();
 }
Exemplo n.º 6
0
 public ListLayoutCancelEventArgs(FeedColumnLayout newLayout, bool cancel) : base(cancel)
 {
     this._layout = newLayout;
 }
Exemplo n.º 7
0
 public ListLayoutEventArgs(FeedColumnLayout layout) : base()
 {
     this._layout = layout;
 }