本文整理汇总了C#中IImporter.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IImporter.GetType方法的具体用法?C# IImporter.GetType怎么用?C# IImporter.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IImporter
的用法示例。
在下文中一共展示了IImporter.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: select_SelectedIndexChanged
void select_SelectedIndexChanged(object sender, EventArgs e) {
ImporterItem item = (select.SelectedItem as ImporterItem);
if (item != null) {
if (importer != null) {
UnwireImporterEvents();
importer.Dispose();
}
IImporterUI<IBilingualDictionary> newUI = null;
if (item.Type.GetInterfaces().Contains(typeof(IDictionarySectionImporter))) {
var si = (IDictionarySectionImporter)item.Type.GetConstructor(new Type[] { }).Invoke(new object[] { });
var dsi = new DualSectionImporter();
newUI = new Controls.DictionarySectionUI(dsi, si);
importer = dsi;
} else if(item.Type.IsSubclassOf(typeof(IBilingualDictionary))) {
importer = (IImporter<IBilingualDictionary>)item.Type.GetConstructor(new Type[] { }).Invoke(new object[] { });
foreach (Type t in importer.GetType().Assembly.GetTypes()) {
var attr = Attribute.GetCustomAttribute(t, typeof(ImporterUIAttribute)) as ImporterUIAttribute;
if (attr != null) {
newUI = (IImporterUI<IBilingualDictionary>)Activator.CreateInstance(t, importer);
break;
}
}
}
WireImporterEvents();
if (newUI == null) {
CurrentUI = new Controls.ErrorUI("No UI for " + item.Name, "");
UnwireImporterEvents();
importer.Dispose();
importer = null;
return;
}
newUI.Finished += this.ImporterUIFinished;
CurrentUI = (Control)newUI;
}
}