Exemple #1
0
        private void RefreshList(IJobList jobs)
        {
            Rows.Clear();
            var rows     = new List <DataGridViewRow>();
            var rowIndex = 0;

            foreach (var job in jobs.All)
            {
                var row = new DataGridViewRow
                {
                    Tag = job
                };
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                row.Cells.Add(new DataGridViewTextBoxCell());
                job.RowIndex = rowIndex;
                rows.Add(row);
                rowIndex++;
            }
            Rows.AddRange(rows.ToArray());
        }
Exemple #2
0
        public override void ParseCsv()
        {
            var lines = GetLines();

            Headers.AddRange(GetHeaders(lines));
            Rows.AddRange(GetRows(lines));
        }
Exemple #3
0
        public TicTacViewModel(List <GridModel> rows, string status, string gameMode)
        {
            Status   = status;
            GameMode = gameMode;

            Rows.AddRange(rows.Select(row => new Row(row.FirstColumn, row.SecondColumn, row.ThirdColumn)));
        }
Exemple #4
0
 public void Update(GridSplitter gs, Grid grid)
 {
     Rows.Clear();
     Cols.Clear();
     Rows.AddRange(grid.RowDefinitions.Select(d => (DtoGridLength)d.Height));
     Cols.AddRange(grid.ColumnDefinitions.Select(d => (DtoGridLength)d.Width));
 }
Exemple #5
0
        public ConsoleTable Attach(int columnIndex, object column, params object[] rowColumn)
        {
            if (rowColumn.Length != Rows.Count)
            {
                throw new ArgumentOutOfRangeException(CreateOutOfRangeMessage(rowColumn.Length, Rows.Count));
                //AddRow(rowColumn);
            }

            Columns.Insert(columnIndex, column);


            var cpy = new List <object[]>(Rows.Count);
            int lim = rowColumn.Length;

            for (int i = 0; i < lim; i++)
            {
                var row   = Rows[i];
                var rgCpy = Arrays.Insert(row, columnIndex, rowColumn[i]);

                cpy.Add(rgCpy);
            }

            Rows.Clear();
            Rows.AddRange(cpy);

            return(this);
        }
Exemple #6
0
        private async void CopyPreviousTasksToSelectedDateExecute(object obj)
        {
            var localtimeEntriesForThisWeek = new List <TimeEntry>();

            IsSyncing = true;

            try
            {
                var localStartDate = StartDate;
                do
                {
                    var localEnddate = localStartDate.AddDays(6);
                    localtimeEntriesForThisWeek = await _timeEntryService.GetTimeEntriesByDateIgnoreEmptyTimeEntries(localStartDate, localEnddate);

                    localStartDate = localStartDate.AddDays(-7);
                } while (!localtimeEntriesForThisWeek.Any() && localStartDate >= DateTime.Today.AddMonths(-3));
            }
            catch (Exception ex)
            {
                HandleSyncError(ex);
            }

            if (localtimeEntriesForThisWeek.Any())
            {
                _timeEntriesForThisWeek.Clear();
                Rows.AddRange(_taskItemViewmodelFactory.ExtractEmptyItemTaskitems(localtimeEntriesForThisWeek, StartDate));
            }
            HasChanges = false;
            UpdateBottom();
        }
Exemple #7
0
 public void Load(Box box)
 {
     Cards.AddRange(box.Cards.Select(x => mapper.Map <Card, CardViewModel>(x)));
     Columns.AddRange(box.Columns.Select(x => mapper.Map <Column, ColumnViewModel>(x)));
     Rows.AddRange(box.Rows.Select(x => mapper.Map <Row, RowViewModel>(x)));
     Boards.AddRange(box.Boards.Select(x => mapper.Map <Board, BoardViewModel>(x)));
     Loaded = true;
 }
Exemple #8
0
        public void Merge(Table otherTable)
        {
            if (ColumnNames.Length != otherTable.ColumnNames.Length)
            {
                throw new ApplicationException("No se pueden unificar tablas que no tienen la misma estructura.");
            }

            Rows.AddRange(otherTable.Rows);
        }
Exemple #9
0
        public void AddRow(string[] values)
        {
            if (Columns.Count != values.Length)
            {
                throw new ArgumentOutOfRangeException("values", "The values count shall be equals to columns count.");
            }

            Rows.AddRange(values);
        }
Exemple #10
0
        public void Load(Box box)
        {
            Cards.AddRange(box.Cards.Select(x => mapper.Map <Card, CardViewModel>(x)));
            Columns.AddRange(box.Columns.Select(x => mapper.Map <Column, ColumnViewModel>(x)));
            Rows.AddRange(box.Rows.Select(x => mapper.Map <Row, RowViewModel>(x)));
            Boards.AddRange(box.Boards.Select(x => mapper.Map <Board, BoardViewModel>(x)));
            LogEntries.AddRange(box.Log.Select(x => mapper.Map <Kamban.Repository.Models.LogEntry, LogEntryViewModel>(x)));

            Loaded = true;
        }
Exemple #11
0
        public void DrawNodes()
        {
            SuspendLayout();
            try
            {
                TreeGridAdvancedNode selnode = null;
                if (SelectedRows.Count == 1)
                {
                    if (SelectedRows[0] is TreeGridRow)
                    {
                        selnode = ((TreeGridRow)SelectedRows[0]).Node;
                    }
                }
                Rows.Clear();
                // Disable user sorting if mor than ona level
                bool disablesort = false;
                foreach (DataGridViewColumn ncol in Columns)
                {
                    if (ncol is TreeGridAdvancedColumn)
                    {
                        disablesort = true;
                    }
                }
                if (disablesort)
                {
                    foreach (DataGridViewColumn ncol in Columns)
                    {
                        ncol.SortMode = DataGridViewColumnSortMode.NotSortable;
                    }
                }

                MainNode.Expanded = true;
                List <TreeGridRow> AddList = new List <TreeGridRow>();
                foreach (TreeGridAdvancedNode nnode in MainNode.Childs)
                {
                    TreeGridAdvancedNode.FillExpanded(nnode, AddList);
                }
                Rows.AddRange(AddList.ToArray());
                if (selnode != null)
                {
                    foreach (DataGridViewRow xrow in Rows)
                    {
                        if (((TreeGridRow)xrow).Node == selnode)
                        {
                            CurrentCell = xrow.Cells[FirstDisplayedScrollingColumnIndex];
                        }
                    }
                }
            }
            finally
            {
                ResumeLayout();
            }
        }
Exemple #12
0
        private void UpdateLayout()
        {
            HasChanges = false;
            Rows.Clear();

            var localRows = _taskItemViewmodelFactory.ExtractItemTaskitems(_timeEntriesForThisWeek, StartDate);

            //todo: find a good way to order items
            //localRows = localRows.OrderBy(x => x.CustomerName).ThenBy(x => x.ProjectName).ThenBy(x => x.TaskName).ToList();
            Rows.AddRange(localRows);
            UpdateBottom();
        }
Exemple #13
0
 void BindResult(PagedResult <StoredMessage> pagedResult)
 {
     try
     {
         BeginDataUpdate();
         Rows.Clear();
         Rows.AddRange(pagedResult.Result);
     }
     finally
     {
         EndDataUpdate();
     }
 }
        /// <summary>
        /// Converts query result rows into Row objects, and adds them to the collection.
        /// </summary>
        internal void AddRows(DatabaseQuery query, IEnumerable <object> rows)
        {
            if (query.Raw.OrderBy == null || query.Raw.OrderBy.Count == 0)
            {
                // We can access the enumerable in parallel, the order doesn't matter.
                Rows.AddRange(rows.AsParallel().Select(
                                  obj => CreateRowFromObservableCollection(obj)));

                return;
            }

            // Access the enumerable in a series, because the order matters.
            Rows.AddRange(rows.Select(obj => CreateRowFromObservableCollection(obj)));
        }
Exemple #15
0
        public override void Sort(DataGridViewColumn dataGridViewColumn, ListSortDirection direction)
        {
            var comp = new OutlookGridRowComparer(dataGridViewColumn.Index, direction);
            var rows = new DataGridViewRow[this.Rows.Count];

            Rows.CopyTo(rows, 0);
            Rows.Clear();
            base.Sort(dataGridViewColumn, direction);
            Rows.AddRange(rows);
            if (dataSource == null)
            {
                dataSource = new DataSourceManager(this, null);
            }
            dataSource.Sort(comp);
            FillGrid(groupTemplate);
        }
Exemple #16
0
        private void Delete()
        {
            var lowIndex = int.MaxValue;
            var count    = 0;

            foreach (DataGridViewRow row in SelectedRows)
            {
                if (row.Index < lowIndex)
                {
                    lowIndex = row.Index;
                }

                count++;
            }

            // Copy all rows
            var allRows = new DataGridViewRow[RowCount];

            Rows.CopyTo(allRows, 0);

            // Copy all rows that are not deleted
            // The "- 1" is because the last, empty row is counted, and we don't want it.
            var keptRows = new DataGridViewRow[RowCount - count - 1];

            Array.Copy(allRows, 0, keptRows, 0, lowIndex);
            Array.Copy(allRows, lowIndex + count, keptRows, lowIndex, keptRows.Length - lowIndex);

            // Find the currently "top" row
            var scrollIndex = FirstDisplayedScrollingRowIndex;

            // Clear and refill
            Rows.Clear();
            Rows.AddRange(keptRows);

            // Scroll back
            if (scrollIndex >= RowCount)
            {
                scrollIndex = RowCount - 1;
            }

            FirstDisplayedScrollingRowIndex = scrollIndex;

            // Renumber the rows
            NumberRows(0);

            PendingChanges = true;
        }
Exemple #17
0
        public override void ParseCsv()
        {
            Clear();
            var rows = GetRows();

            if (rows.Count > 0)
            {
                if (HasHeaderRow)
                {
                    Headers.AddRange(rows[0]);
                }
                Rows.AddRange(HasHeaderRow ? rows.Skip(1) : rows);
                foreach (var row in Rows)
                {
                    row.Parent = this;
                }
            }
        }
        void GetMoreData()
        {
            var pk = Table.PK;

            if (pk == null)
            {
                Rows.AddRange(Connection.Query(Table,
                                               "select * from \"" + Table.TableName + "\""));
            }
            else
            {
                var lastId = Rows.Count > 0 ? pk.GetValue(Rows[Rows.Count - 1]) : 0;
                Rows.AddRange(Connection.Query(Table,
                                               "select * from \"" + Table.TableName + "\"" +
                                               " where \"" + pk.Name + "\" > ? " +
                                               " order by \"" + pk.Name + "\"" +
                                               " limit " + PageSize, lastId));
            }
        }
        private void TryRebindMessageList(PagedResult <StoredMessage> pagedResult)
        {
            try
            {
                _lockUpdate = !ShouldUpdateMessages(pagedResult);

                using (new GridFocusedRowPreserver <StoredMessage>(this))
                {
                    Rows.Clear();
                    Rows.AddRange(pagedResult.Result);
                }
            }
            finally
            {
                _lockUpdate = false;
            }

            AutoFocusFirstRow();
        }
        void TryRebindMessageList(PagedResult <StoredMessage> pagedResult)
        {
            if (ShouldUpdateMessages(pagedResult))
            {
                var currentItem = FocusedRow;

                Rows.Clear();
                Rows.AddRange(pagedResult.Result);

                if (currentItem != null)
                {
                    FocusedRow = Rows.FirstOrDefault(item => item.Id == currentItem.Id);
                }
            }

            if (FocusedRow == null && Rows.Count > 0)
            {
                FocusedRow = Rows[0];
            }
        }
Exemple #21
0
 public void AddRows(params ITableRow[] rows)
 {
     Rows.AddRange(rows);
 }
Exemple #22
0
 public void Append(params ExcelRow[] newRows)
 {
     Rows.AddRange(newRows);
 }
Exemple #23
0
 public void ColumnCollection_Count_IsAccurate()
 {
     Assert.IsTrue(UnderTest.Count == 0, "Count is Zero Failed");
     Rows.AddRange(new Row[] { new Row(1), new Row(1), new Row(3) });
     Assert.IsTrue(UnderTest.Count == 3, "Count is 3 Failed");
 }
Exemple #24
0
 public void Append(IEnumerable <ExcelRow> newRows)
 {
     Rows.AddRange(newRows);
 }
Exemple #25
0
 protected RemoteDataStoreDataBase(DataContainer other)
 {
     Columns.AddRange(other.Columns);
     Rows.AddRange(other.Rows);
 }
Exemple #26
0
        /// <summary>
        /// 移除行
        /// </summary>
        /// <param name="rowIndex"></param>
        public void EditRow(int rowIndex)
        {
            if (DesignMode)
            {
                return;
            }
            try
            {
                this.panRow.Controls.Clear();
                var NewRows = new List <IDataGridViewRow>();
                if (m_columns == null || m_columns.Count <= 0)
                {
                    return;
                }
                if (this.Rows != null)
                {
                    int     index          = 0;
                    Control lastItem       = null;
                    int     intSourceCount = 0;
                    intSourceCount = this.Rows.Count;

                    for (int i = 0; i < intSourceCount; i++)
                    {
                        IDataGridViewRow row = (IDataGridViewRow)Activator.CreateInstance(m_rowType);
                        row.DataSource = this.Rows[i].DataSource;
                        row.Columns    = m_columns;
                        row.RowIndex   = index;
                        List <Control> lstCells = new List <Control>();
                        row.IsShowCheckBox = m_isShowCheckBox;
                        if (i == rowIndex)
                        {
                            row.AddCells();
                            row.BindingAddCellData();
                        }
                        else
                        {
                            row.ReloadCells();
                            row.BindingCellData();
                        }

                        Control rowControl = (row as Control);
                        this.panRow.Controls.Add(rowControl);
                        row.RowHeight            = m_rowHeight;
                        rowControl.Dock          = DockStyle.Top;
                        row.CellClick           += (a, b) => { SetSelectRow(rowControl, b); };
                        row.CheckBoxChangeEvent += (a, b) => { SetSelectRow(rowControl, b); };
                        row.RowCustomEvent      += (a, b) => { if (RowCustomEvent != null)
                                                               {
                                                                   RowCustomEvent(a, b);
                                                               }
                        };
                        row.SourceChanged += RowSourceChanged;
                        rowControl.BringToFront();
                        NewRows.Add(row);
                        ++index;

                        if (lastItem == null)
                        {
                            lastItem = rowControl;
                        }
                    }

                    if (lastItem != null && intSourceCount == m_showCount)
                    {
                        lastItem.Height = this.panRow.Height - (m_showCount - 1) * m_rowHeight;
                    }
                }
                else
                {
                    foreach (Control item in this.panRow.Controls)
                    {
                        item.Visible = false;
                    }
                }
                Rows.Clear();
                Rows.AddRange(NewRows);
            }
            catch (Exception ex)
            {
            }
        }
Exemple #27
0
 public FrameV(Frame frame, Func <T, FrameV <T>, int> index)
 {
     Rows.AddRange(frame.Select((r, i) => new FrameDR(frame, i, frame.Columns.ToArray())));
     Index = index;
 }