Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="o"></param>
        /// <param name="query"></param>
        public bool Save()
        {
            InvokeHelper.AssertOffEventThread();

            if (uuid == null)
            {
                uuid = System.Guid.NewGuid().ToString();
            }

            String key   = SearchPrefix + uuid;
            String value = GetXML();

            if (connection == null)
            {
                return(false);
            }

            if (!connection.IsConnected)
            {
                return(false);
            }

            Session session = connection.DuplicateSession();

            foreach (Pool pool in connection.Cache.Pools)
            {
                Pool.remove_from_gui_config(session, pool.opaque_ref, key);
                Pool.add_to_gui_config(session, pool.opaque_ref, key, value);

                return(true);
            }

            return(false);
        }
        private static void RemoveCustomFieldsFrom(Session session, IEnumerable <IXenObject> os, CustomFieldDefinition customFieldDefinition)
        {
            InvokeHelper.AssertOffEventThread();

            string customFieldKey = GetCustomFieldKey(customFieldDefinition);

            foreach (IXenObject o in os)
            {
                Helpers.RemoveFromOtherConfig(session, o, customFieldKey);
            }
        }