public static void Initialize(WorkbenchForm mainForm) { _mainForm = mainForm; _currentStatusStrip = new StatusStrip(); _currentStatusStrip.LayoutStyle = ToolStripLayoutStyle.Table; ToolStripStatusLabel label = new ToolStripStatusLabel("就绪"); label.Spring = true; label.TextAlign = ContentAlignment.MiddleLeft; _currentStatusStrip.Items.Add(label); _mainForm.Controls.Add(_currentStatusStrip); _loginInfo = new ToolStripStatusLabel("未登陆"); _loginInfo.AutoSize = false; _loginInfo.Name = "loginInfo"; _loginInfo.Width = 200; _loginInfo.TextAlign = ContentAlignment.MiddleLeft; _loginInfo.DoubleClickEnabled = true; _loginInfo.DoubleClick += new EventHandler(_loginInfo_DoubleClick); _currentStatusStrip.Items.Add(_loginInfo); Service.User.UserIDChanged += new EventHandler <ChangedEventArgs <string> >(User_UserIDChanged); //注册主窗体的ActiveWorkspaceTypeChanged事件 //_mainForm.ActiveWorkspaceTypeChanged += delegate(object sender, WorkspaceTypeEventArgs e) //{ // ChangeStatusBar(e.ActiveWorkspaceType); //}; }
public static void Initialize(WorkbenchForm mainForm) { _mainForm = mainForm; _toolStripPanel.AutoSize = true; _toolStripPanel.Dock = DockStyle.Top; _mainForm.Controls.Add(_toolStripPanel); //创建所有Toolbar CreateAllToolbar(); MenuStripManager.Initialized += delegate { //创建右键菜单 List <ToolStripMenuItem> menuItemList = new List <ToolStripMenuItem>(); EventHandler menuClick = delegate(object sender, EventArgs e) { ToolStripMenuItem item = (ToolStripMenuItem)sender; ToolStrip tempStrip = (ToolStrip)item.Tag; tempStrip.Visible = !tempStrip.Visible; //item.Checked = tempStrip.Visible; }; foreach (ToolStrip strip in _toolStripList.Values) { ToolStripMenuItem item = new ToolStripMenuItem(strip.Text, null, menuClick); ToolStripMenuItem itemForTopMenu = new ToolStripMenuItem(strip.Text, null, menuClick); item.Checked = strip.Visible; itemForTopMenu.Checked = strip.Visible; ToolStrip tempForDelegate = strip; strip.VisibleChanged += delegate { item.Checked = tempForDelegate.Visible; itemForTopMenu.Checked = tempForDelegate.Visible; }; item.Tag = strip; itemForTopMenu.Tag = strip; _contextMenuStrip.Items.Add(item); menuItemList.Add(itemForTopMenu); } _toolStripPanel.ContextMenuStrip = _contextMenuStrip; _contextMenuItems = menuItemList.ToArray(); _contextMenuStrip.Items.AddRange(_contextMenuItems); if (ContextMenuItemsCreated != null) { ContextMenuItemsCreated(null, EventArgs.Empty); } }; //注册主窗体的ActiveWorkspaceTypeChanged事件 _mainForm.ActiveWorkspaceTypeChanged += delegate(object sender, WorkspaceTypeEventArgs e) { ChangeToolbar(e.ActiveWorkspaceType); }; }
static public void Initialize(WorkbenchForm mainForm) { _mainForm = mainForm; CreateAllMenuStrip(); //注册主窗体的ActiveWorkspaceTypeChanged事件 _mainForm.ActiveWorkspaceTypeChanged += delegate(object sender, WorkspaceTypeEventArgs e) { ChangeTopMenu(e.ActiveWorkspaceType); }; if (Initialized != null) { Initialized(null, EventArgs.Empty); } }
public TabNavigationForm(WorkbenchForm mainForm) { this._mainForm = mainForm; this.Owner = mainForm; this.KeyPreview = true; InitializeComponent(); listViewPad.SmallImageList = new ImageList(); listViewFile.SmallImageList = new ImageList(); ///添加Pad工具栏 AddPadForm(_mainForm.MainPropertyPad); AddPadForm(_mainForm.MainTreePad); AddPadForm(_mainForm.MainWizardPad); AddPadForm(_mainForm.MainPreviewPad); AddPadForm(_mainForm.MainResultPad); }
/// <summary> /// 初始化 /// </summary> public static void Initialize(string sdsite) { System.Windows.Forms.Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); _willOpenFile = sdsite; CssResources.Initialize(); //初始化的顺序是有一定规则的 Service.Util.Initialize(); Service.Property.Initialize(); PathService.Initialize(Application.StartupPath); Utility.Pinyin.Initialize(Path.Combine(PathService.SoftwarePath, "pinyin.mb")); ResourceService.Initialize(); StringParserService.Initialize(ResourceService.GetResourceText); SoftwareOption.Load(); ResourcesReader.InitializeResources("Configuration", SoftwareOption.General.ApplicationLanguage, null); Service.FileBinding.Initialize(); Service.DesignData.Load(PathService.Config_PadLayout); Service.RecentFiles.Initialize(); Service.SiteDataManager.Initialize(); Service.ListView.InitColumn(); SiteResourceService.Initialize(SelectResource, GetResourcePath, GetResourceAbsPath, GetResourceUrl, ImportResourceFile); AutoLayoutPanel.Initialize(PathService.CL_DataSources_Folder); LayoutConfiguration.LoadLayoutConfiguration(); _mainForm = new WorkbenchForm(); CssUtility.Initialize(_mainForm.SelectImageResource); ////初始化的顺序是有一定规则的 Service.User.Initialize(_mainForm.ShowLoginForm); Service.WebView.Initialize(_mainForm.SinglePagePublish); MessageService.Initialize(_mainForm); ToolbarManager.Initialize(_mainForm); MenuStripManager.Initialize(_mainForm); StatusBarManager.Initialize(_mainForm); FindAndReplaceForm.Initialize(_mainForm); //ResultsPad.Initialize(_mainForm); MenuStateManager.Initialize(); Service.StatusBar.Initialize(StatusBarManager.CurrentStatusStrip); Service.Workbench.Initialize( _mainForm, _mainForm.OpenWorkDocument, _mainForm.NavigationUrl, _mainForm.MainTreePad.TreeViewExPad.RefreshSiteTreeData, ShowDialogForCreateProject, ShowDialogForOpenProject, _mainForm.GotoTree, _mainForm.ActivateForm); ///监听项目的打开事件 Service.Project.ProjectOpened += new EventHandler(ProjectService_ProjectOpened); Service.Project.ProjectClosing += new EventHandler(ProjectService_ProjectClosing); Service.Project.ProjectClosed += new EventHandler(ProjectService_ProjectClosed); OnWorkbenchCreated(); _mainForm.OnActiveWorkspaceTypeChanged(new WorkspaceTypeEventArgs(WorkspaceType.Default)); _mainForm.MainDockPanel.ActiveDocumentChanged += new EventHandler(_mainForm.MainDockPanel_ActiveDocumentChanged); if (Initialized != null) { Initialized(null, EventArgs.Empty); } }