Exemplo n.º 1
0
        private void FillDataGrid()
        {
            GridTimeMeasurements.ItemsSource     = _dt;
            GridTimeMeasurements.IsFilterEnabled = true;
            GridTimeMeasurements.RefreshData();

            if (_dt.Rows.Count == 0)
            {
                GridTimeMeasurementsInfo.Content   = rm.GetString("NoEntries");
                btnTimeMeasurementDelete.IsEnabled = false;
                btnTimeMeasurementAccept.IsEnabled = false;
            }
            else
            {
                if (_dt.Rows.Count > 1)
                {
                    GridTimeMeasurementsInfo.Content = _dt.Rows.Count.ToString() + " " + rm.GetString("Entry");
                }
                else
                {
                    GridTimeMeasurementsInfo.Content = rm.GetString("AnEntry");
                }
                btnTimeMeasurementDelete.IsEnabled = true;
                btnTimeMeasurementAccept.IsEnabled = true;
            }
        }
Exemplo n.º 2
0
        private void GridTimeMeasurements_CheckEdit_Unchecked(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.Wait;

            // Unmark
            for (int i = 0; i < GridTimeMeasurements.VisibleRowCount; i++)
            {
                int rowHandle = GridTimeMeasurements.GetRowHandleByVisibleIndex(i);

                GridTimeMeasurements.SetCellValue(rowHandle, GridTimeMeasurements.Columns["marked"], false);
            }

            GridTimeMeasurements.RefreshData();

            this.Cursor = Cursors.Arrow;
        }
Exemplo n.º 3
0
        private void btnTimeMeasurementDelete_Click(object sender, RoutedEventArgs e)
        {
            // Delete
            Int32 _Count_Marked = 0;

            DataTable _dt = (DataTable)GridTimeMeasurements.ItemsSource;

            foreach (DataRow _dr in _dt.Rows)
            {
                if (_dr["marked"] != DBNull.Value)
                {
                    if (Convert.ToBoolean(_dr["marked"].ToString()))
                    {
                        _Count_Marked++;
                    }
                }
            }

            if (_Count_Marked > 0)
            {
                try
                {
                    _dt = (DataTable)GridTimeMeasurements.ItemsSource;
                    while (_Count_Marked > 0)
                    {
                        foreach (DataRow _dr in _dt.Rows)
                        {
                            if (_dr["marked"] != DBNull.Value)
                            {
                                if (Convert.ToBoolean(_dr["marked"].ToString()))
                                {
                                    _Count_Marked--;
                                    _dt.Rows.Remove(_dr);
                                    break;
                                }
                            }
                        }
                    }
                }
                catch
                {
                }

                GridTimeMeasurements.RefreshData();
            }
        }
Exemplo n.º 4
0
        private void GridTimeMeasurements_CheckEdit_Checked(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.Wait;

            // Clear marked flag
            DataTable _dt = (DataTable)GridTimeMeasurements.DataSource;

            foreach (DataRow _dr in _dt.Rows)
            {
                _dr["marked"] = false;
            }

            for (int i = 0; i < GridTimeMeasurements.VisibleRowCount; i++)
            {
                int rowHandle = GridTimeMeasurements.GetRowHandleByVisibleIndex(i);

                GridTimeMeasurements.SetCellValue(rowHandle, GridTimeMeasurements.Columns["marked"], true);
            }

            GridTimeMeasurements.RefreshData();

            this.Cursor = Cursors.Arrow;
        }