private void Form1_Shown(object sender, EventArgs e)
        {
            // columns have been created in the designer and data property set
            dataGridView1.AutoGenerateColumns = false;

            // get people in List<Person>
            _bindingSource.DataSource = _dataOperations.ReadTimeTable();

            // subscribe to current change to handle sync'ing Time ComboBox
            _bindingSource.CurrentChanged += _bindingSource_CurrentChanged;

            // bind person list to DataGridView
            dataGridView1.DataSource = _bindingSource;

            // using hours range to populate the DomainUpDown control
            var hours = new Hours();

            HoursDomainUpDown.Items.AddRange(hours.Range(TimeIncrement.Quarterly));

            timeComboBox1.SelectedIndexChanged += TimeComboBox1_SelectedIndexChanged;

            // sync current person's start time with Time ComboBox
            //HandleCurrentChanged();
            _bindingSource.MoveLast();
            // see comments in ReadDifferences
            _dataOperations.ReadTimeTableDifferences();

            Console.WriteLine(dateTimePicker1.Value.TimeOfDay.Formatted());
        }
Exemplo n.º 2
0
        private void DateTimePickerForm_Shown(object sender, EventArgs e)
        {
            _bindingSource.DataSource       = _dataOperations.ReadTimeTableDifferences();
            bindingNavigator1.BindingSource = _bindingSource;

            txtFirstName.DataBindings.Add("Text", _bindingSource, "FirstName");
            txtlastName.DataBindings.Add("Text", _bindingSource, "LastName");

            _bindingSource.CurrentChanged        += _bindingSource_CurrentChanged;
            StartTimeDateTimePicker.ValueChanged += StartTimeDateTimePicker_ValueChanged;

            HandleCurrentChanged();
        }