Beispiel #1
0
        public static void AppStart()
        {
            lock (locker)
            {
                if (_isCalled == false)
                {
                    try
                    {
                        WriterLog("--------------------------------");
                        WriterLog("应用开始启动!");

                        container = ZhyContainer.CreateUnity();
                        cache     = ZhyContainer.CreateCache();
                        database  = FactoryDatabase.GetDatabase();
                        //taskList = new List<TimingTask>();
                        //codeList = new List<FunClass>();

                        //加载插件
                        AppPluginManage.LoadAllPlugin();

                        _isCalled = true;

                        WriterLog("应用启动成功!");
                        WriterLog("--------------------------------");
                        //AppMain();
                    }
                    catch (Exception err)
                    {
                        AppGlobal.WriterLog("应用启动失败!");
                        AppGlobal.WriterLog(err.Message);
                        AppGlobal.WriterLog("--------------------------------");
                        throw err;
                    }
                }
            }
        }
Beispiel #2
0
        public static void AppStart()
        {
            lock (locker)
            {
                if (_isCalled == false)
                {
                    try
                    {
                        WriterLog("--------------------------------");
                        WriterLog("应用开始启动!");

                        string ClientType = System.Configuration.ConfigurationManager.AppSettings["ClientType"];
                        if (ClientType == "Web")
                        {
                            appType = AppType.Web;
                        }
                        else if (ClientType == "Winform")
                        {
                            appType     = AppType.Winform;
                            AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
                        }
                        else if (ClientType == "WCF")
                        {
                            appType     = AppType.WCF;
                            AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
                        }
                        else if (ClientType == "WCFClient")
                        {
                            appType     = AppType.WCFClient;
                            AppRootPath = System.Windows.Forms.Application.StartupPath + "\\";
                        }


                        IsSaas = System.Configuration.ConfigurationManager.AppSettings["IsSaas"] == "true" ? true : false;

                        container  = ZhyContainer.CreateUnity();
                        cache      = ZhyContainer.CreateCache();
                        database   = FactoryDatabase.GetDatabase();
                        taskList   = new List <TimingTask>();
                        codeList   = new List <FunClass>();
                        missingDll = new List <string>();

                        AppPluginManage.LoadAllPlugin();

                        //初始化Web定制任务
                        MultiTask.Init(container, taskList);//任务
                        //是否开启Web控制器请求权限认证

                        //扩展Global,网站程序启动、停止可自定义代码
                        GlobalExtend.StartInit();
                        //初始化委托代码
                        BaseDelegateCode.Init(container, codeList);//执行函数

                        _isCalled = true;


                        IsRun = true;

                        if (missingDll.Count > 0)
                        {
                            string msg = "缺失的程序集:";
                            WriterLog(msg);
                            for (int i = 0; i < missingDll.Count; i++)
                            {
                                msg = missingDll[i];
                                WriterLog(msg);
                            }
                            //MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                        WriterLog("应用启动成功!");
                        WriterLog("--------------------------------");
                        //AppMain();
                    }
                    catch (Exception err)
                    {
                        AppGlobal.WriterLog("应用启动失败!");
                        AppGlobal.WriterLog(err.Message);
                        AppGlobal.WriterLog("--------------------------------");
                        throw err;
                    }
                }
            }
        }
Beispiel #3
0
        public static void AppStart()
        {
            lock (locker)
            {
                if (_isCalled == false)
                {
                    try
                    {
                        WriterLog("--------------------------------");
                        WriterLog("应用开始启动!");

                        container  = ZhyContainer.CreateUnity();
                        cache      = ZhyContainer.CreateCache();
                        database   = FactoryDatabase.GetDatabase();
                        taskList   = new List <TimingTask>();
                        codeList   = new List <FunClass>();
                        missingDll = new List <string>();


                        //加载插件
                        AppPluginManage.LoadAllPlugin();
                        //AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

                        //下面三个需要配置unity.config
                        //初始化Web定制任务
                        //MultiTask.Init(container, taskList);//任务
                        //是否开启Web控制器请求权限认证
                        //扩展Global,网站程序启动、停止可自定义代码
                        //GlobalExtend.StartInit();
                        //初始化委托代码
                        //BaseDelegateCode.Init(container, codeList);//执行函数

                        _isCalled = true;

                        //IsRun = true;

                        if (missingDll.Count > 0)
                        {
                            string msg = "缺失的程序集:";
                            WriterLog(msg);
                            for (int i = 0; i < missingDll.Count; i++)
                            {
                                msg = missingDll[i];
                                WriterLog(msg);
                            }
                            //MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                        WriterLog("应用启动成功!");
                        WriterLog("--------------------------------");
                        //AppMain();
                    }
                    catch (Exception err)
                    {
                        AppGlobal.WriterLog("应用启动失败!");
                        AppGlobal.WriterLog(err.Message);
                        AppGlobal.WriterLog("--------------------------------");
                        throw err;
                    }
                }
            }
        }