Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="pool">May be null.</param>
        /// <param name="host">Never null. In the case of a pool, "host" is set to the master.</param>
        public NewNetworkWizard(Network.IXenConnection connection, Pool pool, Host host)
            : base(connection)
        {
            InitializeComponent();

            pageNetworkType    = new NetWTypeSelect();
            pageName           = new NetWName();
            pageNetworkDetails = new NetWDetails();
            pageBondDetails    = new NetWBondDetails();
            pageChinDetails    = new NetWChinDetails();

            System.Diagnostics.Trace.Assert(host != null);
            Pool = pool;
            Host = host;

            if (Pool != null)
            {
                pageBondDetails.SetPool(Pool);
            }
            else
            {
                pageBondDetails.SetHost(Host);
            }

            pageNetworkDetails.Host = host;
            pageChinDetails.Host    = host;
            pageChinDetails.Pool    = pool;

            AddPage(pageNetworkType);
            AddPage(new XenTabPage {
                Text = ""
            });
        }
 public ApplyLicenseAction(Network.IXenConnection connection, Host host, string filepath, bool activateFreeLicense)
     : base(connection, string.Format(Messages.APPLYLICENSE_TITLE, host.Name), Messages.APPLYLICENSE_PREP)
 {
     this.Host                = host;
     this.Filepath            = filepath;
     this.ActivateFreeLicense = activateFreeLicense;
 }
Beispiel #3
0
        private void UpdateFrom_ <T>(Network.IXenConnection connection, ChangeableDictionary <XenRef <T>, T> target, ObjectChange source) where T : XenObject <T>, new()
        {
            XenRef <T> xenref = source.xenref as XenRef <T>;

            if (xenref == null)
            {
                xenref = new XenRef <T>((string)source.xenref);
            }

            if (source.value != null)
            {
                T to_update = null;
                lock (target)
                {
                    if (!target.TryGetValue(xenref, out to_update))
                    {
                        // add
                        T obj = new T();
                        obj.Connection = connection;
                        obj.UpdateFrom((T)source.value);
                        obj.opaque_ref = xenref.opaque_ref;
                        target.Add(xenref, obj);
                    }
                }

                // Update the object that we found above.  Note that this needs to be done out of the
                // scope of the lock(target), as UpdateFrom is going to fire events.
                if (to_update != null)
                {
                    to_update.UpdateFrom((T)source.value);
                }
            }
            else
            {
                // delete the source object from our model
                lock (target)
                {
                    target.Remove(xenref);
                }
            }
        }