当前位置: 首页>>代码示例>>C#>>正文


C# IProjectItem.GetType方法代码示例

本文整理汇总了C#中IProjectItem.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IProjectItem.GetType方法的具体用法?C# IProjectItem.GetType怎么用?C# IProjectItem.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProjectItem的用法示例。


在下文中一共展示了IProjectItem.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateNewViewContent_Unsynchronized

		private IMVCController CreateNewViewContent_Unsynchronized(IProjectItem document)
		{
			if (document == null)
				throw new ArgumentNullException(nameof(document));

			// make sure that the item is already contained in the project
			if (!Current.Project.ContainsItem(document))
				Current.Project.AddItemWithThisOrModifiedName(document);

			var types = Altaxo.Main.Services.ReflectionService.GetNonAbstractSubclassesOf(typeof(ICSharpCode.SharpDevelop.Gui.AbstractViewContent));
			System.Reflection.ConstructorInfo cinfo = null;
			object viewContent = null;
			foreach (Type type in types)
			{
				if (null != (cinfo = type.GetConstructor(new Type[] { document.GetType() })))
				{
					var par = cinfo.GetParameters()[0];
					if (par.ParameterType != typeof(object)) // ignore view content which takes the most generic type
					{
						viewContent = cinfo.Invoke(new object[] { document });
						break;
					}
				}
			}

			if (null == viewContent)
			{
				foreach (IProjectItemDisplayBindingDescriptor descriptor in AddInTree.BuildItems<IProjectItemDisplayBindingDescriptor>("/Altaxo/Workbench/ProjectItemDisplayBindings", this, false))
				{
					if (descriptor.ProjectItemType == document.GetType())
					{
						if (null != (cinfo = descriptor.ViewContentType.GetConstructor(new Type[] { document.GetType() })))
						{
							var par = cinfo.GetParameters()[0];
							if (par.ParameterType != typeof(object)) // ignore view content which takes the most generic type
							{
								viewContent = cinfo.Invoke(new object[] { document });
								break;
							}
						}
					}
				}
			}

			var viewContentAsControllerWrapper = viewContent as Altaxo.Gui.IMVCControllerWrapper;

			if (null == viewContentAsControllerWrapper)
				throw new InvalidOperationException("All Altaxo classes implementing SDGraphViewContent have to implement IMVCControllerWrapper, too!");

			if (viewContentAsControllerWrapper.MVCController.ViewObject == null)
			{
				Current.Gui.FindAndAttachControlTo(viewContentAsControllerWrapper.MVCController);
			}

			if (null != Current.Workbench)
				Current.Workbench.ShowView(viewContent);

			return viewContentAsControllerWrapper.MVCController;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:59,代码来源:ProjectService.cs

示例2: RenameValidator

			public RenameValidator(IProjectItem projectItem, string projectItemTypeName)
				: base(string.Format("The {0} name must not be empty! Please enter a valid name.", projectItemTypeName))
			{
				if (null == projectItem)
					throw new ArgumentNullException(nameof(projectItem));

				_projectItem = projectItem;
				_projectItemTypeName = projectItemTypeName;
				if (null == projectItemTypeName)
					_projectItemTypeName = _projectItem.GetType().Name;
			}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:11,代码来源:ProjectItemCommands.cs

示例3: GetProjectItemImageExporter

		/// <summary>
		/// Gets an exporter that can be used to export an image of the provided project item.
		/// </summary>
		/// <param name="item">The item to export, for instance an item of type <see cref="Altaxo.Graph.Gdi.GraphDocument"/> or <see cref="Altaxo.Graph.Graph3D.GraphDocument"/>.</param>
		/// <returns>The image exporter class that can be used to export the item in graphical form, or null if no exporter could be found.</returns>
		public IProjectItemImageExporter GetProjectItemImageExporter(IProjectItem item)
		{
			IProjectItemImageExporter result = null;

			foreach (IProjectItemExportBindingDescriptor descriptor in AddInTree.BuildItems<IProjectItemExportBindingDescriptor>("/Altaxo/Workbench/ProjectItemExportBindings", this, false))
			{
				if (descriptor.ProjectItemType == item.GetType())
				{
					System.Reflection.ConstructorInfo cinfo;
					if (null != (cinfo = descriptor.GraphicalExporterType.GetConstructor(new Type[0])))
					{
						result = cinfo.Invoke(new object[0]) as IProjectItemImageExporter;
						if (null != result)
							break;
					}
				}
			}

			return result;
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:25,代码来源:ProjectService.cs

示例4: ShowRenameDialog

		/// <summary>
		/// Shows a dialog to rename the table.
		/// </summary>
		/// <param name="projectItem">The project item to rename.</param>
		public static void ShowRenameDialog(IProjectItem projectItem)
		{
			string projectItemTypeName = projectItem.GetType().Name;

			TextValueInputController tvctrl = new TextValueInputController(projectItem.Name, string.Format("Enter a name for the {0}:", projectItem));
			tvctrl.Validator = new RenameValidator(projectItem, projectItemTypeName);
			if (Current.Gui.ShowDialog(tvctrl, string.Format("Rename {0}", projectItemTypeName), false))
				projectItem.Name = tvctrl.InputText.Trim();
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:13,代码来源:ProjectItemCommands.cs


注:本文中的IProjectItem.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。