public void teardown() { db.Dispose(); db = null; //if (System.IO.Directory.Exists(Cfg.Ins.TagDB)) // System.IO.Directory.Delete(Cfg.Ins.TagDB,true); }
public UpdateTitleTaskInf(string uri, IUriDB db, string tag, bool download) { Uri = uri; UriDB = db; Tag = tag; autoDownload = download; }
public void InitDB(ITagDB tagDB, IUriDB uriDB) { TagDB = tagDB; UriDB = uriDB; MainCanvas.Initial(tagDB, uriDB, LayoutCanvas.MAIN_CANVAS); SubCanvas.Initial(tagDB, uriDB, LayoutCanvas.SUB_CANVAS); }
public void setup() { //if (!System.IO.Directory.Exists(Cfg.Ins.TagDB)) //{ // System.IO.Directory.CreateDirectory(Cfg.Ins.TagDB); //} db = UriDBFactory.CreateUriDB(); }
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 void ShowQueryResult(string query, IUriDB uriDB, ITagDB tagsDB) { this.uriDB = uriDB; this.tagsDB = tagsDB; dataList = SearchResultItem.QueryByTag(query, uriDB); SortType = -1; SortBy("访问时间"); TipsCenter.Ins.ListInf = "文件列表统计:" + query + " Found Files:" + dataList.Count; ShowItemList(); AdjustGridColumnWidth(); }
//初始化TagDB,该函数必须在空间初始化时就指定 public void Initial(ITagDB db, IUriDB uridb, LayoutCanvas canvasType) { TagDB = db; UriDB = uridb; MyCanvasType = canvasType; if (!NeedShowRootPath()) { //connectCanvas.Visibility = Visibility.Collapsed; connect.Height = new GridLength(0); } //更新上下文菜单的Check选项(选中哪个模式,就在该模式上打一个勾) UpdateMenuItemCheckStatus(); }
//公有成员方法************************************************************ public static List <SearchResultItem> QueryByTag(string tag, IUriDB db) { List <string> files = db.Query(tag); List <SearchResultItem> ret = new List <SearchResultItem>(); foreach (string uri in files) { string formatUri = CfgPath.ChangePathRoot(uri); if (PathHelper.IsValidUri(formatUri)) { SearchResultItem it = new SearchResultItem(); it.Init(uri, formatUri, db); ret.Add(it); } } return(ret); }
//公有方法/////////////////////////////////////////////// public void ChangeCurrentUri(string uri, IUriDB uriDB, ITagDB tagDB) { string tips = "当前选中文件:" + uri + " "; this.uriDB = uriDB; this.tagDB = tagDB; autoTextBox.SearchDataProvider = tagDB; currentUri = uri; List <string> tags = uriDB.GetTags(uri); parent.Children.Clear(); foreach (string tag in tags) { ShowTagsList(tag); tips += tag + " "; } TipsCenter.Ins.UriInf = tips; }
//私有成员方法************************************************************ private void Init(string originalUri, string fullPath, IUriDB db)//TODO 支持http图标 { fullUri = fullPath; uriItem = db.GetInf(originalUri); if (uriItem == null) { return; } //http链接 if (PathHelper.IsValidWebLink(fullUri)) { string title = uriItem.Title; //指定了标题的http链接 if (title != null && title.Length > 0) { name = title; dir = fullUri; } //没有指定标题的http链接 else { //System.Uri uri = new System.Uri(fullUri); //TODO 获取http文档的名称和路径 GetNameTitle(); } } //文件 else { string name2 = Path.GetFileName(fullUri); if (uriItem != null && !string.IsNullOrEmpty(uriItem.Title) && uriItem.Title != name2) { name = uriItem.Title + "(" + name2 + ")"; } else { name = name2; } dir = Path.GetDirectoryName(fullUri); } _icon = GIconHelper.GetBitmapFromFile(fullUri); }
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"; } }