private PersistableToolboxDockContent Show(RDMPCollection collection, RDMPCollectionUI control, string label, Bitmap image) { BackColorProvider c = new BackColorProvider(); image = c.DrawBottomBar(image, collection); var content = _windowFactory.Create(ActivateItems, control, label, image, collection);//these are collections so are not tracked with a window tracker. content.Closed += (s, e) => content_Closed(collection); _visibleToolboxes.Add(collection, content); content.Show(_mainDockPanel, DockState.DockLeft); return(content); }
public PersistableObjectCollectionDockContent Activate(IObjectCollectionControl collectionControl, IPersistableObjectCollection objectCollection) { var floatable = WindowFactory.Create(this, collectionControl, objectCollection, null); floatable.Show(_mainDockPanel, DockState.Document); return(floatable); }
public Form ShowWindow(Control singleControlForm, bool asDocument = false) { int width = singleControlForm.Size.Width + SystemInformation.BorderSize.Width; int height = singleControlForm.Size.Height + SystemInformation.BorderSize.Height; //use the .Text or fallback on .Name string name = string.IsNullOrWhiteSpace(singleControlForm.Text) ? singleControlForm.Name ?? singleControlForm.GetType().Name//or worst case scenario use the type name! : singleControlForm.Text; if (singleControlForm is Form && asDocument) { throw new Exception("Control '" + singleControlForm + "' is a Form and asDocument was passed as true. When asDocument is true you must be a Control not a Form e.g. inherit from RDMPUserControl instead of RDMPForm"); } var c = singleControlForm as RDMPUserControl; if (c != null) { c.SetItemActivator(this); } var content = WindowFactory.Create(this, singleControlForm, name, null); if (asDocument) { content.Show(_mainDockPanel, DockState.Document); } else { content.Show(_mainDockPanel, new Rectangle(0, 0, width, height)); } return(content); }
public void StartSession(string sessionName, IEnumerable <IMapsDirectlyToDatabaseTable> initialObjects) { var panel = WindowFactory.Create(this, new SessionCollectionUI(), new SessionCollection(sessionName) { DatabaseObjects = initialObjects?.ToList() ?? new List <IMapsDirectlyToDatabaseTable>() }, CatalogueIcons.WindowLayout); panel.Show(_mainDockPanel, DockState.DockLeft); }
public Form ShowRDMPSingleDatabaseObjectControl(IRDMPSingleDatabaseObjectControl control, DatabaseEntity objectOfTypeT) { var content = WindowFactory.Create(this, control, objectOfTypeT); content.Show(_mainDockPanel, DockState.Document); control.SetDatabaseObject(this, objectOfTypeT); return(content); }
public DockContent Activate(DeserializeInstruction instruction) { if (instruction.DatabaseObject != null && instruction.ObjectCollection != null) { throw new ArgumentException("DeserializeInstruction cannot have both a DatabaseObject and an ObjectCollection"); } var c = _constructor.Construct(instruction.UIControlType); var uiInstance = c as IRDMPSingleDatabaseObjectControl; var uiCollection = c as IObjectCollectionControl; //it has a database object so call SetDatabaseObject if (uiCollection != null) { //if we get here then Instruction wasn't for a return(Activate(uiCollection, instruction.ObjectCollection)); } else if (uiInstance != null) { var databaseObject = instruction.DatabaseObject; //the database object is gone? deleted maybe if (databaseObject == null) { return(null); } DockContent floatable = WindowFactory.Create(this, RefreshBus, uiInstance, CoreIconProvider.GetImage(databaseObject), databaseObject); floatable.Show(_mainDockPanel, DockState.Document); try { uiInstance.SetDatabaseObject(this, (DatabaseEntity)databaseObject); SetTabText(floatable, uiInstance); } catch (Exception e) { floatable.Close(); throw new Exception("SetDatabaseObject failed on Control of Type '" + instruction.UIControlType.Name + "', control closed, see inner Exception for details", e); } return(floatable); } else { throw new PersistenceException("DeserializeInstruction must have either a DatabaseObject or an ObjectCollection"); } }
private T Activate <T, T2>(T2 databaseObject, Bitmap tabImage) where T : RDMPSingleDatabaseObjectControl <T2>, new() where T2 : DatabaseEntity { Control existingHostedControlInstance; if (PopExisting(typeof(T), databaseObject, out existingHostedControlInstance)) { return((T)existingHostedControlInstance); } var uiInstance = new T(); var floatable = WindowFactory.Create(this, RefreshBus, uiInstance, tabImage, databaseObject); floatable.Show(_mainDockPanel, DockState.Document); uiInstance.SetDatabaseObject(this, databaseObject); SetTabText(floatable, uiInstance); return(uiInstance); }