/// <summary> /// Feedback event hamdler: called when the browse filters have changed in an external dialog. /// </summary> /// <param name="filters">The new filters.</param> private void OnBrowseFiltersChanged(OpcDa::BrowseFilters filters) { //TODO: how to clear filters? IBrowse cn = (IBrowse)m_BrowseTV.SelectedNode; cn.DefaultBrowseFilters = filters; }
public MyViewModel(IBrowse browse) { this.browse = browse; HierarchicalAreas = new ObservableCollection <BaseTreeViewItem>(); Click_Button = new RelayCommand(LoadDLL); Click_Browse = new RelayCommand(Browse); Click_Serialize = new RelayCommand(Serialize); Click_Deserialize = new RelayCommand(Deserialize); }
public static void Main() { var sAc = new SitesAndCalls(); ICall call = sAc; call.Call(Console.ReadLine().Split(' ')); IBrowse browse = sAc; browse.Browse(Console.ReadLine().Split(' ')); }
/*----< demonstrate requirements have been met >---------------*/ static void Main(string[] args) { TestUtilities.title("Starting Repository", '='); ClientEnvironment.verbose = true; // if true, display test results PluggableRepo repo = new PluggableRepo(); if (!repo.loadAndActivateComponents()) { Console.Write("\n Couldn't find Repository components.\n\n"); return; } // if activation succeeded, then do self test on each IVersion version = repo.getVersion(); IStorage storage = repo.getStorage(); ICheckin checkin = repo.getCheckin(); ICheckout checkout = repo.getCheckout(); IBrowse browse = repo.getBrowse(); IOwnership ownership = repo.getOwnership(); storage.analyzeDependencies(); if ( Util.checkNull(version) || Util.checkNull(storage) || Util.checkNull(checkin) || Util.checkNull(checkout) || Util.checkNull(browse) || Util.checkNull(ownership) ) { Console.Write("\n failed to load one or more required components"); } else { Util.checkResult(version.testComponent(), version.componentType); TestUtilities.putLine(); Util.checkResult(storage.testComponent(), storage.componentType); TestUtilities.putLine(); Util.checkResult(checkin.testComponent(), checkin.componentType); TestUtilities.putLine(); Util.checkResult(checkout.testComponent(), checkout.componentType); TestUtilities.putLine(); Util.checkResult(browse.testComponent(), browse.componentType); TestUtilities.putLine(); Util.checkResult(ownership.testComponent(), ownership.componentType); TestUtilities.putLine(); Console.Write("\n finished testing all loaded components"); } Console.Write("\n\n"); }
/// <summary> /// Raise a server or item event depending on the selected node. /// </summary> private void PickNode(IBrowse node) { switch (node.GetNodeType) { case NodeType.OPCServer: OnServerPick(((OPCBrowseServer)node).MyServer); break; case NodeType.Item: var benNode = node as BrowseElementNode; OnItemPicked(benNode.MyItemIdentifier); break; default: break; } }
/*----< activate pluggable component libraries >---------------*/ /* * Loads each of the libraries from the ComponentLibraries path. * Each component is activated and bound to a RepoEnvironment * reference. */ public bool loadAndActivateComponents() { AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += new ResolveEventHandler(LoadFromComponentLibFolder); // get names of component dlls if (!Directory.Exists(RepoEnvironment.componentsPath)) { Console.Write("\n can't find path to components"); return(false); } string[] libraries = Directory.GetFiles(RepoEnvironment.componentsPath, "*.dll"); // load libraries and, for each component, activate if (libraries.Length > 0) { foreach (string libName in libraries) { // load library string fileName = Path.GetFileName(libName); Console.Write("\n loading library: {0}", fileName); string fullLibName = Path.GetFullPath(libName); //Assembly asm = Assembly.LoadFile(fullLibName); Assembly asm = Assembly.LoadFrom(fullLibName); if (fileName.Contains("IPluggaleComponent.dll")) { continue; } // if library contains one of the Pluggable Components then activate Type[] types = asm.GetExportedTypes(); foreach (Type t in types) { if (t.IsClass && typeof(IStorage).IsAssignableFrom(t)) { storage = (IStorage)Activator.CreateInstance(t); RepoEnvironment.storage = storage; Console.Write("\n creating {0} component", storage.componentType); continue; } if (t.IsClass && typeof(IVersion).IsAssignableFrom(t)) { version = (IVersion)Activator.CreateInstance(t); RepoEnvironment.version = version; Console.Write("\n creating {0} component", version.componentType); continue; } if (t.IsClass && typeof(ICheckin).IsAssignableFrom(t)) { checkin = (ICheckin)Activator.CreateInstance(t); RepoEnvironment.checkin = checkin; Console.Write("\n creating {0} component", checkin.componentType); continue; } if (t.IsClass && typeof(ICheckout).IsAssignableFrom(t)) { checkout = (ICheckout)Activator.CreateInstance(t); RepoEnvironment.checkout = checkout; Console.Write("\n creating {0} component", checkout.componentType); continue; } if (t.IsClass && typeof(IBrowse).IsAssignableFrom(t)) { browse = (IBrowse)Activator.CreateInstance(t); RepoEnvironment.browse = browse; Console.Write("\n creating {0} component", browse.componentType); continue; } if (t.IsClass && typeof(IOwnership).IsAssignableFrom(t)) { ownership = (IOwnership)Activator.CreateInstance(t); RepoEnvironment.ownership = ownership; Console.Write("\n creating {0} component", ownership.componentType); continue; } } } } Console.Write("\n"); return(libraries.Length > 0); }
public OpenFileDialogCommand(IBrowse viewModel) { this.viewModel = viewModel; }