コード例 #1
0
        private DashboardableControlHostPanel Hydrate(IDashboardableControl theControlCreated, DashboardControl dbRecord)
        {
            var emptyCollection = theControlCreated.ConstructEmptyCollection(dbRecord);

            foreach (DashboardObjectUse objectUse in dbRecord.ObjectsUsed)
            {
                var o = _activator.RepositoryLocator.GetArbitraryDatabaseObject(objectUse.ReferencedObjectRepositoryType, objectUse.ReferencedObjectType, objectUse.ReferencedObjectID);
                emptyCollection.DatabaseObjects.Add(o);
            }
            try
            {
                emptyCollection.LoadExtraText(dbRecord.PersistenceString);
            }
            catch (Exception e)
            {
                throw new DashboardControlHydrationException("Could not resolve extra text persistence string for control '" + theControlCreated.GetType() + "'", e);
            }

            theControlCreated.SetCollection(_activator, emptyCollection);

            var host = new DashboardableControlHostPanel(_activator, dbRecord, theControlCreated);

            host.Location = new Point(dbRecord.X, dbRecord.Y);
            host.Width    = dbRecord.Width;
            host.Height   = dbRecord.Height;

            return(host);
        }
コード例 #2
0
        public DashboardableControlHostPanel(IActivateItems activator, DashboardControl databaseRecord, IDashboardableControl hostedControl)
        {
            SetItemActivator(activator);

            _databaseRecord = databaseRecord;
            HostedControl = hostedControl;
            InitializeComponent();
            
            pbDelete.Image = FamFamFamIcons.delete;

            Margin = Padding.Empty;

            pbDelete.Visible = false;
            
            this.Controls.Add((Control)HostedControl);
            
            AdjustControlLocation();
        }