Пример #1
0
 public void Dispose()
 {
     if (this.App != null)
     {
         lock (this.LockObject)
         {
             this.App.Close();
             this.App = null;
         }
     }
 }
Пример #2
0
        int InitialApplication(out string strError)
        {
            strError = "";

            if (this.app != null)
            {
                return(0);   // 已经初始化
            }
            HostInfo info = OperationContext.Current.Host.Extensions.Find <HostInfo>();

            if (info.App != null)
            {
                this.app = info.App;
                return(0);
            }

            string strDataDir = info.DataDir;

            Debug.Assert(string.IsNullOrEmpty(strDataDir) == false, "");

            lock (info.LockObject)
            {
                info.App = new UcApplication();
                // parameter:
                //		strDataDir	data目录
                //		strError	out参数,返回出错信息
                // return:
                //		-1	出错
                //		0	成功
                // 线: 安全的
                int nRet = info.App.Initial(strDataDir,
                                            out strError);
                if (nRet == -1)
                {
                    return(-1);
                }
            }

            this.app = info.App;
            return(0);
        }