public ViewMaster(Assembly asm) { AssemblyCollection = new List <Assembly>() { asm }; ViewCollection = new List <TViewPoint>(); Keys = new List <string>(); foreach (var a in AssemblyCollection) { var x = ViewPoint.EnumerateViewTypes <TViewPoint>(a); foreach (var v in x) { ViewCollection.Add(v); } } foreach (IViewPoint view in ViewCollection) { Keys.Add(view.Title); } }
/// <summary> /// </summary> static System.Windows.Forms.Form DialogForViewPoint <T>(System.Windows.Forms.Form parentWnd, ViewPoint <T> viewPoint) where T : UserView { T newView = viewPoint.GetView(); System.Windows.Forms.Form form = new System.Windows.Forms.Form(); form.Controls.Add(newView); newView.Dock = System.Windows.Forms.DockStyle.Fill; if (viewPoint.ViewType == ViewPointType.Window) { form.Show(parentWnd); } else if (viewPoint.ViewType == ViewPointType.Dialog) { form.ShowDialog(parentWnd); } else { System.Windows.Forms.MessageBox.Show("Check your window, control or dialog implementation mr developer.", "Mr. Developer needs to think about this..."); } return(form); }
/// <summary> /// </summary> static UserView GetUserView(ViewPoint viewPoint) { return(viewPoint.GetView()); }