예제 #1
0
 public void removeModule(ModuleControl module)
 {
     this.tcMain.SelectedTab.Controls.Remove(module);
     module.Dispose();
     this.ResetModuleControlPositions();
     this.updateControls(this.tcMain.SelectedIndex);
 }
예제 #2
0
        public void createModule(int year, System.EventHandler callbackOpen, System.EventHandler callbackRemove, Module module)
        {
            ModuleControl tmp = new ModuleControl(module);

            tmp.Anchor = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top);
            tmp.hookFaceClick(callbackOpen);
            tmp.hookRemoveClick(callbackRemove);
            //tmp.Width = this.tcMain.TabPages[year].Width - 2 - ((this.tcMain.TabPages[year].VerticalScroll.Visible) ? (System.Windows.Forms.SystemInformation.VerticalScrollBarWidth) : (0));
            //tmp.Width = this.tcMain.TabPages[year].Width;
            //tmp.Margin = new Padding(5);
            //tmp.Location =  new Point(0, this.tcMain.TabPages[year].AutoScrollPosition.Y + ((this.tcMain.TabPages[year].Controls.Count - 2) * 55) + Int32.Parse(Properties.Resources.MODULE_POSITION_OFFSET));

            if (this.InvokeRequired)
            {
                this.Invoke((MethodInvoker) delegate
                {
                    this.tcMain.TabPages[year].Controls.Add(tmp);
                    this.ResetModuleControlPositions(year);
                    this.updateControls(year);
                });
            }
            else
            {
                this.tcMain.TabPages[year].Controls.Add(tmp);
                this.ResetModuleControlPositions(year);
                this.updateControls(year);
            }
        }
        public void RemoveModuleHandler(object sender, EventArgs e)
        {
            ModuleControl control = (ModuleControl)((Button)sender).Parent;

            this.course.Years[this.selectedYear - 1].RemoveModule(control.Module);
            this.view.Invoke((MethodInvoker) delegate { this.view.removeModule(control); });
        }
        public void OpenModuleHandler(object sender, EventArgs e)
        {
            ModuleControl m = null;

            if (sender is ModuleControl)
            {
                m = (ModuleControl)sender;
            }
            else
            {
                m = (ModuleControl)((Control)sender).Parent;
            }
            this.moduleWindow.Module = m.Module;
            this.moduleWindow.populateAndShow();
        }