Exemple #1
0
        private void tlvTableInfos_ItemActivate(object sender, EventArgs e)
        {
            var o = tlvTableInfos.SelectedObject;

            if (o is DecryptionPrivateKeyNode)
            {
                var c = new PasswordEncryptionKeyLocationUI();
                c.SetItemActivator(_activator);
                _activator.ShowWindow(c, true);
            }
        }
Exemple #2
0
        public DockContent Activate(DeserializeInstruction instruction, IActivateItems activator)
        {
            if (instruction.DatabaseObject != null && instruction.ObjectCollection != null)
            {
                throw new ArgumentException("DeserializeInstruction cannot have both a DatabaseObject and an ObjectCollection");
            }

            var c = (Control)_constructor.Construct(instruction.UIControlType, activator, true);

            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
            {
                return((DockContent)activator.ShowWindow(c, true));
            }
        }