Beispiel #1
0
 /// <summary>
 /// 删除当前文档
 /// </summary>
 private void RemoveAutocadDB()
 {
     if (Application.DocumentManager.MdiActiveDocument != null)
     {
         Application.DocumentManager.MdiActiveDocument.CloseAndDiscard();
     }
     Application.DocumentManager.Add("acadiso.dwt");
     using (PublicMethod.Instance.acDoc.LockDocument())
     {
         //初始化数据
         DCadApi.isRefreshLayer = true;
         PublicMethod.Instance.isLayerHiddenStatus = false;
         CADTypes.CreateLineType();
         CADTypes.CreateStyle();
         DBSymbolFinder.Instance.Clear();
         DBSymbolLTTIDFinder.Instance.Clear();
         //SurfaceInteractive.ClearResource();
         mouse._selectedObjectIds  = null;
         mouse.selectedEntityId    = ObjectId.Null;
         mouse.ImpliedSelectionIds = null;
     }
 }
Beispiel #2
0
        public void Initialize()
        {
            try
            {

#if EnableLock
                SenseLock.Instance.Open();
                if (SenseLock.Instance.VerifyUserPin("d6465065"))
                {
                    LockDaemon.Instance.OnUnplug =
                        () => MessageBox.Show("请使用加密狗!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LockDaemon.Instance.Start();
                    XmlPassword.Instance.Password = SenseLock.Instance.GetKey();
                    if (SenseLock.Instance.GetTime() < DateTime.Now)
                    {
                        MessageBox.Show("加密狗已过期,请联系管理员!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
#else
                XmlPassword.Instance.Password = "******";
#endif
                InitExceptionLogger();
                InitiationConfig();
                if (!string.IsNullOrEmpty(MapConfig.Instance.TimeLock))
                {
                    var currentTime = DateTime.Now.ToShortDateString();
                    var lastTime = DateTime.Parse(MapConfig.Instance.TimeLock);
                    var ts = DateTime.Now.Subtract(lastTime);
                    if (ts.Days < 0)
                    {
                        MessageBox.Show("插件已过期", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }
                    var pastdueTime = DateTime.Parse("2015/6/30 00:00:00");
                    var pastdue = pastdueTime.Subtract(DateTime.Now);
                    if (pastdue.Days < 0)
                    {
                        MessageBox.Show("插件已过期", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }
                    MapConfig.Instance.TimeLock = currentTime;
                    PublicMethod.Instance.SaveLocalMapConfig();
                }
                ChangeAutoCADWindow();
                EnsureInitialize();
                CADTypes.CreateLineType();
                CADTypes.CreateStyle();
                InstallCADPlugin();

                //启动台帐服务
                WindowsServices.TomcatServiceStart();
#if EnableLock
                }
                else
                {
                    SenseLock.Instance.Close();
                }
#endif
            }
            catch (CADException ex)
            {
                LogManager.Instance.Error(ex);
            }
        }