/// <summary> /// Constructor. /// </summary> public GraphicsDevice(IHostControl host) { if (host == null) throw new ArgumentNullException("host"); this.host = host; }
private List <IPluginInfo> LoadPluginsFromAssembly(string assemblyLocation, IHostControl hostControl) { List <IPluginInfo> retPlugins = new List <IPluginInfo>(); //To avoid exception System.NotSupportedException byte[] file = File.ReadAllBytes(assemblyLocation); Assembly aPlugin = Assembly.Load(file); Localization.LocalizationProvider.Instance.AddAssembly(aPlugin.FullName); Type[] tPluginTypes = aPlugin.GetTypes(); foreach (Type tPluginType in tPluginTypes) { if (tPluginType.GetInterface("IPlugin") != null) { IPlugin plugin = Activator.CreateInstance(tPluginType) as IPlugin; // If we have a new instance of a plugin, initialize it and add it to return list if (plugin != null) { plugin.HostControl = hostControl; plugin.Initialize(); retPlugins.Add(new PluginInfo(plugin, tPluginType.FullName, Path.GetFileName(assemblyLocation))); } } } return(retPlugins); }
public bool LoadPlugins(IHostControl host) { // Default return value to failure bool bFailed = true; // Clear any existing plugins _Plugins = new List<IPluginInfo>(); //_Plugins.Clear(); string directoryPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); if (directoryPath == null) return true; // Load core plugins. string corePluginsPath = Path.Combine(directoryPath, "GestureSign.CorePlugins.dll"); if (File.Exists(corePluginsPath)) { _Plugins.AddRange(LoadPluginsFromAssembly(corePluginsPath, host)); bFailed = false; } // Load extra plugins. string extraPlugins = Path.Combine(directoryPath, "Plugins"); if (Directory.Exists(extraPlugins)) foreach (string sFilePath in Directory.GetFiles(extraPlugins, "*.dll")) { _Plugins.AddRange(LoadPluginsFromAssembly(sFilePath, host)); bFailed = false; } return bFailed; }
public void Load(IHostControl host) { // Create empty list of plugins, then load as many as possible from plugin directory LoadPlugins(host); if (host == null) return; host.TouchCapture.GestureRecognized += TouchCapture_GestureRecognized; }
public void Load(IHostControl host) { // Create empty list of plugins, then load as many as possible from plugin directory LoadPlugins(host); if (host == null) { return; } host.TouchCapture.GestureRecognized += TouchCapture_GestureRecognized; }
public void Load(IHostControl host, SynchronizationContext syncContext = null) { _mainContext = syncContext; // Create empty list of plugins, then load as many as possible from plugin directory LoadPlugins(host); if (host == null) { return; } host.PointCapture.GestureRecognized += PointCapture_GestureRecognized; }
/// <summary> /// Constructor. /// </summary> /// <param name="host"></param> public Mouse(IHostControl host) { if (host == null) throw new ArgumentNullException("host"); this.host = host; this.DoubleClickRate = TimeSpan.FromMilliseconds(_GetDoubleClickTime()); this.position = Point.Zero; this.oldPosition = Point.Zero; this.buttons = new bool[ButtonCount]; this.oldButtons = new bool[ButtonCount]; }
public bool LoadPlugins(IHostControl host) { // Default return value to failure bool bFailed = true; // Clear any existing plugins _Plugins = new List <IPluginInfo>(); //_Plugins.Clear(); string directoryPath = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); if (directoryPath == null) { return(true); } // Load core plugins. string corePluginsPath = Path.Combine(directoryPath, "GestureSign.CorePlugins.dll"); if (File.Exists(corePluginsPath)) { _Plugins.AddRange(LoadPluginsFromAssembly(corePluginsPath, host)); bFailed = false; } var extraPluginsPath = Path.Combine(directoryPath, "Plugins"); if (Directory.Exists(extraPluginsPath)) { // Load extra plugins. foreach (string sFilePath in Directory.GetFiles(extraPluginsPath, "*.dll")) { _Plugins.AddRange(LoadPluginsFromAssembly(sFilePath, host)); bFailed = false; } } return(bFailed); }
/// <summary> /// Called when the GraphicsManager is being disposed. /// </summary> /// <param name="disposing"></param> private void Dispose(bool disposing) { if (disposing) { if (this.host != null) { this.host.DisplaySizeChanged -= this.Host_DisplaySizeChanged; this.host = null; } if (this.InternalDevice != null) { this.InternalDevice.Dispose(); this.InternalDevice = null; } } }
private List<IPluginInfo> LoadPluginsFromAssembly(string assemblyLocation, IHostControl hostControl) { List<IPluginInfo> retPlugins = new List<IPluginInfo>(); //To avoid exception System.NotSupportedException byte[] file = File.ReadAllBytes(assemblyLocation); Assembly aPlugin = Assembly.Load(file); Type[] tPluginTypes = aPlugin.GetTypes(); foreach (Type tPluginType in tPluginTypes) if (tPluginType.GetInterface("IPlugin") != null) { IPlugin plugin = Activator.CreateInstance(tPluginType) as IPlugin; // If we have a new instance of a plugin, initialize it and add it to return list if (plugin != null) { plugin.HostControl = hostControl; plugin.Initialize(); retPlugins.Add(new PluginInfo(plugin, tPluginType.FullName, Path.GetFileName(assemblyLocation))); } } return retPlugins; }