コード例 #1
0
ファイル: Table.cs プロジェクト: preskenis/mana-schedule
 //Copy all rows from source to target via clone
 public static void CopyRows(TableRows source, TableRows target)
 {
     foreach (TableRow row in source)
     {
         target.Add((TableRow)row.Clone());
     }
 }
コード例 #2
0
        private IOperation CreateRowRemovingFromTableOperation(string[] row)
        {
            TableRow tempDeletedRow = new TableRow(row);

            System.Action redo = () =>
            {
                Execute.OnUIThread(() =>
                {
                    if (!TableRows.Remove(new TableRow(row)))
                    {
                        tempDeletedRow = null;
                        return;
                    }
                    NotifyOfPropertyChange(() => TableRows);
                });
            };
            System.Action undo = () =>
            {
                Execute.OnUIThread(() =>
                {
                    if (tempDeletedRow != null)
                    {
                        TableRows.Add(tempDeletedRow);
                        NotifyOfPropertyChange(() => TableRows);
                    }
                });
            };

            return(new SimpleOperation(redo, undo));
        }
コード例 #3
0
        /// <summary>
        /// Advances the SqlDataReader to the next record.
        /// </summary>
        public override bool Read()
        {
            if (!_dbReader.Read())
            {
                return(false);
            }

            _rowValues = new object[_dbReader.FieldCount];

            for (var i = 0; i < _dbReader.FieldCount; i++)
            {
                if (IsBinary(i))
                {
                    _rowValues[i] = GetSqlBytes(i);
                }
                else
                {
                    _rowValues[i] = _dbReader.GetValue(i);
                }
            }

            _tableRows?.Add(new TableRow(_rowValues)
            {
                Depth = _dbReader.Depth
            });
            return(true);
        }
コード例 #4
0
        private IOperation CreateAddingToTableOperation(params string[] row)
        {
            var tempIsTableVisibile = IsTableVisible;
            var newRow = new TableRow(row);

            System.Action redo = () =>
            {
                Execute.OnUIThread(() =>
                {
                    TableRows.Add(newRow);
                    NotifyOfPropertyChange(() => TableRows);
                });
                ShowTable();
            };
            System.Action undo = () =>
            {
                Execute.OnUIThread(() =>
                {
                    TableRows.RemoveLast(newRow);
                    NotifyOfPropertyChange(() => TableRows);
                });
                if (tempIsTableVisibile)
                {
                    ShowTable();
                }
                else
                {
                    HideTable();
                }
            };

            return(new SimpleOperation(redo, undo));
        }
コード例 #5
0
 public void AddTableRow(DynamicTableEntity tableEntity)
 {
     TableRows.Add(tableEntity);
     SortTableRows();
 }