protected void OnPopupOpen(PopupOpenEventArgs <ShiftReadEditDto> args) { if (args.Type == PopupType.QuickInfo) { args.Cancel = true; } }
private void miFile_PopupOpen(object sender, PopupOpenEventArgs e) { // clear existing recent items int i = miFile.SubItems.IndexOf(miFileSelectLanguage) + 1; while (miFile.SubItems[i] != miFileExit) { miFile.SubItems[i].Dispose(); miFile.SubItems.RemoveAt(i); } // add new items if (Designer.cmdRecentFiles.Enabled && Designer.RecentFiles.Count > 0) { foreach (string s in Designer.RecentFiles) { ButtonItem menuItem = new ButtonItem(); menuItem.Text = s; menuItem.Click += recentFile_Click; miFile.SubItems.Insert(i, menuItem); } // make the first item separator i = miFile.SubItems.IndexOf(miFileSelectLanguage) + 1; (miFile.SubItems[i] as ButtonItem).BeginGroup = true; } }
void FilterMenu_PopupOpen(object sender, PopupOpenEventArgs e) { if (!BGW.IsBusy) { List <string> list = new List <string>(); foreach (string item in SemesterClub.Keys) { list.Add(item); } list.Sort(); foreach (string item in list) { MenuButton mb = e.VirtualButtons[item]; mb.AutoCheckOnClick = true; mb.AutoCollapseOnClick = true; mb.Checked = (item == FiltedSemester); mb.Tag = item; mb.CheckedChanged += delegate(object sender1, EventArgs e1) { MenuButton mb1 = sender1 as MenuButton; SetClubList(mb1.Text); FiltedSemester = FilterMenu.Text = mb1.Text; mb1.Checked = true; }; } } else //如果忙碌中則提醒使用者 { e.Cancel = true; e.VirtualButtons.Text = "資料下載中..."; FISCA.Presentation.Controls.MsgBox.Show("資料下載中...\n請稍後再試"); } }
private void miReport_PopupOpen(object sender, PopupOpenEventArgs e) { bool bandsEnabled = Designer.cmdInsertBand.Enabled; miReportBands.Enabled = bandsEnabled; miReportGroupExpert.Enabled = bandsEnabled; ReportPage page = Page as ReportPage; bool isSubreport = page.Subreport != null; miReportTitle.Enabled = bandsEnabled && !isSubreport; miReportSummary.Enabled = bandsEnabled && !isSubreport; miPageHeader.Enabled = bandsEnabled && !isSubreport; miPageFooter.Enabled = bandsEnabled && !isSubreport; miColumnHeader.Enabled = bandsEnabled && !isSubreport; miColumnFooter.Enabled = bandsEnabled && !isSubreport; miOverlay.Enabled = bandsEnabled && !isSubreport; miReportTitle.Checked = page.ReportTitle != null; miReportSummary.Checked = page.ReportSummary != null; miPageHeader.Checked = page.PageHeader != null; miPageFooter.Checked = page.PageFooter != null; miColumnHeader.Checked = page.ColumnHeader != null; miColumnFooter.Checked = page.ColumnFooter != null; miOverlay.Checked = page.Overlay != null; }
public static void OutputPowerPointBeforePopup(PopupOpenEventArgs e) { if (!(_controller.ActiveOutputControl is IMultipleSlidesOutputControl multipleSlidesOutputControl)) { return; } multipleSlidesOutputControl.OutputPowerPointBeforePopup(e); }
private void mnuContextRoot_PopupOpen(object sender, PopupOpenEventArgs e) { mnuContext.Style = DotNetBarManager.Style; foreach (BaseItem item in mnuContextRoot.SubItems) { (item as ButtonItem).Checked = (item.Tag as ToolbarBase).Visible; } }
public void OnOutputPowerPointBeforePopup(object sender, PopupOpenEventArgs e) { ContentEditManager <MediaScheduleChangeInfo> .OutputPowerPointBeforePopup(e); if (e.Cancel) { OnOutputPowerPointCurrent(sender, e); } }
private void mnuContextRoot_PopupOpen(object sender, PopupOpenEventArgs e) { mnuContextRoot.SubItems.Clear(); if (!Designer.cmdChooseData.Enabled) { e.Cancel = true; return; } if ((IsDataSources || IsConnection) && Designer.cmdAddData.Enabled) { mnuContextRoot.SubItems.Add(miNewDataSource); } else if (IsVariables || IsVariable) { mnuContextRoot.SubItems.Add(miNewParameter); } else if (IsTotals || IsTotal) { mnuContextRoot.SubItems.Add(miNewTotal); } else if (CanCreateCalculatedColumn) { mnuContextRoot.SubItems.Add(miNewCalculatedColumn); miNewCalculatedColumn.Enabled = true; } if (CanEdit) { mnuContextRoot.SubItems.Add(miEdit); } if (IsTable || IsEditableColumn || IsVariable || IsTotal) { mnuContextRoot.SubItems.Add(miRename); } if (CanDelete) { mnuContextRoot.SubItems.Add(miDelete); } if (IsAliased) { mnuContextRoot.SubItems.Add(miDeleteAlias); } if (IsTable) { mnuContextRoot.SubItems.Add(miView); } if (mnuContextRoot.SubItems.Count == 0) { e.Cancel = true; } }
private void AssignButton_PopupOpen(object sender, PopupOpenEventArgs e) { if (Course.Instance.SelectedList.Count <= 0) { return; } foreach (var item in AssessmentSetup.Instance.Items) { MenuButton mb = e.VirtualButtons[item.Name]; mb.Tag = item.ID; mb.Click += new EventHandler(MenuButton_Click); } }
private void miView_PopupOpen(object sender, PopupOpenEventArgs e) { miViewGrid.Checked = ReportWorkspace.ShowGrid; miViewGuides.Checked = ReportWorkspace.ShowGuides; bool autoGuides = ReportWorkspace.AutoGuides; miViewAutoGuides.Checked = autoGuides; miViewDeleteHGuides.Enabled = !autoGuides; miViewDeleteVGuides.Enabled = !autoGuides; miViewUnitsMillimeters.Checked = ReportWorkspace.Grid.GridUnits == PageUnits.Millimeters; miViewUnitsCentimeters.Checked = ReportWorkspace.Grid.GridUnits == PageUnits.Centimeters; miViewUnitsInches.Checked = ReportWorkspace.Grid.GridUnits == PageUnits.Inches; miViewUnitsHundrethsOfInch.Checked = ReportWorkspace.Grid.GridUnits == PageUnits.HundrethsOfInch; }
/// ------------------------------------------------------------------------------------ /// <summary> /// This will make sure the appropriate item on the menu is checked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ private void Menu_PopupOpen(object sender, PopupOpenEventArgs e) { // Don't check any menu items if this tab item isn't the currently // visible tab. try { foreach (ButtonItem item in m_itemPanel.Items) { ((ButtonItem)m_menu.SubItems[item.Name]).Checked = (Checked && item.Checked); } HandleConfigureMenuPopup(m_cfgMenuItem); } catch { } }
private void miView_PopupOpen(object sender, PopupOpenEventArgs e) { // delete list of toolwindows while (miView.SubItems[0] != miViewStartPage) { miView.SubItems[0].Dispose(); miView.SubItems.RemoveAt(0); } // create list of toolwindows foreach (IDesignerPlugin plugin in Designer.Plugins) { if (plugin is ToolWindowBase) { ButtonItem menuItem = new ButtonItem(); menuItem.Text = (plugin as ToolWindowBase).Text; menuItem.Image = (plugin as ToolWindowBase).Image; eShortcut shortcut = (plugin as ToolWindowBase).Shortcut; if (shortcut != eShortcut.None) { menuItem.Shortcuts.Add(shortcut); } menuItem.Tag = plugin; menuItem.Click += toolWindow_Click; miView.SubItems.Insert(0, menuItem); } } // delete list of toolbars miViewToolbars.SubItems.Clear(); // create list of toolbars foreach (IDesignerPlugin plugin in Designer.Plugins) { if (plugin is ToolbarBase) { ButtonItem menuItem = new ButtonItem(); menuItem.Text = (plugin as ToolbarBase).Text; menuItem.Tag = plugin; menuItem.Checked = (plugin as ToolbarBase).Visible; menuItem.AutoCheckOnClick = true; menuItem.Click += toolbar_Click; miViewToolbars.SubItems.Add(menuItem); } } }
private void btnOpen_PopupOpen(object sender, PopupOpenEventArgs e) { btnOpen.SubItems.Clear(); if (Designer.cmdRecentFiles.Enabled) { foreach (string s in Designer.RecentFiles) { ButtonItem item = new ButtonItem(); item.Text = s; item.Click += recentItem_Click; btnOpen.SubItems.Insert(0, item); } } if (btnOpen.SubItems.Count == 0) { btnOpen.SubItems.Add(new ButtonItem()); } }
/// <summary> /// Processes Button PopupOpen events /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Button_PopupOpen(object sender, PopupOpenEventArgs e) { // If the user has moved the item on the calendar, then // don't permit the associated popup to be displayed if (_BoundsChanged == false) { // Reload the popup with the current list // of Appointments and CustomItems if (_CalendarView != null) { _Button.SubItems.Clear(); AddAppointments(); AddCustomItems(); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// When the side bar's context menu pops-up, we need to make sure the correct icon /// mode menu item is checked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ private void HandleSideBarContextMenuPopup(object sender, PopupOpenEventArgs e) { ButtonItem contextMenu = sender as ButtonItem; if (contextMenu == null || contextMenu.SubItems.Count == 0) { return; } SideBarTab tab = m_navPane.CheckedButton as SideBarTab; if (tab == null) { return; } // Setting the first item in the context menu will automatically adjust the // other item appropriately since they're both in the same option group. if (m_contextMenu.SubItems[0].Name == kLargeIconModeItem) { ((ButtonItem)m_contextMenu.SubItems[0]).Checked = !tab.SmallIconMode; } else if (m_contextMenu.SubItems[0].Name == kSmallIconModeItem) { ((ButtonItem)m_contextMenu.SubItems[0]).Checked = tab.SmallIconMode; } // Make only one configure menu visible. (i.e. the one corresponding to the // current tab. When the proper configure menu is found, then call its // update handler. for (int i = 3; i < m_contextMenu.SubItems.Count; i++) { m_contextMenu.SubItems[i].Visible = (m_contextMenu.SubItems[i].Name == CurrentTab.ConfigureMenuItem.Name); if (m_contextMenu.SubItems[i].Visible) { CurrentTab.HandleConfigureMenuPopup(m_contextMenu.SubItems[i] as ButtonItem); } } }
private void Button_PopupOpen(object sender, PopupOpenEventArgs e) { RibbonBarButton button = sender as RibbonBarButton; entity = "" + button.Tag; if (entity == "Class" && K12.Presentation.NLDPanels.Class.SelectedSource.Count <= 0) { return; } if (entity == "Student" && K12.Presentation.NLDPanels.Student.SelectedSource.Count <= 0) { return; } foreach (var item in JHProgramPlan.SelectAll()) { MenuButton mb = e.VirtualButtons[item.Name]; mb.Tag = item.ID; mb.Click += new EventHandler(ChangeProgramPlanID); } }
private void contextMenuBar1_PopupOpen(object sender, PopupOpenEventArgs e) { if (CurrentCard == null) { buttonItem15.Enabled = false; buttonItem16.Enabled = false; buttonItem17.Enabled = false; } else { if (richTextBox1.SelectionLength == 0) { buttonItem18.Enabled = false; } if (CurrentCard.adjust.Trim() == "") { buttonItem17.Enabled = false; } } }
private void Button_PopupOpen(object sender, PopupOpenEventArgs e) { RibbonBarButton button = sender as RibbonBarButton; entity = "" + button.Tag; if (entity == "Class" && Class.Instance.SelectedList.Count <= 0) { return; } if (entity == "Student" && Student.Instance.SelectedList.Count <= 0) { return; } foreach (var item in ScoreCalcRule.Instance.Items) { MenuButton mb = e.VirtualButtons[item.Name]; mb.Tag = item.ID; mb.Click += new EventHandler(ChangeScoreCalcRuleID); } }
private void btnActions_PopupOpen(object sender, PopupOpenEventArgs e) { while (btnActions.SubItems[btnActions.SubItems.Count - 1] != miChooseData) { btnActions.SubItems.RemoveAt(btnActions.SubItems.Count - 1); } btnActions.SubItems.AddRange(new ButtonItem[] { miNewDataSource, miNewRelation, miNewCalculatedColumn, miNewParameter, miNewTotal }); miNew.Enabled = Designer.cmdChooseData.Enabled; miOpen.Enabled = Designer.cmdChooseData.Enabled; miMerge.Enabled = Designer.cmdChooseData.Enabled; miSave.Enabled = Designer.cmdChooseData.Enabled; miChooseData.Enabled = Designer.cmdChooseData.Enabled; miNewDataSource.Enabled = Designer.cmdAddData.Enabled; miNewRelation.Enabled = Designer.cmdChooseData.Enabled; miNewParameter.Enabled = Designer.cmdChooseData.Enabled; miNewTotal.Enabled = Designer.cmdChooseData.Enabled; miNewCalculatedColumn.Enabled = Designer.cmdChooseData.Enabled && CanCreateCalculatedColumn; }
private void miWindow_PopupOpen(object sender, PopupOpenEventArgs e) { // delete list of windows while (miWindow.SubItems[0] != miWindowCloseAll) { miWindow.SubItems[0].Dispose(); miWindow.SubItems.RemoveAt(0); } // create list of windows int i = 0; foreach (DocumentWindow c in Designer.Documents) { ButtonItem menuItem = new ButtonItem(); menuItem.Text = (i + 1).ToString() + " " + c.Text; menuItem.Tag = c; menuItem.Checked = c == Designer.ActiveReportTab; menuItem.Click += window_Click; miWindow.SubItems.Insert(i, menuItem); i++; } }
protected internal override void OnExpandChange() { _ThumbTucked = false; if (!this.DesignMode && this.Expanded && this.PopupLocation.IsEmpty && this.PopupSide == ePopupSide.Default && (this.Parent is CaptionItemContainer || this.Parent is MetroTabItemContainer)) { if (this.SubItems.Count > 0 && this.SubItems[0] is ItemContainer && ((ItemContainer)this.SubItems[0]).BackgroundStyle.Class == ElementStyleClassKeys.RibbonFileMenuContainerKey) { MetroTabStrip rs = this.ContainerControl as MetroTabStrip; if (rs != null) { if (this.Parent is MetroTabItemContainer) { if (this.EffectiveStyle == eDotNetBarStyle.Windows7) this.PopupLocation = new Point(this.IsRightToLeft ? this.Bounds.Right : this.LeftInternal, this.TopInternal - 1); else this.PopupLocation = new Point(this.IsRightToLeft ? this.Bounds.Right : this.LeftInternal, this.TopInternal); } else this.PopupLocation = new Point(this.IsRightToLeft ? this.Bounds.Right : this.LeftInternal, rs.GetItemContainerBounds().Y - 1); _ThumbTucked = true; } } } if (_BackstageTab != null && _BackstageTabEnabled) { if (this.Expanded) { PopupOpenEventArgs args = new PopupOpenEventArgs(); OnPopupOpen(args); if (args.Cancel) { this.Expanded = false; return; } UpdateBackstageTabSize(); if (this.ContainerControl is IKeyTipsControl) { IKeyTipsControl kc = this.ContainerControl as IKeyTipsControl; _BackstageTab.TabStrip.ShowKeyTips = kc.ShowKeyTips; kc.ShowKeyTips = false; } OnPopupShowing(EventArgs.Empty); _BackstageTab.Visible = true; _BackstageTab.BringToFront(); _BackstageTab.Focus(); MetroTabStrip strip = this.MetroTabStrip; if (strip != null && strip.SelectedTab != null) { _LastSelectedTabItem = strip.SelectedTab; if (this.DesignMode) _LastSelectedTabItem.RenderTabState = false; else _LastSelectedTabItem.Checked = false; } } else { OnPopupClose(EventArgs.Empty); if (_LastSelectedTabItem != null) { if (this.DesignMode) _LastSelectedTabItem.RenderTabState = true; else _LastSelectedTabItem.Checked = true; _LastSelectedTabItem = null; } if (this.ContainerControl is IKeyTipsControl) { IKeyTipsControl kc = this.ContainerControl as IKeyTipsControl; kc.ShowKeyTips = _BackstageTab.TabStrip.ShowKeyTips; _BackstageTab.TabStrip.ShowKeyTips = false; } _BackstageTab.Visible = false; MetroTabStrip strip = this.ContainerControl as MetroTabStrip; if (strip != null) strip.BackstageTabClosed(_BackstageTab); OnPopupFinalized(EventArgs.Empty); } HideToolTip(); // Fire events RaiseExpandChange(EventArgs.Empty); return; } base.OnExpandChange(); }
public virtual void OutputPowerPointBeforePopup(PopupOpenEventArgs e) { }
public override void OutputPowerPointBeforePopup(PopupOpenEventArgs e) { e.Cancel = ActiveSolutionEditor == null || !ActiveSolutionEditor.MultipleSlidesAllowed; }
static void CourseInit_PopupOpen(object sender, PopupOpenEventArgs e) { //MenuButton mb = e.VirtualButtons["不指定"]; e.VirtualButtons["不指定"].Click += delegate { List<string> selectedIDs = K12.Presentation.NLDPanels.Course.SelectedSource; if (selectedIDs.Count == 0) { MessageBox.Show("請先選擇課程!"); return; } Task task = Task.Factory.StartNew(() => { List<UDT.SubjectSemesterScoreInputRule> SubjectSemesterScoreInputRules = (new AccessHelper()).Select<UDT.SubjectSemesterScoreInputRule>(string.Format("ref_course_id in ({0})", string.Join(",", selectedIDs))); if (SubjectSemesterScoreInputRules.Count > 0) { SubjectSemesterScoreInputRules.ForEach(x => x.Deleted = true); SubjectSemesterScoreInputRules.SaveAll(); } }); task.ContinueWith((x) => { ListPaneFields.Course_SubjectSemesterScoreInputRule.Instance.ReloadMe(); }, TaskScheduler.FromCurrentSynchronizationContext()); }; e.VirtualButtons["P/N 制"].Tag = 1; e.VirtualButtons["P/N 制"].BeginGroup = true; e.VirtualButtons["P/N 制"].Click += (s1, e1) => { List<string> selectedIDs = K12.Presentation.NLDPanels.Course.SelectedSource; if (selectedIDs.Count == 0) { MessageBox.Show("請先選擇課程!"); return; } Task task = Task.Factory.StartNew(() => { List<UDT.SubjectSemesterScoreInputRule> SubjectSemesterScoreInputRules = (new AccessHelper()).Select<UDT.SubjectSemesterScoreInputRule>(string.Format("ref_course_id in ({0})", string.Join(",", selectedIDs))); Dictionary<string, UDT.SubjectSemesterScoreInputRule> dicSubjectSemesterScoreInputRules = new Dictionary<string, SubjectSemesterScoreInputRule>(); if (SubjectSemesterScoreInputRules.Count > 0) dicSubjectSemesterScoreInputRules = SubjectSemesterScoreInputRules.ToDictionary(x => x.CourseID.ToString()); List<UDT.SubjectSemesterScoreInputRule> Insert_SubjectSemesterScoreInputRules = new List<SubjectSemesterScoreInputRule>(); foreach (string CourseID in selectedIDs) { if (!dicSubjectSemesterScoreInputRules.ContainsKey(CourseID)) { UDT.SubjectSemesterScoreInputRule SubjectSemesterScoreInputRule = new UDT.SubjectSemesterScoreInputRule(); SubjectSemesterScoreInputRule.CourseID = int.Parse(CourseID); SubjectSemesterScoreInputRule.InputRule = 1; Insert_SubjectSemesterScoreInputRules.Add(SubjectSemesterScoreInputRule); } } Insert_SubjectSemesterScoreInputRules.SaveAll(); }); task.ContinueWith((x) => { ListPaneFields.Course_SubjectSemesterScoreInputRule.Instance.ReloadMe(); }, TaskScheduler.FromCurrentSynchronizationContext()); }; }
static void StudentInit_PopupOpen(object sender, PopupOpenEventArgs e) { AccessHelper Access = new AccessHelper(); List<GraduationRequirement> graduationRequirements = Access.Select<GraduationRequirement>(); List<DepartmentGroup> departmentGroups = Access.Select<DepartmentGroup>(); //MenuButton mb = e.VirtualButtons["不指定"]; e.VirtualButtons["不指定"].Click += delegate { List<string> selectedStudentIDs = K12.Presentation.NLDPanels.Student.SelectedSource; if (selectedStudentIDs.Count == 0) { MessageBox.Show("請先選擇學生!"); return; } List<StudentBrief2> student_Brief2s = Access.Select<StudentBrief2>(string.Format("ref_student_id in {0}", "(" + string.Join(",", selectedStudentIDs) + ")")); if (student_Brief2s.Count > 0) { student_Brief2s.ForEach(x => x.GraduationRequirementID = 0); student_Brief2s.SaveAll(); } ListPaneFields.Student_GraduationRequirement.Instance.ReloadMe(); }; int i = 0; foreach (GraduationRequirement var in graduationRequirements) { IEnumerable<DepartmentGroup> iDepartmentGroups = departmentGroups.Where(x => x.UID == var.DepartmentGroupID.ToString()); string departmentGroup = string.Empty; if (iDepartmentGroups.Count()>0) departmentGroup = iDepartmentGroups.Select(x => x.Name).ElementAt(0); if (string.IsNullOrEmpty(departmentGroup)) continue; i++; //mb = e.VirtualButtons[departmentGroup][var.Name]; e.VirtualButtons[departmentGroup][var.Name].Tag = var.UID; if (i == 1) e.VirtualButtons[departmentGroup].BeginGroup = true; e.VirtualButtons[departmentGroup][var.Name].Click += (s1, e1) => { MenuButton mb = (s1 as MenuButton); List<string> selectedStudentIDs = K12.Presentation.NLDPanels.Student.SelectedSource; if (selectedStudentIDs.Count == 0) { MessageBox.Show("請先選擇學生!"); return; } List<StudentBrief2> student_Brief2s = Access.Select<StudentBrief2>(string.Format("ref_student_id in {0}", "(" + string.Join(",", selectedStudentIDs) + ")")); List<StudentBrief2> addStudent_Brief2s = new List<StudentBrief2>(); if (student_Brief2s.Count > 0) { student_Brief2s.ForEach(x => x.GraduationRequirementID = int.Parse(mb.Tag.ToString())); student_Brief2s.SaveAll(); } foreach (string studentID in selectedStudentIDs) { if (student_Brief2s.Where(x => x.StudentID.ToString() == studentID).Count() == 0) { StudentBrief2 studentBrief2 = new StudentBrief2(); studentBrief2.StudentID = int.Parse(studentID); studentBrief2.GraduationRequirementID = int.Parse(mb.Tag.ToString()); addStudent_Brief2s.Add(studentBrief2); } } if (addStudent_Brief2s.Count > 0) addStudent_Brief2s.SaveAll(); ListPaneFields.Student_GraduationRequirement.Instance.ReloadMe(); }; } }
private void miEdit_PopupOpen(object sender, PopupOpenEventArgs e) { miEditPaste.Enabled = Designer.cmdPaste.Enabled; }
private void parent_PopupOpen(object sender, PopupOpenEventArgs e) { PopulateItems(); UpdateSizes(); SetSelected(0); }
private void miInsert_PopupOpen(object sender, PopupOpenEventArgs e) { miInsert.SubItems.Clear(); CreateInsertMenu(); }
void FilterMenu_PopupOpen(object sender, PopupOpenEventArgs e) { if (!BGW.IsBusy) { List<string> list = new List<string>(); foreach (string item in SemesterClub.Keys) { list.Add(item); } list.Sort(); foreach (string item in list) { MenuButton mb = e.VirtualButtons[item]; mb.AutoCheckOnClick = true; mb.AutoCollapseOnClick = true; mb.Checked = (item == FiltedSemester); mb.Tag = item; mb.CheckedChanged += delegate(object sender1, EventArgs e1) { MenuButton mb1 = sender1 as MenuButton; SetClubList(mb1.Text); FiltedSemester = FilterMenu.Text = mb1.Text; mb1.Checked = true; }; } } else //如果忙碌中則提醒使用者 { e.Cancel = true; e.VirtualButtons.Text = "资料下载中..."; FISCA.Presentation.Controls.MsgBox.Show("资料下载中...\n请稍后再试"); } }
internal void MenuOpen(object sender, PopupOpenEventArgs e) { if (!Tag.Instance.Loaded) { Tag.Instance.SyncAllBackground(); } if (Class.Instance.SelectedList.Count > 0) { Class.Instance.SelectedList.SyncTagCache(); List <string> prefixes = new List <string>(); foreach (TagRecord each in Tag.Instance.Items.GetTagsBy(TagCategory.Class)) { string prefix = string.IsNullOrEmpty(each.Prefix) ? "<未分類>" : each.Prefix; MenuButton mb = e.VirtualButtons[prefix][each.Name]; mb.Tag = each; mb.AutoCheckOnClick = true; mb.AutoCollapseOnClick = false; MenuButton prefixMenuButton = e.VirtualButtons[prefix]; if (!prefixes.Contains(prefix)) { prefixes.Add(prefix); prefixMenuButton.PopupOpen += delegate { if (string.IsNullOrEmpty("" + prefixMenuButton.Tag)) { Dictionary <string, int> temp = new Dictionary <string, int>(); foreach (var item in Class.Instance.SelectedList) { foreach (var tag in item.GetTags()) { if (!temp.ContainsKey(tag.RefTagID)) { temp.Add(tag.RefTagID, 0); } temp[tag.RefTagID]++; } } prefixMenuButton.Tag = temp; } Dictionary <string, int> tags = prefixMenuButton.Tag as Dictionary <string, int>; int count = Class.Instance.SelectedList.Count; foreach (var item in prefixMenuButton.Items) { string tagID = (item.Tag as TagRecord).ID; if (tags.ContainsKey(tagID) && tags[tagID] == count) { item.Checked = true; } else { item.Checked = false; } } }; } e.VirtualButtons[prefix][each.Name].Enable = User.Acl[AssignCode].Executable; e.VirtualButtons[prefix][each.Name].Click += delegate { List <ClassTagRecordEditor> editors = new List <ClassTagRecordEditor>(); TagRecord record = mb.Tag as TagRecord; foreach (ClassRecord item in Class.Instance.SelectedList) { Dictionary <string, ClassTagRecord> list = new Dictionary <string, ClassTagRecord>(); foreach (ClassTagRecord tag in item.GetTags()) { list.Add(tag.RefTagID, tag); } if (mb.Checked == true) { if (!list.ContainsKey(record.ID)) { editors.Add(item.AddTag(record)); } } else { if (list.ContainsKey(record.ID)) { ClassTagRecordEditor editor = list[record.ID].GetEditor(); editor.Remove = true; editors.Add(editor); } } } if (editors.Count > 0) { editors.SaveAllEditors(); prefixMenuButton.Tag = null; Class.Instance.SelectedList.SyncTagCache(); // 重新整理畫面 Class.Instance.SyncAllBackground(); } }; } } e.VirtualButtons["類別管理..."].BeginGroup = true; e.VirtualButtons["類別管理..."].Enable = User.Acl[ManageCode].Executable; e.VirtualButtons["類別管理..."].Click += delegate { new JHSchool.ClassExtendControls.Ribbon.ClassTagForm().ShowDialog(); }; }
/// <summary> /// 搜尋資料 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void FilterMenu_PopupOpen(object sender, PopupOpenEventArgs e) { if (!_bgWorker.IsBusy) { List<string> list = new List<string>(); foreach (string str in _CourseFilterDict.Keys) list.Add(str); list.Sort(); foreach (string item in list) { MenuButton mb = e.VirtualButtons[item]; mb.AutoCheckOnClick = true; mb.AutoCollapseOnClick = true; mb.Checked = (item == FilterCourseItem); mb.Tag = item; mb.CheckedChanged += delegate(object sender1, EventArgs e1) { MenuButton mb1 = sender1 as MenuButton; SetRetakeList(mb1.Text); FilterCourseItem = FilterMenu.Text = mb1.Text; mb1.Checked = true; }; } } else { e.Cancel = true; e.VirtualButtons.Text = "資料下載中.."; } }