Пример #1
0
        public void Move(int sourceIndex, int destinationIndex)
        {
            SpreadsheetColumn spreadsheetColumn = this.list[sourceIndex];

            this.list.RemoveAt(sourceIndex);
            this.list.Insert(sourceIndex < destinationIndex ? destinationIndex - 1 : destinationIndex, spreadsheetColumn);
        }
Пример #2
0
 /// <summary>
 /// Create a Spreadsheet Cell.
 /// </summary>
 /// <param name="spreadsheetRow">The spreadsheet row associated with this cell.</param>
 /// <param name="spreadsheetColumn">The spreadsheet column associated with this cell.</param>
 public SpreadsheetCell(SpreadsheetRow spreadsheetRow, SpreadsheetColumn spreadsheetColumn)
 {
     // Initialize the Object.
     this.spreadsheetRow    = spreadsheetRow;
     this.spreadsheetColumn = spreadsheetColumn;
     this.style             = spreadsheetColumn.Style;
     this.IsModified        = true;
 }
Пример #3
0
 public AnimatedCell(SpreadsheetColumn spreadsheetColumn, SpreadsheetRow spreadsheetRow, Style[] animationArray)
 {
     // Initialize the object. Note that the first color in the sequence was set when the change in value was discovered, so
     // the sequencing actually begins with the second style in the sequence of colors.
     this.AnimationIndex    = 1;
     this.AnimationArray    = animationArray;
     this.SpreadsheetColumn = spreadsheetColumn;
     this.SpreadsheetRow    = spreadsheetRow;
 }
Пример #4
0
        /// <summary>
        /// Compares an AnimatedCell address to another object.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            // Compare this against another AnimatedCell.
            if (obj is AnimatedCell)
            {
                AnimatedCell operand = (AnimatedCell)obj;

                // The rows are compared by testing the primary key elements of each row.
                foreach (DataColumn dataColumn in this.SpreadsheetRow.Table.PrimaryKey)
                {
                    int comparison = this.SpreadsheetRow[dataColumn].CompareTo(operand.SpreadsheetRow[dataColumn]);
                    if (comparison != 0)
                    {
                        return(comparison);
                    }
                }

                // If the two rows are the same, compare the column.
                return(this.SpreadsheetColumn.Ordinal.CompareTo(operand.SpreadsheetColumn.Ordinal));
            }

            // Compare this object against the column and row addresses.
            if (obj is object[])
            {
                // Extract the row and column from the arguments.
                SpreadsheetColumn spreadsheetColumn = (SpreadsheetColumn)((object[])obj)[0];
                SpreadsheetRow    spreadsheetRow    = (SpreadsheetRow)((object[])obj)[1];

                // The rows are compared by testing the primary key elements of each row.
                foreach (DataColumn dataColumn in this.SpreadsheetRow.Table.PrimaryKey)
                {
                    int comparison = this.SpreadsheetRow[dataColumn].CompareTo(spreadsheetRow[dataColumn]);
                    if (comparison != 0)
                    {
                        return(comparison);
                    }
                }

                // If the two rows are the same, compare the column.
                return(this.SpreadsheetColumn.Ordinal.CompareTo(spreadsheetColumn.Ordinal));
            }

            // Any other comparison isn't supported.
            throw new Exception(string.Format("Can't compare {0} to type {1}", obj.GetType().ToString(),
                                              this.GetType().ToString()));
        }
Пример #5
0
 public int IndexOf(SpreadsheetColumn spreadsheetColumn)
 {
     return(this.list.IndexOf(spreadsheetColumn));
 }
Пример #6
0
 public void Remove(SpreadsheetColumn spreadsheetColumn)
 {
     this.list.Remove(spreadsheetColumn);
     this.dictionary.Remove(spreadsheetColumn.ColumnName);
 }
Пример #7
0
 public void Add(SpreadsheetColumn spreadsheetColumn)
 {
     this.list.Add(spreadsheetColumn);
     this.dictionary.Add(spreadsheetColumn.ColumnName, spreadsheetColumn);
 }