private void CreateToolBar(UIStateManager manager) { if (manager == null || this.ReportViewControl == null || this.ReportViewControl.Report == null) { int count = this.ReportFormInput.Actions.Count; for (int i = 0; i < count; i++) { NetAction action = this.ReportFormInput.Actions[i] as NetAction; //action.Style = (int)Proxy.UFPortalProxy.ToolButtonSyle.DropDown; //if(action.Id!="Help") // action.IsVisible = false; action.IsEnabled = false; } if (count > 0) { this.ReportFormInput.FireActionsChange(ButtonChangeType.Modify); } return; } this.ReportFormInput.Actions.Clear(); IActionDelegate actionDelegate = new ReportActionDelegate(this.ReportViewControl); foreach (StateButton sb in manager.CurrentState.Buttons) { NetAction action = new NetAction(sb.Key, actionDelegate); action.Text = sb.Caption; action.IsEnabled = sb.IsEnable; action.ToolTipText = sb.ToolTip; action.Image = sb.Image; action.Tag = null; action.Catalog = sb.Category; action.RowSpan = sb.RowSpan; action.ActionType = (sb.Category == "编辑" ? NetAction.NetActionType.Edit : NetAction.NetActionType.Normal); action.Style = sb.ButtonStyle; action.SetGroup = sb.SetGroup; action.IsChecked = sb.IsChecked; action.IsVisible = sb.Visible; sb.Tag = action; sb.VisibleChanged -= new VisibleChangedHandler(StateButtonVisibleChanged); sb.VisibleChanged += new VisibleChangedHandler(StateButtonVisibleChanged); AddSubButtons(sb, actionDelegate, action); this.ReportFormInput.Actions.Add(sb.Key, action); if (!UserToolbarStateManager.ReportActionsState.ContainsKey(this.ReportViewControl.ClientReportContext.GetReportId())) { UserToolbarStateManager.ReportActionsState.Add(this.ReportViewControl.ClientReportContext.GetReportId(), this.ReportFormInput.Actions); } else { UserToolbarStateManager.ReportActionsState[this.ReportViewControl.ClientReportContext.GetReportId()] = this.ReportFormInput.Actions; } } this.ReportFormInput.FormInputExtend.IsSmallButton = manager.CurrentState.Buttons.IsSmallButton; this.ReportFormInput.FireActionsChange(ButtonChangeType.Add); this.ReportFormInput.Text = this.GetObjectName(); (this.ReportEditorPart as NetEditor).Refresh(this.ReportFormInput); this.ReportViewControl.Focus(); }
private void ReportViewControl_RefreshViewsToolbarEvent() { AbstractFormInput.ActionHashtable actions = UserToolbarStateManager.ReportActionsState[this.ReportViewControl.ClientReportContext.GetReportId()]; NetAction viewAcs = actions["View"] as NetAction; viewAcs.Actions.Clear(); StateButtons buttons = UserToolbarStateManager.ReportButtonState[this.ReportViewControl.ClientReportContext.GetReportId()]; StateButton viewSbs = buttons["View"]; IActionDelegate actionDelegate = new ReportActionDelegate(this.ReportViewControl); foreach (StateButton subButton in viewSbs.Buttons) { if (subButton.Key == string.Empty) { return; } NetAction subAction = new NetAction(subButton.Key, subButton.Key == "ViewStyle" ? null : actionDelegate); subAction.Text = subButton.Caption; subAction.IsEnabled = subButton.IsEnable; subAction.IsVisible = subButton.Visible; subAction.ToolTipText = subButton.ToolTip; subAction.Image = subButton.Image; subAction.SetGroup = subButton.SetGroup; subAction.Catalog = subButton.Category; subAction.Style = subButton.ButtonStyle; subAction.IsChecked = subButton.IsChecked; subAction.Tag = subButton; subButton.VisibleChanged -= new VisibleChangedHandler(StateButtonVisibleChanged); subButton.VisibleChanged += new VisibleChangedHandler(StateButtonVisibleChanged); viewAcs.Actions.Add(subAction); } }