Exemplo n.º 1
0
 private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
 {
     IDisposableFactory.DisposeAll();
     Logger.E(e.Exception);
     //e.Handled = true;
     //MessageBox.Show("发生内部异常,程序即将关闭,如需分析,请查看相关日志!");
 }
Exemplo n.º 2
0
        public void ITagDB_Test_Reopen()//关闭后重新打开
        {
            GUTag p1 = db.NewTag("p1");
            GUTag c1 = db.NewTag("c1");

            db.SetParent(p1, c1);
            List <string> alias = db.QueryTagAlias(p1);

            foreach (string a in alias)
            {
                Logger.D(a);
            }
            Assert.AreEqual(1, alias.Count);
            Assert.AreEqual("p1", alias[0]);
            Logger.D("end test reopen");

            IDisposableFactory.DisposeAll();
            db = null;

            db = TagDBFactory.CreateTagDB("sql");
            List <GUTag> p1new = db.QueryTags("p1");

            alias = db.QueryTagAlias(p1new[0]);
            Assert.AreEqual(1, alias.Count);
            Assert.AreEqual("p1", alias[0]);
        }
Exemplo n.º 3
0
        public void teardown()
        {
            IDisposableFactory.DisposeAll();

            File.Delete(CfgPath.IniFilePath);
            Directory.Delete(dir, true);
            Directory.Delete(docBase, true);//删除B目录下的文件,用于单元测试
        }
Exemplo n.º 4
0
 public void setup()
 {
     UTestCfg.Ins.IsUTest = true;
     //if (!System.IO.Directory.Exists(Cfg.Ins.TagDB))
     //{
     //    System.IO.Directory.CreateDirectory(Cfg.Ins.TagDB);
     //}
     db = IDisposableFactory.New <SQLTagDB>(new SQLTagDB());
 }
Exemplo n.º 5
0
 private void Window_Closed(object sender, EventArgs e)
 {
     IDisposableFactory.Dispose(tagDB);
     IDisposableFactory.Dispose(uriDB);
     //tagDB.Dispose();
     //uriDB.Dispose();
     tagDB = null;
     uriDB = null;
     Logger.I(@"Close main window");
 }
Exemplo n.º 6
0
 public static ITagDB CreateTagDB(string t)
 {
     if (t.Contains("json"))
     {
         Ins = IDisposableFactory.New <ITagDB>(JsonTagDB.Load());
     }
     else if (t.Contains("sql"))
     {
         Ins = IDisposableFactory.New <ITagDB>(SQLTagDB.Load());
     }
     return(Ins);
 }
Exemplo n.º 7
0
        public void teardown()
        {
            IDisposableFactory.DisposeAll();
            db = null;
            //为了安全,直接硬编码,防止把真是数据删除
            Directory.Delete(@"B:\00TagExplorerBase", true);
            //Directory.Delete(CfgPath.DocBasePath);


            //if (System.IO.Directory.Exists(Cfg.Ins.TagDB))
            //    System.IO.Directory.Delete(Cfg.Ins.TagDB,true);
        }
Exemplo n.º 8
0
        public void teardown()
        {
            IDisposableFactory.DisposeAll();
            db = null;
            while (File.Exists(CfgPath.TagDBPath_SQLite))
            {
                try
                {
                    File.Delete(CfgPath.TagDBPath_SQLite);
                    System.Threading.Thread.Sleep(100);
                    break;
                }
                catch (Exception ee)
                {
                    Logger.E(ee);
                    System.Threading.Thread.Sleep(100);
                }
            }
            //为了安全,直接硬编码,防止把真是数据删除
            string dir = @"B:\00TagExplorerBase";

            while (Directory.Exists(dir))
            {
                try
                {
                    Directory.Delete(dir, true);
                    System.Threading.Thread.Sleep(100);
                    break;
                }
                catch (Exception ee)
                {
                    Logger.E(ee);
                    System.Threading.Thread.Sleep(100);
                }
            }


            //Directory.Delete(CfgPath.DocBasePath);


            //if (System.IO.Directory.Exists(Cfg.Ins.TagDB))
            //    System.IO.Directory.Delete(Cfg.Ins.TagDB,true);
        }
Exemplo n.º 9
0
        private void InitialViews()
        {
            if (uriDB == null || tagDB == null)
            {
                TipsCenter.Ins.StartTime = "Before Init DBS ";
                //URI DB初始化
                Logger.I("InitializeComponent Finished!,init uridb");
                uriDB = UriDBFactory.CreateUriDB();
                uriDB.UriDBChanged      += UriDBChangedCallback;
                TipsCenter.Ins.StartTime = "UriDB Init";

                //TAG DB初始化
                Logger.I("InitializeComponent Finished!,init tagdb");
                tagDB = TagDBFactory.CreateTagDB();
                tagDB.TagDBChanged      += TagDBChanged;
                TipsCenter.Ins.StartTime = "TagDB Init";

                //查询输入框初始化
                SearchBox.textBox.TextChanged += SearchBoxTextChanged_Callback;
                SearchBox.SearchDataProvider   = tagDB;
                TipsCenter.Ins.StartTime       = "SearchBoxInit";

                //Tag视图初始化
                tagCanvas.InitDB(tagDB, uriDB);
                tagCanvas.SelectedTagChanged += SelectedTagChanged_Callback;
                TipsCenter.Ins.StartTime      = "tagCanvasInit";

                GUTag mroot = GUTag.Parse(DynamicCfg.Ins.MainCanvasRoot, tagDB);
                TipsCenter.Ins.StartTime = "mRoot";
                GUTag sroot = GUTag.Parse(DynamicCfg.Ins.SubCanvasRoot, tagDB);
                TipsCenter.Ins.StartTime = "sRoot";
                TipsCenter.Ins.StartTime = "MainWindow:64(before showtaggraph)";
                ShowTagGraph(mroot, sroot);
                TipsCenter.Ins.StartTime = "AfterShowTagGraph";
                IDisposableFactory.New <MainWindow>(this);

                richTxt.Focus();
                this.Title = "TagExplorer " + CfgPath.RootPath;
                TipsCenter.Ins.StartTime = "MainWindow:70";
            }
        }
Exemplo n.º 10
0
 public static SQLTagDB Load()
 {
     return(IDisposableFactory.New <SQLTagDB>(new SQLTagDB()));
     //数据库连接惰性打开
 }
Exemplo n.º 11
0
 public static IUriDB CreateUriDB()
 {
     Ins = IDisposableFactory.New <IUriDB>(new LuceneUriDB());
     return(Ins);
 }
Exemplo n.º 12
0
 private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     IDisposableFactory.DisposeAll();
     Logger.E(e.ExceptionObject.ToString());
     MessageBox.Show("发生内部异常,程序即将关闭,如需分析,请查看相关日志!");
 }
Exemplo n.º 13
0
 private void App_Exit(object sender, ExitEventArgs e)
 {
     IDisposableFactory.DisposeAll();
     Logger.E("App Exit:" + e.ApplicationExitCode);
 }
Exemplo n.º 14
0
 //public static ITagDB CreateTagDB()
 //{
 //    Ins = IDisposableFactory.New<ITagDB>(new LuceneTagDB());
 //    return Ins;
 //}
 public static ITagDB CreateTagDB()
 {
     Ins = IDisposableFactory.New <ITagDB>(SQLTagDB.Load());
     return(Ins);
 }
Exemplo n.º 15
0
 //public static ITagDB CreateTagDB()
 //{
 //    Ins = IDisposableFactory.New<ITagDB>(new LuceneTagDB());
 //    return Ins;
 //}
 public static ITagDB CreateTagDB()
 {
     return(IDisposableFactory.New <ITagDB>(new TagDBLogger(SQLTagDB.Load())));
 }
Exemplo n.º 16
0
 public RichTxtBox()
 {
     InitializeComponent();
     IDisposableFactory.New <RichTxtBox>(this);
 }
Exemplo n.º 17
0
 public ServiceFactory(IDisposableFactory <TService> proxyFactory, bool useFactory = true)
 {
     loaderParams = new LoaderParams <TService>(proxyFactory.Create, useFactory);
 }