private void OnMenuAdd(object type) { string typeString = (string)type; var current = UFSelection.ActiveControl; if (current == null) { if (typeString == "UFCanvas") { var canvas = new UFCanvas(); canvas.Name = "canvas"; canvas.Text = "canvas"; UFProject.Current.Controls.Add(canvas); } return; } else { var assembly = Assembly.GetAssembly(typeof(UFControl)); Type childType = assembly.GetType(typeString); if (childType != null) { UFControl child = Activator.CreateInstance(childType) as UFControl; child.Name = child.DefaultName; child.Text = child.DefaultName; current.Add(child); UFSelection.ActiveControl = child; } } }
public static void CreateNewProject() { current = new UFProject(); UFCanvas canvas1 = new UFCanvas(); canvas1.Text = "canvas1"; canvas1.Name = "canvas1"; current.Controls.Add(canvas1); }