protected virtual void OnRepositoryDeleted(RepositoryArgs args) { if (this.RepositoryDeleted != null) { this.RepositoryDeleted(this, args); } }
protected internal virtual void OnStaticSchemaRepositoryChanged(RepositoryArgs args) { if (this.StaticSchemaRepositoryChanged != null) { this.StaticSchemaRepositoryChanged(this, args); } }
private void CreateFileWatcher() { lock (base.Locker) { try { if ((!string.IsNullOrEmpty(base.Repository.CustomAssemblyPath) && Path.IsPathRooted(base.Repository.CustomAssemblyPath)) && File.Exists(base.Repository.CustomAssemblyPath)) { FileSystemWatcher watcher = this._assemblyWatcher = new FileSystemWatcher(Path.GetDirectoryName(base.Repository.CustomAssemblyPath), Path.GetFileName(base.Repository.CustomAssemblyPath)); FileSystemEventHandler handler = delegate (object sender, FileSystemEventArgs e) { Action method = null; try { if (this._isDisposed) { watcher.Dispose(); this._assemblyWatcher = null; } else { if (this._populated) { if (method == null) { method = () => this.RefreshData(true); } this.TreeView.BeginInvoke(method); } RepositoryArgs args = new RepositoryArgs { Repository = this.Repository }; ((SchemaTree) this.TreeView).OnStaticSchemaRepositoryChanged(args); } } catch (Exception exception) { Log.Write(exception, "StaticSchemaNode CreateFileWatcher Invoke"); } }; this._assemblyWatcher.Changed += handler; this._assemblyWatcher.Created += handler; this._assemblyWatcher.EnableRaisingEvents = true; } } catch (Exception exception) { Log.Write(exception, "StaticSchemaNode CreateFileWatcher"); } } }
internal void Delete(RepositoryNode node) { if (node.Repository.Persist) { node.Repository.Persist = false; node.Repository.SaveToDisk(); } base.Nodes.Remove(node); node.Dispose(); RepositoryArgs args = new RepositoryArgs { Repository = node.Repository }; this.OnRepositoryDeleted(args); this.UpdateAllNodeText(); }
private void schemaTree_StaticSchemaRepositoryChanged(object sender, RepositoryArgs e) { if (base.InvokeRequired) { base.BeginInvoke(() => this.StaticSchemaRepositoryChanged(e.Repository)); } else { this.StaticSchemaRepositoryChanged(e.Repository); } }
private void schemaTree_RepositoryDeleted(object sender, RepositoryArgs e) { if ((this.CurrentQuery != null) && (this.CurrentQuery.Repository == e.Repository)) { this.CurrentQuery.Repository = null; } }