private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { IDisposableFactory.DisposeAll(); Logger.E(e.Exception); //e.Handled = true; //MessageBox.Show("发生内部异常,程序即将关闭,如需分析,请查看相关日志!"); }
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]); }
public void teardown() { IDisposableFactory.DisposeAll(); File.Delete(CfgPath.IniFilePath); Directory.Delete(dir, true); Directory.Delete(docBase, true);//删除B目录下的文件,用于单元测试 }
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()); }
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"); }
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); }
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); }
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); }
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"; } }
public static SQLTagDB Load() { return(IDisposableFactory.New <SQLTagDB>(new SQLTagDB())); //数据库连接惰性打开 }
public static IUriDB CreateUriDB() { Ins = IDisposableFactory.New <IUriDB>(new LuceneUriDB()); return(Ins); }
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { IDisposableFactory.DisposeAll(); Logger.E(e.ExceptionObject.ToString()); MessageBox.Show("发生内部异常,程序即将关闭,如需分析,请查看相关日志!"); }
private void App_Exit(object sender, ExitEventArgs e) { IDisposableFactory.DisposeAll(); Logger.E("App Exit:" + e.ApplicationExitCode); }
//public static ITagDB CreateTagDB() //{ // Ins = IDisposableFactory.New<ITagDB>(new LuceneTagDB()); // return Ins; //} public static ITagDB CreateTagDB() { Ins = IDisposableFactory.New <ITagDB>(SQLTagDB.Load()); return(Ins); }
//public static ITagDB CreateTagDB() //{ // Ins = IDisposableFactory.New<ITagDB>(new LuceneTagDB()); // return Ins; //} public static ITagDB CreateTagDB() { return(IDisposableFactory.New <ITagDB>(new TagDBLogger(SQLTagDB.Load()))); }
public RichTxtBox() { InitializeComponent(); IDisposableFactory.New <RichTxtBox>(this); }
public ServiceFactory(IDisposableFactory <TService> proxyFactory, bool useFactory = true) { loaderParams = new LoaderParams <TService>(proxyFactory.Create, useFactory); }