コード例 #1
0
        private void ImportThread()
        {
            _timetable = _importer.ImportTimetable();
            Invoke(new MethodInvoker(delegate
            {
                if (_timetable != null)
                {
                    // build relational data
                    _timetable.BuildEquivalency();
                    _timetable.BuildCompatibility();

                    Next();
                }
                else
                {
                    MessageBox.Show("Failed to import timetable data.", "Import",
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    Close();
                }
            }));
        }
コード例 #2
0
        private void MoveItems(bool left)
        {
            ListView origional, next;

            if (left)
            {
                origional = listViewRequired;
                next      = listViewIgnored;
            }
            else
            {
                origional = listViewIgnored;
                next      = listViewRequired;
            }

            if (origional.SelectedItems.Count == 0 || origional.SelectedItems[0] == null)
            {
                return;
            }

            var item = origional.SelectedItems[0];

            item.BackColor = SystemColors.Window;
            var type = (Type)item.Tag;

            type.Required = false;
            _timetable.BuildCompatibility();

            var index = origional.SelectedIndices[0];

            origional.Items.RemoveAt(index);

            // look through each subject group in the ignored list
            foreach (ListViewGroup group in next.Groups)
            {
                // if we've found the subject group
                if (@group.Tag != type.Subject)
                {
                    continue;
                }
                // set group and add to list
                item.Group = @group;
                next.Items.Add(item);
                break;
            }

            // select the next item in the list
            if (index == origional.Items.Count)
            {
                index--;
            }
            if (index >= 0)
            {
                origional.Items[index].Selected = true;
                origional.Select();
            }
            else
            {
                buttonRequire.Enabled = false;
                buttonIgnore.Enabled  = false;
            }

            UpdateClashHighlight();
        }