Exemple #1
0
        void UpdateBoundListFromTreeViewNodes(TreeNodeCollection nodes, bool clear = true)
        {
            if (clear)
            {
                Cursor.Current = Cursors.WaitCursor;

                boundList.RaiseListChangedEvents = false;
                boundList.Clear();
            }

            foreach (TreeNode node in nodes)
            {
                if (node.Tag is List <ExtendedMyWorldObject> )
                {
                    foreach (ExtendedMyWorldObject piece in (node.Tag as List <ExtendedMyWorldObject>))
                    {
                        if (node.Checked && (piece.Locked || filtersControl1.ItemPassesFilters(piece)))
                        {
                            boundList.Add(piece);
                        }
                    }
                }

                UpdateBoundListFromTreeViewNodes(node.Nodes, false);
            }

            if (clear)
            {
                boundList.RaiseListChangedEvents = true;
                boundList.ResetBindings();

                Cursor.Current = Cursors.Arrow;
            }
        }
Exemple #2
0
        private void deckEditSaveButton_Click(object sender, EventArgs e)
        {
            Deck deck = (Deck)deckDropdown.SelectedItem;

            try
            {
                deck.Save(dataAccess);
                deckCardListBinding.ResetBindings();
                MessageBox.Show("Deck saved.", "Save successful");
            } catch (InvalidOperationException error)
            {
                MessageBox.Show(error.Message, "Error");
            }
        }
Exemple #3
0
        private void btAddTask_Click(object sender, EventArgs e)
        {
            TimeSpan ts = new TimeSpan((int)numericHours.Value, (int)numericMinutes.Value, (int)numericSeconds.Value - 1);

            if (ts.TotalSeconds <= 5)
            {
                MessageBox.Show("The timespan must be over 5 seconds");
            }
            else
            {
                Backup backup = new Backup(tbTaskName.Text);

                backup.TaskProgressChanged += new ProgressChangedEventHandler(backup_ProgressChanged);
                backup.TaskCompleted       += new RunWorkerCompletedEventHandler(backup_TaskCompleted);

                backup.Repeat         = chkRepeatTask.Checked;
                backup.RepeatTimeSpan = ts;
                backup.Source         = mc.Config.WorldPath;
                backup.Destination    = mc.Config.BackupFolder;
                backup.StartTask();
                tasks.Add(backup);
                tasks.ResetBindings();
            }
        }
Exemple #4
0
 public void Populate(IEnumerable <TItem> values)
 {
     Items.RaiseListChangedEvents = false;
     try
     {
         Items.Clear();
         foreach (var value in values)
         {
             Items.Add(value);
         }
     }
     finally
     {
         Items.RaiseListChangedEvents = true;
     }
     Items.ResetBindings();
 }
Exemple #5
0
        private void AddNewCustomer()
        {
            Customer   customer = new Customer();
            EditorForm f        = new EditorForm(customer, ContactTitles);

            try
            {
                if (f.ShowDialog() == DialogResult.OK)
                {
                    blCustomers.Add(customer);
                    blCustomers.ResetBindings();

                    /*
                     * Here we are changing the sort to show the new customer in a-z order
                     * rather than sitting at the bottom of the DataGridView.
                     */
                    dataGridView1.Sort(dataGridView1.Columns["CompanyName"], ListSortDirection.Ascending);
                }
            }
            finally
            {
                f.Dispose();
            }
        }
Exemple #6
0
        private void UpdateGridView()
        {
            _gridModel = new SortableBindingList<LogEntry>(_engine.MainView);

            dataGridView1.DataSource = _gridModel;
            _gridModel.ResetBindings();
        }
 private void RefreshData()
 {
     bindingList.ResetBindings();
     dataGridView1.DataSource = bindingList;
 }