public ClassTypeList(IWindowsFormsEditorService edSvc, LimnorProject project, ClassTypePointer initSelected) { _srv = edSvc; IList <ComponentID> cis = project.GetAllComponents(); for (int i = 0; i < cis.Count; i++) { if (typeof(Form).IsAssignableFrom(cis[i].ComponentType)) { object[] attrs = cis[i].ComponentType.GetCustomAttributes(typeof(SupportFormAttribute), false); if (attrs != null && attrs.Length > 0) { continue; } int k = this.Items.Add(cis[i]); if (this.SelectedIndex < 0) { if (initSelected != null) { if (cis[i].ComponentId == initSelected.ClassId) { this.SelectedIndex = k; } } } } } }
public StringCollection GetAllComponentNames() { StringCollection sc = new StringCollection(); IList <ComponentID> list = _prj.GetAllComponents(); foreach (ComponentID c in list) { sc.Add(c.ComponentName); } return(sc); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { IWithProject ip = context.Instance as IWithProject; if (ip != null) { LimnorProject prj = ip.Project; if (prj != null) { IList <ComponentID> lst = prj.GetAllComponents(); UInt32 id = 0; bool isString = false; if (context.PropertyDescriptor != null) { isString = (typeof(string).Equals(context.PropertyDescriptor.PropertyType)); } ComponentID cid = value as ComponentID; if (cid != null) { id = cid.ComponentId; } string pageAddr = null; if (isString) { pageAddr = value as string; } ComponentListControl list = new ComponentListControl(edSvc, lst, id, prj, isString, pageAddr); edSvc.DropDownControl(list); if (isString) { if (list.SelectedPageAddress != null) { value = list.SelectedPageAddress; } } else { if (list.SelectedObj != null) { value = list.SelectedObj; } } } } } } return(value); }
private void copyConvert() { try { string sprj = lblSourceProject.Text; string sdir = lblTargetFolder.Text; string srcDir = Path.GetDirectoryName(sprj); string[] files = Directory.GetFiles(srcDir); if (files != null && files.Length > 0) { for (int i = 0; i < files.Length; i++) { string f = Path.GetFileName(files[i]); showinfo(string.Format(CultureInfo.InvariantCulture, "Copying {0}", f)); File.Copy(files[i], Path.Combine(sdir, f), true); } } LimnorProject prj = new LimnorProject(Path.Combine(sdir, Path.GetFileName(sprj))); IList <ComponentID> cs = prj.GetAllComponents(); if (cs == null) { showinfo("Invalid project file"); } else { if (cs.Count == 0) { showinfo("The project is empty"); } else { foreach (ComponentID cid in cs) { showclass(cid); } if (_cancel) { showinfo("Canceled"); } else { int idx = 0; foreach (ComponentID cid in cs) { if (_cancel) { showinfo("Canceled"); break; } else { showinfo(string.Format(CultureInfo.InvariantCulture, "Verifying {0}", cid.ComponentName)); processclass(cid, idx); idx++; } } if (!_cancel) { showinfo("Completed"); } } } } } catch (Exception e) { showinfo(e.Message); showErrMsgBox(e.Message); } finally { this.Invoke((MethodInvoker)(delegate() { btStart.Enabled = true; btTargetFolder.Enabled = true; btBrowse.Enabled = true; btCancel.Enabled = false; })); } }