📄 wxdactivitytoolitem.cs
字号:
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;
using System.ComponentModel.Design;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Diagnostics;
using System.Drawing.Design;
using System.Drawing.Text;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Runtime.Serialization.Formatters;
using System.Text;
using System.Windows.Forms.ComponentModel;
using System.Windows.Forms.Design;
using System.Windows.Forms;
using System;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
namespace wxwinter.wf.Design
{
public class wxdActivityToolItem
{
private string componentClassName;
private Type componentClass;
private string name = null;
private string className = null;
private Image glyph = null;
public wxdActivityToolItem(string componentClassName)
{
this.componentClassName = componentClassName;
}
public string ClassName
{
get
{
if (className == null)
{
className = ComponentClass.FullName;
}
return className;
}
}
public Type ComponentClass
{
get
{
if (componentClass == null)
{
componentClass = Type.GetType(componentClassName);
if (componentClass == null)
{
int index = componentClassName.IndexOf(",");
if (index >= 0)
componentClassName = componentClassName.Substring(0, index);
foreach (AssemblyName referencedAssemblyName in Assembly.GetExecutingAssembly().GetReferencedAssemblies())
{
Assembly assembly = Assembly.Load(referencedAssemblyName);
if (assembly != null)
{
componentClass = assembly.GetType(componentClassName);
if (componentClass != null)
break;
}
}
//Finally check in Activities dll
componentClass = typeof(SequentialWorkflowActivity).Assembly.GetType(componentClassName);
}
}
return componentClass;
}
}
public string Name
{
get
{
if (name == null)
{
if (ComponentClass != null)
name = ComponentClass.Name;
else
name = "Unknown Item";
}
return name;
}
}
public virtual Image Glyph
{
get
{
if (glyph == null)
{
Type t = ComponentClass;
if (t == null)
t = typeof(Component);
ToolboxBitmapAttribute attr = (ToolboxBitmapAttribute)TypeDescriptor.GetAttributes(t)[typeof(ToolboxBitmapAttribute)];
if (attr != null)
glyph = attr.GetImage(t, false);
}
return glyph;
}
}
public override string ToString()
{
return componentClassName;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -