internal static void InitializeBeforeRun()
 {
     ///初始资源文件的使用环境
     ResourcesReader.InitializeResources(Service.Path.Directory.ConfigLanguage, null);
     ///初始软件选项
     Service.Option.InitializeOption(Service.Path.File.OptionFile);
     ///初始化数据库服务
     Service.DbHelper = DbHelper.Creator(Service.Path.File.SqlXml);
     timer.Tick      += new EventHandler(timer_Tick);
     timer.Interval   = 1000 * 60 * 30;
     timer.Start();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 初始化的核心方法
 /// </summary>
 internal static void Initialize()
 {
     ///初始资源文件的使用环境
     ResourcesReader.InitializeResources(Service.PathService.Directory.ConfigLanguage, null);
     //Service.Logger.Log(.Add(new Log(LogType.Information,"初始资源文件的使用环境"));
     ///初始软件选项
     Service.Option.InitializeOption(Service.PathService.File.OptionFile);
     ///初始化一个供全局使用的分词类型对象(WordSeg)
     Service.JWordSegmentor = JWordSegmentorService.Creator(
         Service.PathService.Directory.Config,
         Service.PathService.Directory.SegData);
     ///初始化数据库服务
     Service.DbHelper = DbHelper.Creator(Service.PathService.File.SqlXml);
 }
Ejemplo n.º 3
0
        /// <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);
            }
        }