public ObjectSelectPage(WizardDialog wizardDialog, IPlugIn plugin, IPlugInContainer container) { InitializeComponent(); this.objectSelectDlg = (ObjectSelectDlg)wizardDialog; this.plugin = plugin; this.container = container; }
public PanelTaskTepRealTime(IPlugIn iFunc) : base(iFunc, TepCommon.HandlerDbTaskCalculate.TaskCalculate.TYPE.OUT_TEP_REALTIME) { InitializeComponent(); (Controls.Find(INDEX_CONTROL.BUTTON_RUN.ToString(), true)[0] as Button).Click += new EventHandler(btnRunRes_onClick); }
private void Elem_Click(object sender, EventArgs e) { AccordionControlElement tooStripMenu = sender as AccordionControlElement; if (tooStripMenu == null) { return; } string tag = tooStripMenu.Tag as string; if (string.IsNullOrWhiteSpace(tag)) { return; } //获取插件目录 string Pluginspath = ConfigurationHelper.GetAppSettingOrDefault("PluginsPath", @"\plugins\"); //获取插件对象 IPlugIn plugIn = LoadPlugIn(Pluginspath + tag.Split(',')[1], tag.Split(',')[0]); if (plugIn == null) { MessageDxUtil.ShowError("未找到菜单配置的窗体实例,请检查窗体菜单配置。"); } //创建子窗体并显示 BaseForm plugInForm = plugIn.CreatePlugInForm(); plugInForm.MdiParent = this; plugInForm.Show(); }
//private Hostinfo hn = null; #endregion #region Constructors public GroupPropertiesDlg(IPlugInContainer container, StandardPage parentPage, IPlugIn plugin) : base(container, parentPage) { this.plugin = plugin; InitializeComponent(); InitializePages(); }
public NewGroupDlg(IPlugInContainer container, StandardPage parentPage,Hostinfo hn, IPlugIn plugin) : base(container, parentPage) { InitializeComponent(); // Create an instance of a ListView column sorter and assign it // to the ListView control. lvwColumnSorter = new ListViewColumnSorter(); this.lvMembers.ListViewItemSorter = lvwColumnSorter; this.ButtonCancel.Text = "Cancel"; this.ButtonOK.Text = "Create"; this.SetAllValueChangedHandlers(this); localParent = (LUGPage)parentPage; if (localParent == null) { throw new ArgumentException("NewGroupDlg constructor: (LUGPage) parentPage == null"); } this._hn = hn; this._plugin = (LUGPlugIn)plugin; ((EditDialog)this).btnApply.Visible = false; users = new Hashtable(); this.tbGroupName.Select(); }
//--------------------------------------------------------------------- public Scenario(int duration, string species, string ecoregions, string ecoregionsMap, float?cellLength, string initCommunities, string communitiesMap, IPlugIn succession, IPlugIn[] disturbances, bool disturbRandom, IPlugIn[] outputs, uint?seed) { this.duration = duration; this.species = species; this.ecoregions = ecoregions; this.ecoregionsMap = ecoregionsMap; this.cellLength = cellLength; this.initCommunities = initCommunities; this.communitiesMap = communitiesMap; this.succession = succession; this.disturbances = disturbances; this.disturbRandom = disturbRandom; this.outputs = outputs; this.seed = seed; }
// ***********************Functions*********************** /// <summary> /// Loads the plugIns. /// </summary> /// <param name="path">The path to the plugin directory.</param> /// <param name="createInstance">if set to <c>true</c> if creates an instance of the type.</param> public string[] LoadPlugIns(string path, bool createInstance = true) { DirectoryInfo di = new DirectoryInfo(path); string[] files = Directory.GetFiles(path, "*PlugIn.dll", SearchOption.AllDirectories); AppDomain.CurrentDomain.AssemblyResolve += this.CurrentDomain_AssemblyResolve; foreach (var file in files) { Assembly plugInAssembly = Assembly.LoadFrom(file); var plugInTypes = plugInAssembly.GetExportedTypes() .Where(p => p.GetInterfaces().Any(q => q == typeof(IPlugIn))); if (plugInTypes != null) { foreach (var plugInType in plugInTypes) { IPlugIn plugIn = null; if (createInstance) { plugIn = (IPlugIn)plugInType.GetConstructor(new Type[] { }).Invoke(new object[] { }); } this.plugIns.Add(plugInType, plugIn); } } } AppDomain.CurrentDomain.AssemblyResolve -= this.CurrentDomain_AssemblyResolve; return(files); }
public FileBrowserNode(string filePath, Icon image, Type t, IPlugIn plugin) : base(filePath, image, t, plugin) { }
/// <summary> /// Reads the target machine info for the current plugin from credentilas ini and assign to Hostinfo /// </summary> /// <param name="requestor"></param> /// <param name="_hn"></param> public static void GetConnectedHostInfoFromIni(IPlugIn requestor, Hostinfo _hn) { string sPlugInName = requestor.GetName(); bool IsFileExists = !string.IsNullOrEmpty(sCredentialsFilePath) && Path.IsPathRooted(sCredentialsFilePath) && File.Exists(sCredentialsFilePath); if (!IsFileExists) { return; } StreamReader reader = new StreamReader(sCredentialsFilePath); while (!reader.EndOfStream) { string currentLine = reader.ReadLine(); if (currentLine != null && currentLine.Trim().Equals(sPlugInName)) { currentLine = reader.ReadLine(); int index = 0; if (currentLine != null && currentLine.Trim().IndexOf("hostname=") >= 0 && String.IsNullOrEmpty(_hn.hostName)) { currentLine = currentLine.Trim(); index = (currentLine.IndexOf('=') + 1); _hn.hostName = currentLine.Substring(index, (currentLine.Length - index)); currentLine = reader.ReadLine(); } if (currentLine != null && currentLine.Trim().IndexOf("username="******"domainFQDN=") >= 0 && String.IsNullOrEmpty(_hn.domainName)) { currentLine = currentLine.Trim(); index = (currentLine.IndexOf('=') + 1); _hn.domainName = currentLine.Substring(index, (currentLine.Length - index)); currentLine = reader.ReadLine(); } if (currentLine != null && currentLine.IndexOf("domainShort=") >= 0 && String.IsNullOrEmpty(_hn.creds.Domain)) { currentLine = currentLine.Trim(); index = (currentLine.IndexOf('=') + 1); _hn.creds.Domain = currentLine.Substring(index, (currentLine.Length - index)); } break; } } reader.Close(); }
public FormAboutTepProgram(IPlugIn iFunc) { InitializeComponent(); this._iFuncPlugin = iFunc; this.FormClosing += new FormClosingEventHandler(FormAboutTepProgram_FormClosing); }
/// <summary> /// initializes the Directory node with the selected AD Object DistinguishedName,Objectclass and directory context objects /// initializes selected pulgin info /// </summary> /// <param name="distinguishedName"></param> /// <param name="dirContext"></param> /// <param name="objectClass"></param> /// <param name="image"></param> /// <param name="t"></param> /// <param name="plugin"></param> public DirectoryNode(string distinguishedName, Icon image, Type t, IPlugIn plugin) : base(distinguishedName, image, t, plugin) { }
public PanelPrjRolesAccess(IPlugIn iFunc) : base(iFunc) { InitializeComponent(); m_handlerDb = createHandlerDb(); m_arr_UserRolesTable = new DataTable[3]; }
/// <summary> /// Starts handling files. /// </summary> /// <param name="plugIn">The plugin that should handle files.</param> /// <param name="context">The underlying context.</param> public bool HandleFiles(IPlugIn plugIn, IHandleFilesContext context) { bool result = false; Exception occuredException = null; lock (this._SYNC) { if (this.IsRunning == false) { try { var newTask = CreateHandleFilesTask(this, plugIn, context); this.Task = newTask; newTask.Start(); result = true; } catch (Exception ex) { this.Task = null; occuredException = ex; } } } if (occuredException != null) { this.OnError(occuredException); } return(result); }
public void AddPlug(IPlugIn port) { if (!connections.Contains(port)) { connections.Add(port); } }
private void OnPluginFormClosed(object sender, FormClosedEventArgs e) { if (sender == null) { throw new ArgumentNullException("sender", "未传入插件窗口"); } Form f = sender as Form; if (f == null) { return; } //在关闭窗口时候释放一下系统内存 MemoryUtil.FlushMemory(); //if (_parentMdiChildrenHandles.IndexOf(f.Handle) >= 0) //{ // _parentMdiChildrenHandles.Remove(f.Handle); //} for (int i = 0; i < this.PluginsLoaded.Count; i++) { IPlugIn plugin = (IPlugIn)((IPlugIn)this.PluginsLoaded[i] as PlugIn).Clone(); if (plugin.MainForm == sender) { this.ClosePlugin(plugin); this.PluginsLoaded.Remove(plugin); return; } } }
/// <summary> /// 加载插件 /// </summary> /// <param name="dllPath">插件所在路径</param> /// <param name="fullName">插件全名:namespace+className</param> /// <returns>具体插件</returns> public IPlugIn LoadPlugIn(string dllPath, string fullName) { Assembly pluginAssembly = null; string path = System.IO.Directory.GetCurrentDirectory() + dllPath; try { //加载程序集 pluginAssembly = Assembly.LoadFile(path); } catch (Exception ex) { return(null); } Type[] types = pluginAssembly.GetTypes(); foreach (Type type in types) { if (type.FullName == fullName && type.GetInterface("IPlugIn") != null) { //仅是需要加载的对象才创建插件的实例 IPlugIn plugIn = (IPlugIn)Activator.CreateInstance(type); plugIn.AppContext = this; return(plugIn); } } return(null); }
public PanelTaskTepRealTime(IPlugIn iFunc) : base(iFunc, HandlerDbTaskCalculate.TaskCalculate.TYPE.OUT_TEP_REALTIME) { InitializeComponent(); //Обязательно наличие объекта - панели управления activateDateTimeRangeValue_OnChanged(true); }
public ObjectSelectDlg(IPlugInContainer container, StandardPage parentPage, Hostinfo hn, IPlugIn plugin) : this() { this.IPlugInContainer = container; //this.AddPage(new DomainConnectPage(this, hn, plugin, container)); this.AddPage(new ObjectSelectPage(this, plugin, container)); }
public LACTreeNode(string Name, Icon icon, Type t, IPlugIn plugin) : this(Name, (icon != null ? icon.ToBitmap() : null), t, plugin) { }
private void PlugIn_Instance_FeedImage(object sender, EventArgs e) { IPlugIn p = sender as IPlugIn; if (p == null || p.Enabled == false) { return; } IPlugInFeed f = sender as IPlugInFeed; if (f != null) { f.Image = null; Camera camera = cameraWindow.Camera; if (camera != null) { Bitmap lastFrame = camera.LastFrame; if (lastFrame != null) { Bitmap bmp = CameraBanner.Render(lastFrame, this.CameraClass.Name, false); f.Image = bmp; } } } }
/// <summary> /// 聚焦装载的PlugIn /// </summary> /// <param name="plugin"></param> public void FocusLoadedPlugIn(IPlugIn plugin) { if (plugin.MainForm != null) { plugin.MainForm.BringToFront(); } }
private void OnPlugInStartFormActived(object sender, EventArgs e) { if (sender == null) { throw new ArgumentNullException("sender", "未传入插件窗口"); } Form f = sender as Form; if (f != null) { //if (_parentMdiChildrenHandles.IndexOf(f.Handle) <= 0) //{ // _parentMdiChildrenHandles.Add(f.Handle); //} for (int i = 0; i < this.PluginsLoaded.Count; i++) { IPlugIn plugin = (IPlugIn)((IPlugIn)this.PluginsLoaded[i] as PlugIn).Clone(); if (plugin.MainForm == sender) { if (this.ActivePlugIn == plugin) { return; } // ActivePluginDockingForm(plugin); } } } }
/// <summary> /// Initializes a new instance of the <see cref="PlugInData"/> class. /// </summary> /// <param name="plugIn">A <see cref="IPlugIn"/>-reference to the PlugIn for which to keep the information.</param> public PlugInData(IPlugIn plugIn) { if (plugIn == null) { throw new ArgumentNullException("plugIn"); } this.plugIn = plugIn; Type type = plugIn.GetType(); if (type == null) { throw new InvalidOperationException("Unable to retrieve type of 'plugIn'-instance"); } Assembly asm = type.Assembly; if (asm == null) { throw new InvalidOperationException("Unable to retrieve assembly-information for plugIn-Type"); } this.assemblyFullName = asm.FullName; }
/// <summary> /// Edit the selected plug-in's project configuration /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void btnConfigure_Click(object sender, EventArgs e) { PlugInConfiguration plugInConfig; string newConfig, currentConfig, key = (string)lbProjectPlugIns.SelectedItem; if (PlugInManager.IsSupported(key)) { PlugInInfo info = PlugInManager.PlugIns[key]; using (IPlugIn plugIn = info.NewInstance()) { plugInConfig = currentConfigs[key]; currentConfig = plugInConfig.Configuration; newConfig = plugIn.ConfigurePlugIn(currentConfigs.ProjectFile, currentConfig); } // Only store it if new or if it changed if (currentConfig != newConfig) { plugInConfig.Configuration = newConfig; } } else { MessageBox.Show("The selected plug-in either does not exist " + "or is of a version that is not compatible with this " + "version of the help file builder and cannot be used.", Constants.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void InstantiatePlugIn(PlugInAttribute plugInInfo) { var appDomain = _appDomains[plugInInfo]; IPlugIn plugIn = appDomain.CreateInstanceAndUnwrap(plugInInfo.PlugInName, plugInInfo.EntryType) as IPlugIn; _plugIns.Add(plugInInfo, plugIn); }
///// <summary> ///// Перечисление - индексы таблиц для значений ///// , собранных в автоматическом режиме ///// , "по умолчанию" ///// </summary> //private enum INDEX_TABLE_VALUES : int { REGISTRED, COUNT } public PanelTaskTepOutNorm(IPlugIn iFunc) : base(iFunc, TepCommon.HandlerDbTaskCalculate.TaskCalculate.TYPE.OUT_TEP_NORM_VALUES) { //m_arTableOrigin = new DataTable[(int)HandlerDbTaskCalculate.ID_VIEW_VALUES.COUNT]; //m_arTableEdit = new DataTable[(int)HandlerDbTaskCalculate.ID_VIEW_VALUES.COUNT]; InitializeComponent(); }
///// <summary> ///// Перечисление - индексы таблиц для значений ///// , собранных в автоматическом режиме ///// , "по умолчанию" ///// </summary> //private enum INDEX_TABLE_VALUES : int { REGISTRED, COUNT } public PanelTaskTepOutMkt(IPlugIn iFunc) : base(iFunc, TepCommon.HandlerDbTaskCalculate.TaskCalculate.TYPE.OUT_VALUES) { //m_arTableOrigin = new DataTable[(int)HandlerDbTaskCalculate.INDEX_TABLE_VALUES.COUNT]; //m_arTableEdit = new DataTable[(int)HandlerDbTaskCalculate.INDEX_TABLE_VALUES.COUNT]; InitializeComponent(); }
public NewSharePermissionsPage(WizardDialog wizardDialog, IPlugIn plugin, IPlugInContainer container) { InitializeComponent(); this.plugin = plugin; this.container = container; this.parentDlg = wizardDialog as NewShareWizardDlg; }
public PanelDictFPanels(IPlugIn iFunc) : base(iFunc, @"fpanels", @"ID", @"DESCRIPTION") { InitializeComponent(); //Дополнительные действия при сохранении значений delegateSaveAdding = saveAdding; }
public NewShareWelcomePage(WizardDialog wizardDialog, IPlugIn plugin, IPlugInContainer container) { InitializeComponent(); this.plugin = plugin as FileShareManagerIPlugIn; this.container = container; this.parentDlg = wizardDialog as NewShareWizardDlg; }
public PanelPrjRolesAccess(IPlugIn iFunc, string nameTableTarget, string idFields, string nameTableAccessUnit, string strNameFieldValue) : base(iFunc, nameTableTarget, idFields) { m_nameTableAccessUnit = nameTableAccessUnit; m_strNameFieldValue = strNameFieldValue; InitializeComponent(); }
/// <summary> /// Конструктор - основной (с параметром) /// </summary> /// <param name="iFunc">Объект для связи с вызывающим приложением</param> public PanelTaskTepInval(IPlugIn iFunc) : base(iFunc, TepCommon.HandlerDbTaskCalculate.TaskCalculate.TYPE.IN_VALUES) { InitializeComponent(); // назначить обработчики для кнопок 'К нормативу', 'К макету' (Controls.Find(INDEX_CONTROL.BUTTON_RUN_PREV.ToString(), true)[0] as Button).Click += new EventHandler(btnRunPrev_onClick); // обработчик 'К макету' - см. в базовом классе }
public NewShareFolderSetUpPage(WizardDialog wizardDialog, IPlugIn plugin, IPlugInContainer container) { InitializeComponent(); this.plugin = plugin; this.container = container; this.parentDlg = wizardDialog as NewShareWizardDlg; }
/// <summary> /// The preferred constructor /// </summary> /// <param name="container">Back reference to the PlugInContainer</param> /// <param name="el">Reference to the log being viewed</param> public LogPropertiesPage(IPlugInContainer container, EventLogRecord el, IPlugIn plgin, StandardPage parentPage) : this() { this.pageID = "LogProperities"; this._container = container; this.el = el; this._plugin = plgin as EventlogPlugin; this._parentPage = parentPage; }
public SelectDomainDialog(IPlugIn plugin, string domainname) : this() { tbDomain.Text = domainname; rbDefaultDomain.Checked = true; _hn.domainName = domainname; LMCCredentials.GetPluginCredentials(plugin, _hn); }
public PluginTemplate() { InitializeComponent(); _Dispatcher = this.Dispatcher; _Template = new API.Template(null); _Plugin = _Template.GetPlugIn("Pickup"); _Plugin.KeyValueReceived += _Plugin_KeyValueReceived; }
public static void GetPluginCredentials(IPlugIn plugin, Hostinfo hn) { _plugin = plugin; _hn = hn; if (IsConnectSetBefore(plugin)) GetConnectedHostInfoFromIni(_plugin, _hn); else SetDefaultCredentails(); }
/// <summary>Sets the data source to the <paramref name="plugins"/>.</summary> /// <param name="plugins">The plugins to display.</param> public void SetDataSource(IPlugIn[] plugins) { foreach (IPlugIn plugin in plugins) { ListViewItem item = new ListViewItem(new[] { plugin.PluginName, plugin.PluginDescription, plugin.GetType().Assembly.FullName }); listView1.Items.Add(item); } }
public override void SetPlugInInfo(IPlugInContainer container, IPlugIn pi, LACTreeNode treeNode, LWTreeView lmctreeview, CServerControl sc) { Hostinfo hn = ctx as Hostinfo; base.SetPlugInInfo(container, pi, treeNode, lmctreeview, sc); bEnableActionMenu = false; plugin = pi as FileShareManagerIPlugIn; hn = plugin.HostInfo; Refresh(); }
/// <summary> /// Overriden constructor gets all class schema attributes from AD Schema template /// </summary> /// <param name="container"></param> /// <param name="parentPage"></param> /// <param name="text"></param> /// <param name="schemaCache"></param> public NewShareWizardDlg(IPlugInContainer container, StandardPage parentPage, IPlugIn plugin) : this() { this.plugin = plugin as FileShareManagerIPlugIn; this.shareInfo = new ShareInfo(); shareInfo.hostName = this.plugin.HostInfo.hostName; sharedFolderList = new List<ShareInfo>(); this.AddPage(new NewShareWelcomePage(this, plugin, container)); this.AddPage(new NewShareFolderSetUpPage(this, plugin, container)); this.AddPage(new NewSharePermissionsPage(this, plugin, container)); this.AddPage(new NewShareFinishPage(this, plugin, container)); }
public override void SetPlugInInfo( IPlugInContainer container, IPlugIn pi, LACTreeNode treeNode, LWTreeView lmctreeview, CServerControl sc ) { base.SetPlugInInfo(container, pi, treeNode, lmctreeview, sc); bEnableActionMenu = false; plugin = pi as FileBrowserIPlugIn; Refresh(); }
public void SetData(DirectoryContext dirContext, IPlugIn plugin, IPlugInContainer container) { this.dirContext = dirContext; this.plugin = plugin; this.container = container; lvDomainOUs.Items.Clear(); cbDomainOUs.Items.Add(dirContext.DomainName); cbDomainOUs.SelectedIndex = 0; ListOUChildren(dirContext.RootDN); sParentDN = dirContext.RootDN; SetNavState(false); RefreshlvItems(); }
/// <summary> /// Sets the Plugin information to base /// List the all child nodes, then refreshes the listview with the all child treenodes. /// </summary> /// <param name="ccontainer"></param> /// <param name="pi"></param> /// <param name="treeNode"></param> /// <param name="lmctreeview"></param> public override void SetPlugInInfo(IPlugInContainer ccontainer, IPlugIn pi, LACTreeNode treeNode, LWTreeView lmctreeview, CServerControl sc) { if (treeNode.sc != null) { smallimagelist = treeNode.sc.manage.manageImageList as ImageList; Lagreimagelist = treeNode.sc.manage.manageLargeImageList as ImageList; } base.SetPlugInInfo(ccontainer, pi, treeNode, lmctreeview, sc); if (treeNode != null) { Refresh(); } }
/// <summary> /// 在此动态组合插件,检查所有插件版本,选取版本最高的插件使用 /// </summary> public MyBusinessComponent() { //获取MEF容器 CompositionContainer container=MefInitializer.MefContainer; //组合组件 container.ComposeParts(this); int plugCount=plugIns.Count(); if (plugCount == 1) { _plugin = plugIns.ElementAt(0).Value; } else { if (plugCount > 1) { int highestVersion = 0; int highestVersionIndex = 0; for (int i = 0; i < plugCount; i++) { var plug = plugIns.ElementAt(i); if (plug.Metadata.VersionCode > highestVersion) { highestVersion =plug.Metadata.VersionCode; highestVersionIndex = i; } //if (plug.Metadata["version_code"] != null) //{ // int version_code = int.Parse(plug.Metadata["version_code"].ToString()); // if (version_code > highestVersion) // { // highestVersion = version_code; // highestVersionIndex = i; // } //} } _plugin = plugIns.ElementAt(highestVersionIndex).Value; } } }
private static bool IsConnectSetBefore(IPlugIn requestor) { bool IsSetBefore = false; bool IsFileExists = !string.IsNullOrEmpty(sCredentialsFilePath) && Path.IsPathRooted(sCredentialsFilePath) && File.Exists(sCredentialsFilePath); if (!IsFileExists) return IsSetBefore; StreamReader reader = new StreamReader(sCredentialsFilePath); if (!reader.EndOfStream) { string fileContent = reader.ReadToEnd(); if (fileContent != null && fileContent.Trim().Contains(requestor.GetName())) { IsSetBefore = true; } } reader.Close(); return IsSetBefore; }
/// <summary> /// initializes the Directory node with the selected AD Object DistinguishedName,Objectclass and directory context objects /// initializes selected pulgin info /// </summary> /// <param name="distinguishedName"></param> /// <param name="dirContext"></param> /// <param name="objectClass"></param> /// <param name="image"></param> /// <param name="t"></param> /// <param name="plugin"></param> public ADUCDirectoryNode(string distinguishedName, DirectoryContext dirContext, string objectClass, Icon image, Type t, IPlugIn plugin, bool IsDisabled) : base(distinguishedName, image, t, plugin) { this.distinguishedName = distinguishedName; this.dirContext = dirContext; sc = this.sc; _IsDisabled = IsDisabled; if (!distinguishedName.StartsWith("DC=", StringComparison.InvariantCultureIgnoreCase)) { string[] parts = distinguishedName.Split(','); if (parts.Length > 0) { Text = parts[0]; } } _objectClass = objectClass; if (_IsDisabled && _objectClass.Equals("user", StringComparison.InvariantCultureIgnoreCase)) { objectClass = "disabledUser"; } else if (_IsDisabled && _objectClass.Equals("computer", StringComparison.InvariantCultureIgnoreCase)) { objectClass = "disabledComputer"; } ImageIndex = (int)GetNodeType(objectClass); SelectedImageIndex = (int)GetNodeType(objectClass); }
public void AddExtPlugin(IPlugIn extPlugin) { if (_extPlugins == null) { _extPlugins = new List<IPlugIn>(); } _extPlugins.Add(extPlugin); }
/// <summary> /// Load content for the screen. /// </summary> /// <param name="GraphicInfo"></param> /// <param name="factory"></param> /// <param name="contentManager"></param> protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); RegisterDebugDrawCommand rc = new RegisterDebugDrawCommand(ddrawer); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(rc); path.AddCircularObstacle(Vector3.Zero, 10); path.AddCircularObstacle(new Vector3(0,20,0), 15); path.AddCircularObstacle(new Vector3(200), 10); foreach (var item in path.Obstacles) { SphericalObstacle SphericalObstacle = item as SphericalObstacle; DebugSphere s = new DebugSphere(SphericalObstacle.Center, SphericalObstacle.Radius,Color.Blue); ddrawer.AddShape(s); } //DebugSphere.WireFrameEnabled = true; DebugLines dls = new DebugLines(); ddrawer.AddShape(dls); for (int i = 0; i < path.PolyPath.pointCount - 1; i++) { dls.AddLine(path.PolyPath.points[i], path.PolyPath.points[i ] + Vector3.Up * 200, Color.Brown); dls.AddLine(path.PolyPath.points[i], path.PolyPath.points[i + 1], Color.Red); } dls.AddLine(path.PolyPath.points[path.PolyPath.pointCount - 1], path.PolyPath.points[path.PolyPath.pointCount - 1] + Vector3.Up * 200, Color.Brown); PlugIn = new PedestrianPlugIn(this.World, path, (pd) => { SimpleModel simpleModel = new SimpleModel(factory, "Model//block"); simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Green), TextureType.DIFFUSE); ///Physic info (position, rotation and scale are set here) GhostObject tmesh = new GhostObject(); ///Forward Shader (look at this shader construction for more info) ForwardXNABasicShader shader = new ForwardXNABasicShader(); ///Deferred material ForwardMaterial fmaterial = new ForwardMaterial(shader); ///The object itself IObject obj = new IObject(fmaterial, simpleModel, tmesh); obj.IObjectAttachment.Add(new SteerAtachment(pd)); return obj; }); PlugIn.Init(); { SimpleModel simpleModel = new SimpleModel(factory, "Model//block"); simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White), TextureType.DIFFUSE); ///Physic info (position, rotation and scale are set here) BoxObject tmesh = new BoxObject(Vector3.Zero, 1, 1, 1, 10, new Vector3(1000, 1, 1000), Matrix.Identity, MaterialDescription.DefaultBepuMaterial()); tmesh.isMotionLess = true; ///Forward Shader (look at this shader construction for more info) ForwardXNABasicShader shader = new ForwardXNABasicShader(); ///Deferred material ForwardMaterial fmaterial = new ForwardMaterial(shader); ///The object itself this.World.AddObject(new IObject(fmaterial, simpleModel, tmesh)); } ///add a camera this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
/// <summary> /// 安装插件 /// </summary> public void InstallPlugIn(IPlugIn plugIn) { if (plugIn != null) { _installedPlugInList.Add(plugIn); _installedPlugInMap.Add(plugIn.Guid, plugIn); plugIn.Initialize(this); } }
/// <summary> /// 卸载插件 /// </summary> /// <param name="plugIn"></param> public void UnInstallPlugIn(IPlugIn plugIn) { if (plugIn != null) { _installedPlugInList.Remove(plugIn); _installedPlugInMap.Remove(plugIn.Guid); plugIn.Dispose(); } }
public void AddExtPlugin(IPlugIn extPlugin) { // do nothing }
/// <summary> /// 加入或更新插件的数据接口 /// </summary> /// <param name="gameServerId"></param> /// <param name="plugIn"></param> /// <returns></returns> public static object[] GetData(int gameServerId,IPlugIn plugIn) { //Parameter[0]为参数个数 switch (plugIn.Guid) { case "9609275e-205e-47a5-9065-58e7c52e3cbf": //GameServerDb(); return new object[]{ gameServerId, plugIn.Guid, 0, 0, string.Empty, plugIn.Name }; case "3b2635c2-64ed-48c3-8ae8-25eed4ddbc88": //LordControl return new object[]{ gameServerId, plugIn.Guid, plugIn.Parameters[1], plugIn.Parameters[2], string.Empty, plugIn.Name }; case "895235f4-47d8-4ddb-af7c-fdb3591d437f": //UpdateNetworkCard return new object[]{ gameServerId, plugIn.Guid, plugIn.Parameters[1], 0, string.Empty, plugIn.Name }; case "7008f6d4-73ea-419f-8f08-5fc7f81740ea": //UpdateCpu return new object[]{ gameServerId, plugIn.Guid, plugIn.Parameters[1], 0, string.Empty, plugIn.Name }; case "63b1a0d7-11cc-4680-9b4a-04740dd4f2ea": //UpdateMemory return new object[]{ gameServerId, plugIn.Guid, plugIn.Parameters[1], 0, string.Empty, plugIn.Name }; case "7025123c-4eee-4461-a183-a81535903a59": //UpdateProcess return new object[]{ gameServerId, plugIn.Guid, plugIn.Parameters[1], 0, string.Empty, plugIn.Name }; case "91e63a4f-9ead-4127-bb5d-19f67622ab9d": //UpdatePlugIn return new object[]{ gameServerId, plugIn.Guid, plugIn.Parameters[1], 0, string.Empty, plugIn.Name }; case "c29ed7be-8d7f-4765-83fe-d2a8b581f446": //UpdateDisk return new object[]{ gameServerId, plugIn.Guid, plugIn.Parameters[1], 0, string.Empty, plugIn.Name }; case "02959648-ed95-4220-bef7-a8983da81f18": //Ping return new object[]{ gameServerId, plugIn.Guid, plugIn.Parameters[1], plugIn.Parameters[2], string.Empty, plugIn.Name }; case "f6038d00-c898-4f98-b143-bb6edc51ae17": //FileManage(); return new object[]{ gameServerId, plugIn.Guid, 0, 0, string.Empty, plugIn.Name }; case "a90a90e3-57d3-4711-9e70-30c53c615d70": //GameServerControl(); return new object[]{ gameServerId, plugIn.Guid, 0, 0, string.Empty, plugIn.Name }; case "ccdc26d6-9ca5-4f3f-84f1-4e5fa0493956": //MessageLog return new object[]{ gameServerId, plugIn.Guid, 0, 0, //"D:\\log_"+gameServerId+".txt", plugIn.Parameters[1], plugIn.Name }; default: return null; } }
protected virtual void Initialize(XPathNavigator navigator) { _navigator = navigator; _namespaceManager = new XmlNamespaceManager(_navigator.NameTable); _namespaceManager.AddNamespace("c", ControllerConfiguration.Namespace); _resolver = ((IXmlNamespaceResolver)(_namespaceManager)); ResolveBaseViews(); _controllerName = ((string)(Evaluate("string(/c:dataController/@name)"))); _handlerType = ((string)(Evaluate("string(/c:dataController/@handler)"))); if (String.IsNullOrEmpty(_handlerType)) { Type t = Type.GetType("MyCompany.Rules.SharedBusinessRules"); if (t != null) _handlerType = t.FullName; } _actionHandlerType = _handlerType; _dataFilterType = _handlerType; string s = ((string)(Evaluate("string(/c:dataController/@actionHandlerType)"))); if (!(String.IsNullOrEmpty(s))) _actionHandlerType = s; s = ((string)(Evaluate("string(/c:dataController/@dataFilterType)"))); if (!(String.IsNullOrEmpty(s))) _dataFilterType = s; string plugInType = ((string)(Evaluate("string(/c:dataController/@plugIn)"))); if (!(String.IsNullOrEmpty(plugInType)) && ApplicationServices.IsTouchClient) plugInType = String.Empty; if (!(String.IsNullOrEmpty(plugInType))) { Type t = Type.GetType(plugInType); _plugIn = ((IPlugIn)(t.Assembly.CreateInstance(t.FullName))); _plugIn.Config = this; } }
//--------------------------------------------------------------------- public Scenario(int duration, string species, string ecoregions, string ecoregionsMap, string initCommunities, string communitiesMap, IPlugIn succession, IPlugIn[] disturbances, bool disturbRandom, IPlugIn[] outputs) { this.duration = duration; this.species = species; this.ecoregions = ecoregions; this.ecoregionsMap = ecoregionsMap; this.initCommunities = initCommunities; this.communitiesMap = communitiesMap; this.succession = succession; this.disturbances = disturbances; this.disturbRandom = disturbRandom; this.outputs = outputs; }
/// <summary> /// Called when the page is about to be displayed /// </summary> public override void SetPlugInInfo(IPlugInContainer ccontainer, IPlugIn ppi, LACTreeNode ttreeNode, LWTreeView llmctreeview, CServerControl sc) { treeNode = ttreeNode; // let the base do its thing base.SetPlugInInfo(ccontainer, ppi, ttreeNode, llmctreeview, sc); plugin = ppi as EventlogPlugin; ctx = (IContext)plugin.HostInfo; lactreeNode = ttreeNode; Hostinfo hn = ctx as Hostinfo; if (hn != null && !String.IsNullOrEmpty(hn.hostName) && hn.IsConnectionSuccess) { if (plugin.eventLogHandle == null || plugin.eventLogHandle.Handle == IntPtr.Zero) { plugin.OpenEventLog(hn.hostName); } this.lblCaption.Text = String.Format("EventViewer for {0}", hn.hostName); } else { this.lblCaption.Text = Properties.Resources.sTitleEventsPage; return; } if (memberType == EventViewerNodeType.LOG && !String.IsNullOrEmpty(hn.hostName)) { try { FillComboWithLogCount(); } catch (Exception e) { Logger.LogException("EventViewerControl.SetPlugInInfo", e); container.ShowError("Unable to open the event log; eventlog server may be disabled"); } } else if (memberType == EventViewerNodeType.PLUGIN && !String.IsNullOrEmpty(hn.hostName) && hn.IsConnectionSuccess) { InitializePluginNodeControl(); } }
public static ADUCDirectoryNode GetDirectoryRoot(DirectoryContext dirCtx, string DistinguishedName, Icon image, Type t, IPlugIn plugin) { if (dirCtx == null) { Logger.LogMsgBox("DirectoryNode.GetDirectoryRoot(): dirCtx == null"); return null; } ADUCDirectoryNode dn = new ADUCDirectoryNode(DistinguishedName, dirCtx, "container", image, t, plugin, false); return dn; }