Example #1
0
 /// <summary>
 /// Just before a context menu is displayed, each line on the context menu is checked for it should be enabled or disabled.
 /// This method is called with the following command (If allowed by the ItemNode definition)<br/>
 ///   "ADD" - for the "Add new ..." <br/>
 ///   "DELETE" - for the "Delete ..."<br/>
 ///   "RENAME" - for rename<br/>
 /// If your plugin has the configuration stored on another server, and management is not possible
 /// via the ItemManager, then this method can be used to disable all contextmenu actions.
 /// </summary>
 /// <param name="command"></param>
 /// <returns></returns>
 public override bool IsContextMenuValid(string command)
 {
     // We want to ensure that the administrator cannot add more Items that is allowed by the License count + temporary items in grace period
     if (command == "ADD" && !ServerConnectionLicenseHandler.IsAddPossible(GetItems()))
     {
         return(false);
     }
     return(true);
 }
Example #2
0
        /// <summary>
        /// Create a new item. Insert values as user has entered on the AddUserControl.<br/>
        /// The parentFQID can be null, when a top level node is created (e.g. no parent)
        /// The new fqid should be filled with ServerID, ParentId, ObjectId or ObjectIdString and Kind.
        /// </summary>
        /// <param name="parentItem">Identifies the configuration parent to the new item.</param>
        /// <param name="suggestedFQID">A pre-generated fqid with above fields filled.
        /// The ObjectId or ObjectIdString can be overridden.</param>
        /// <param name="addUserControl">A filled user control returned by the GeneratedAddUserControl method after it has been displayed and edited by the user</param>
        /// <returns>A new Item, only the FQID and Name field are required to be filled.  The return value is used to identify and select the item tree node</returns>
        public override Item CreateItem(Item parentItem, FQID suggestedFQID, UserControl addUserControl)
        {
            CurrentItem = new Item(suggestedFQID, ((ServerConnectionAddUserControl)addUserControl).ItemName);
            Configuration.Instance.SaveItemConfiguration(ServerConnectionDefinition.ServerConnectionPluginId, CurrentItem);

            //Make sure to reserve a license for this item, real or temporary
            ServerConnectionLicenseHandler.RegisterItem(GetItems(), CurrentItem);
            return(CurrentItem);
        }
Example #3
0
        /// <summary>
        /// When an administrator selects the context menu Delete item, or press the DEL key,
        /// a confirmation dialog is displayed and upon administrator confirms this method is called.
        /// <code>
        /// For configurations saved on the video server, the following code can be used:
        /// if (item != null)
        /// {
        ///     Configuration.Instance.DeleteItemConfiguration(MyPluginId, item);
        ///	}
        /// </code>
        /// </summary>
        /// <param name="item">The Item to delete</param>
        public override void DeleteItem(Item item)
        {
            if (item != null)
            {
                Configuration.Instance.DeleteItemConfiguration(ServerConnectionDefinition.ServerConnectionPluginId, item);

                // Unregister the license reserved for this item, and try to reallocate it to another in trial mode
                ServerConnectionLicenseHandler.UnRegisterItem(item);
            }
        }
Example #4
0
 /// <summary>
 /// Is called when server is changing or application is closing down.
 /// You should close any remote session you may have, and flush cache.
 /// </summary>
 public override void Close()
 {
     ServerConnectionLicenseHandler.Close();
 }
Example #5
0
 /// <summary>
 /// Is called when the Environment is initializing, and will soon call GetItem methods
 /// IF you need to establish connection to a remote server, this is a good place to initialize.
 /// </summary>
 public override void Init()
 {
     ServerConnectionLicenseHandler.Init(this);
 }