public SurveyEntryQuotaData()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
 public NSurveyQuestion()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
 public VoterStatisticsData()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
 public CSVExportData()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
 public RegularExpressionData()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
 public Map_Info_Tables()
 {
     InitClass();
     CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(SchemaChanged);
     Tables.CollectionChanged += schemaChangedHandler;
     Relations.CollectionChanged += schemaChangedHandler;
 }
 protected datasourceDataSet(SerializationInfo info, StreamingContext context) : 
         base(info, context, false) {
     if ((this.IsBinarySerialized(info, context) == true)) {
         this.InitVars(false);
         CollectionChangeEventHandler schemaChangedHandler1 = new CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += schemaChangedHandler1;
         this.Relations.CollectionChanged += schemaChangedHandler1;
         return;
     }
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((this.DetermineSchemaSerializationMode(info, context) == SchemaSerializationMode.IncludeSchema)) {
         DataSet ds = new DataSet();
         ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
         this.DataSetName = ds.DataSetName;
         this.Prefix = ds.Prefix;
         this.Namespace = ds.Namespace;
         this.Locale = ds.Locale;
         this.CaseSensitive = ds.CaseSensitive;
         this.EnforceConstraints = ds.EnforceConstraints;
         this.Merge(ds, false, MissingSchemaAction.Add);
         this.InitVars();
     }
     else {
         this.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
     }
     this.GetSerializationData(info, context);
     CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     this.Relations.CollectionChanged += schemaChangedHandler;
 }
 public QuestionSelectionModeData()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
 public UnAuthentifiedUserActionData()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
 public WebSecurityAddInData()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
Example #11
0
 public dsDepartment()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
 protected Map_Features_DataSet(SerializationInfo info, StreamingContext context) {
     string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));
     if ((strSchema != null)) {
         DataSet ds = new DataSet();
         ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
         if ((ds.Tables["Features"] != null)) {
             Tables.Add(new FeaturesDataTable(ds.Tables["Features"]));
         }
         if ((ds.Tables["Types"] != null)) {
             Tables.Add(new TypesDataTable(ds.Tables["Types"]));
         }
         DataSetName = ds.DataSetName;
         Prefix = ds.Prefix;
         Namespace = ds.Namespace;
         Locale = ds.Locale;
         CaseSensitive = ds.CaseSensitive;
         EnforceConstraints = ds.EnforceConstraints;
         Merge(ds, false, MissingSchemaAction.Add);
         InitVars();
     }
     else {
         InitClass();
     }
     GetSerializationData(info, context);
     CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(SchemaChanged);
     Tables.CollectionChanged += schemaChangedHandler;
     Relations.CollectionChanged += schemaChangedHandler;
 }
Example #13
0
        public GeneralTabPage()
        {
            InitializeComponent();

            VM_guest_metrics_CollectionChangedWithInvoke =
                Program.ProgramInvokeHandler(VM_guest_metrics_CollectionChanged);
            OtherConfigAndTagsWatcher.TagsChanged += new EventHandler(OtherConfigAndTagsWatcher_TagsChanged);
            sections = new List<PDSection>();
            foreach (Control control in panel2.Controls)
            {
                Panel p = control as Panel;
                if (p == null)
                    continue;

                foreach (Control c in p.Controls)
                {
                    PDSection s = c as PDSection;
                    if (s == null)
                        continue;
                    sections.Add(s);
                    s.MaximumSize = new Size(900, 9999999);
                    s.fixFirstColumnWidth(150);
                    s.contentChangedSelection += s_contentChangedSelection;
                    s.contentReceivedFocus += s_contentReceivedFocus;
                }
            }
        }
Example #14
0
        public SrPicker(IXenConnection connection)
        {
            this.connection = connection;
            InitializeComponent();

            srListBox.ShowCheckboxes = false;
            srListBox.ShowDescription = true;
            srListBox.ShowImages = true;
            srListBox.NodeIndent = 3;
            srListBox.SelectedIndexChanged += new EventHandler(srListBox_SelectedIndexChanged);

            SrHint.Text = usage == SRPickerType.MoveOrCopy ?
                Messages.IMPORT_WIZARD_TEMPLATE_SR_HINT_TEXT :
                Messages.IMPORT_WIZARD_VM_SR_HINT_TEXT;

            Pool pool = Helpers.GetPoolOfOne(connection);
            if (pool != null)
            {
                pool.PropertyChanged -= Server_PropertyChanged;
                pool.PropertyChanged += Server_PropertyChanged;
            }
            SR_CollectionChangedWithInvoke=Program.ProgramInvokeHandler(SR_CollectionChanged);
            connection.Cache.RegisterCollectionChanged<SR>(SR_CollectionChangedWithInvoke);

            refresh();
        }
 public MessageConditionData()
 {
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
Example #16
0
 public ISODropDownBox()
 {
     SR_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(SR_CollectionChanged);
     DrawMode = DrawMode.OwnerDrawFixed;
     DropDownStyle = ComboBoxStyle.DropDownList;
     FormattingEnabled = true;
 }
Example #17
0
 protected dsItem(SerializationInfo info, StreamingContext context)
 {
     string s = (string) info.GetValue("XmlSchema", typeof(string));
     if (s != null)
     {
         DataSet dataSet = new DataSet();
         dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
         if (dataSet.Tables["Item"] != null)
         {
             base.Tables.Add(new _ItemDataTable(dataSet.Tables["Item"]));
         }
         base.DataSetName = dataSet.DataSetName;
         base.Prefix = dataSet.Prefix;
         base.Namespace = dataSet.Namespace;
         base.Locale = dataSet.Locale;
         base.CaseSensitive = dataSet.CaseSensitive;
         base.EnforceConstraints = dataSet.EnforceConstraints;
         base.Merge(dataSet, false, MissingSchemaAction.Add);
         this.InitVars();
     }
     else
     {
         this.InitClass();
     }
     base.GetSerializationData(info, context);
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
 }
Example #18
0
		public VMHAEditPage()
        {
            InitializeComponent();
            Host_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
			Text = Messages.START_UP_OPTIONS;
            nudStartDelay.Maximum = long.MaxValue;
            nudOrder.Maximum = long.MaxValue;
        }
 public datasourceDataSet() {
     this.BeginInit();
     this.InitClass();
     CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += schemaChangedHandler;
     base.Relations.CollectionChanged += schemaChangedHandler;
     this.EndInit();
 }
 public ApplicationInfoDS()
 {
     base.BeginInit();
     this.InitClass();
     CollectionChangeEventHandler value = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += value;
     base.Relations.CollectionChanged += value;
     base.EndInit();
 }
 public AlertCustomerExpressionDS()
 {
     base.BeginInit();
     this.InitClass();
     CollectionChangeEventHandler value = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += value;
     base.Relations.CollectionChanged += value;
     base.EndInit();
 }
 public UserWorkingProfileDS()
 {
     base.BeginInit();
     this.InitClass();
     CollectionChangeEventHandler value = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += value;
     base.Relations.CollectionChanged += value;
     base.EndInit();
 }
        public PhysicalStoragePage()
        {
            InitializeComponent();

            listViewSrs.SmallImageList = Images.ImageList16;
            listViewSrs.ListViewItemSorter = lvwColumnSorter;
            listViewSrs.SelectedIndexChanged += new EventHandler(listViewSrs_SelectedIndexChanged);
            base.Text = Messages.STORAGE_TAB_TITLE;
            PBD_CollectionChangedWithInvoke=Program.ProgramInvokeHandler(PBD_CollectionChanged);
        }
Example #24
0
 public DsNpStat()
 {
     this._schemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
     base.BeginInit();
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.CollectionChanged += handler;
     base.Relations.CollectionChanged += handler;
     base.EndInit();
 }
Example #25
0
 public StreetsHousesFlatsDS()
 {
     this._schemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
     base.BeginInit();
     this.InitClass();
     CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
     base.Tables.add_CollectionChanged(handler);
     base.Relations.add_CollectionChanged(handler);
     base.EndInit();
 }
Example #26
0
 public AdPage()
 {
     InitializeComponent();
     Pool_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Pool_CollectionChanged);
     ColumnSubject.CellTemplate = new KeyValuePairCell();
     tTipLogoutButton.SetToolTip(Messages.AD_CANNOT_MODIFY_ROOT);
     tTipRemoveButton.SetToolTip(Messages.AD_CANNOT_MODIFY_ROOT);
     ConnectionsManager.History.CollectionChanged += new CollectionChangeEventHandler(History_CollectionChanged);
     Text = Messages.ACTIVE_DIRECTORY_TAB_TITLE;
     joinPrompt = new AdPasswordPrompt(true, null);
 }
Example #27
0
 public BallooningPage()
 {
     InitializeComponent();
     // http://alt.pluralsight.com/wiki/default.aspx/Craig.FlickerFreeControlDrawing
     SetStyle(ControlStyles.DoubleBuffer |
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.Opaque |
         ControlStyles.UserPaint, true);
     Text = Messages.DYNAMIC_MEMORY_CONTROL;
     Host_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
     VM_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(VM_CollectionChanged);
 }
        public AssignPriorities()
        {
            InitializeComponent();
            VM_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(VM_CollectionChanged);

            haNtolIndicator.UpdateInProgressChanged += haNtolIndicator_UpdateInProgressChanged;

            nudStartDelay.Maximum = long.MaxValue;
            nudOrder.Maximum = long.MaxValue;

            m_worker = new QueuedBackgroundWorker();
        }
Example #29
0
 protected TemplateDS(SerializationInfo info, StreamingContext context)
     : base(info, context, false)
 {
     if (base.IsBinarySerialized(info, context))
     {
         this.InitVars(false);
         CollectionChangeEventHandler value = new CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged += value;
         this.Relations.CollectionChanged += value;
     }
     else
     {
         string s = (string)info.GetValue("XmlSchema", typeof(string));
         if (base.DetermineSchemaSerializationMode(info, context) == SchemaSerializationMode.IncludeSchema)
         {
             DataSet dataSet = new DataSet();
             dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
             if (dataSet.Tables["TemplateProperty"] != null)
             {
                 base.Tables.Add(new TemplateDS.TemplatePropertyDataTable(dataSet.Tables["TemplateProperty"]));
             }
             if (dataSet.Tables["FormInfo"] != null)
             {
                 base.Tables.Add(new TemplateDS.FormInfoDataTable(dataSet.Tables["FormInfo"]));
             }
             if (dataSet.Tables["FormProperty"] != null)
             {
                 base.Tables.Add(new TemplateDS.FormPropertyDataTable(dataSet.Tables["FormProperty"]));
             }
             if (dataSet.Tables["FormRememberField"] != null)
             {
                 base.Tables.Add(new TemplateDS.FormRememberFieldDataTable(dataSet.Tables["FormRememberField"]));
             }
             base.DataSetName = dataSet.DataSetName;
             base.Prefix = dataSet.Prefix;
             base.Namespace = dataSet.Namespace;
             base.Locale = dataSet.Locale;
             base.CaseSensitive = dataSet.CaseSensitive;
             base.EnforceConstraints = dataSet.EnforceConstraints;
             base.Merge(dataSet, false, MissingSchemaAction.Add);
             this.InitVars();
         }
         else
         {
             base.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
         }
         base.GetSerializationData(info, context);
         CollectionChangeEventHandler value2 = new CollectionChangeEventHandler(this.SchemaChanged);
         base.Tables.CollectionChanged += value2;
         this.Relations.CollectionChanged += value2;
     }
 }
Example #30
0
        public GenericSelectHostsPage()
        {
            InitializeComponent();

            buildList();
            Host_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
            HostListTreeView.ShowImages = true;
            HostListTreeView.ShowCheckboxes = true;
            HostListTreeView.ShowDescription = true;
            HostListTreeView.ItemCheckChanged += HostListTreeView_ItemCheckChanged;

            ConnectionsManager.XenConnections.CollectionChanged += XenConnections_CollectionChanged;
        }
        public void OnCollectionChanging_Invoke_CallsHandler()
        {
            var collection = new SubBindingsCollection();
            var eventArgs  = new CollectionChangeEventArgs(CollectionChangeAction.Refresh, null);
            int callCount  = 0;
            CollectionChangeEventHandler handler = (sender, e) =>
            {
                Assert.Same(collection, sender);
                Assert.Same(eventArgs, e);
                callCount++;
            };

            // Call with handler.
            collection.CollectionChanging += handler;
            collection.OnCollectionChanging(eventArgs);
            Assert.Equal(1, callCount);

            // Remove handler.
            collection.CollectionChanging -= handler;
            collection.OnCollectionChanging(eventArgs);
            Assert.Equal(1, callCount);
        }
Example #32
0
        protected VoterAnswersData(SerializationInfo info, StreamingContext context)
        {
            string s = (string)info.GetValue("XmlSchema", typeof(string));

            if (s != null)
            {
                DataSet dataSet = new DataSet();
                dataSet.ReadXmlSchema(XmlTextReader.Create(new StringReader(s), new XmlReaderSettings()
                {
                    DtdProcessing = DtdProcessing.Ignore, XmlResolver = null
                }));
                if (dataSet.Tables["Voters"] != null)
                {
                    base.Tables.Add(new VotersDataTable(dataSet.Tables["Voters"]));
                }
                if (dataSet.Tables["VotersAnswers"] != null)
                {
                    base.Tables.Add(new VotersAnswersDataTable(dataSet.Tables["VotersAnswers"]));
                }
                base.DataSetName        = dataSet.DataSetName;
                base.Prefix             = dataSet.Prefix;
                base.Namespace          = dataSet.Namespace;
                base.Locale             = dataSet.Locale;
                base.CaseSensitive      = dataSet.CaseSensitive;
                base.EnforceConstraints = dataSet.EnforceConstraints;
                base.Merge(dataSet, false, MissingSchemaAction.Add);
                this.InitVars();
            }
            else
            {
                this.InitClass();
            }
            base.GetSerializationData(info, context);
            CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);

            base.Tables.CollectionChanged    += handler;
            base.Relations.CollectionChanged += handler;
        }
Example #33
0
        internal void RegisterMetaDataEvents(DataTable table)
        {
            Debug.Assert(null == _table, "DataViewListener already registered table");
            _table = table;
            if (table != null)
            {
                // actively remove listeners without a target
                RegisterListener(table);

                // start listening to events
                var handlerCollection = new CollectionChangeEventHandler(ColumnCollectionChanged);
                table.Columns.ColumnPropertyChanged += handlerCollection;
                table.Columns.CollectionChanged     += handlerCollection;

                var handlerChildRelation = new CollectionChangeEventHandler(ChildRelationCollectionChanged);
                ((DataRelationCollection.DataTableRelationCollection)(table.ChildRelations)).RelationPropertyChanged += handlerChildRelation;
                table.ChildRelations.CollectionChanged += handlerChildRelation;

                var handlerParentRelation = new CollectionChangeEventHandler(ParentRelationCollectionChanged);
                ((DataRelationCollection.DataTableRelationCollection)(table.ParentRelations)).RelationPropertyChanged += handlerParentRelation;
                table.ParentRelations.CollectionChanged += handlerParentRelation;
            }
        }
Example #34
0
        public AttachDiskDialog(VM vm) : base(vm.Connection)
        {
            TheVM = vm;

            InitializeComponent();
            
            DiskListTreeView.ShowCheckboxes = false;
            DiskListTreeView.ShowDescription = true;
            DiskListTreeView.ShowImages = true;
            DiskListTreeView.SelectedIndexChanged += DiskListTreeView_SelectedIndexChanged;
            SR_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(SR_CollectionChanged);
            connection.Cache.RegisterCollectionChanged<SR>(SR_CollectionChangedWithInvoke);

            poolofone = Helpers.GetPoolOfOne(connection);
            if (poolofone != null)
                poolofone.PropertyChanged += Server_Changed;

            readonlyCheckboxToolTipContainer.SuppressTooltip = false;
            DeactivateControlsForHvmVm();

            BuildList();
            DiskListTreeView_SelectedIndexChanged(null, null);
        }
Example #35
0
 protected NewDataSet(SerializationInfo info, StreamingContext context) : base(info, context, false)
 {
     this._schemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
     if (this.IsBinarySerialized(info, context))
     {
         this.InitVars(false);
         CollectionChangeEventHandler handler2 = new CollectionChangeEventHandler(this.SchemaChanged);
         this.Tables.CollectionChanged    += handler2;
         this.Relations.CollectionChanged += handler2;
     }
     else
     {
         string s = Conversions.ToString(info.GetValue("XmlSchema", typeof(string)));
         if (this.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)
         {
             DataSet dataSet = new DataSet();
             dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
             this.DataSetName        = dataSet.DataSetName;
             this.Prefix             = dataSet.Prefix;
             this.Namespace          = dataSet.Namespace;
             this.Locale             = dataSet.Locale;
             this.CaseSensitive      = dataSet.CaseSensitive;
             this.EnforceConstraints = dataSet.EnforceConstraints;
             this.Merge(dataSet, false, MissingSchemaAction.Add);
             this.InitVars();
         }
         else
         {
             this.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
         }
         this.GetSerializationData(info, context);
         CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
         base.Tables.CollectionChanged    += handler;
         this.Relations.CollectionChanged += handler;
     }
 }
Example #36
0
        protected TESTDataSet(SerializationInfo info, StreamingContext context) :
            base(info, context, false)
        {
            if ((this.IsBinarySerialized(info, context) == true))
            {
                this.InitVars(false);
                CollectionChangeEventHandler schemaChangedHandler1 = new CollectionChangeEventHandler(this.SchemaChanged);
                this.Tables.CollectionChanged    += schemaChangedHandler1;
                this.Relations.CollectionChanged += schemaChangedHandler1;
                return;
            }
            string strSchema = ((string)(info.GetValue("XmlSchema", typeof(string))));

            if ((this.DetermineSchemaSerializationMode(info, context) == SchemaSerializationMode.IncludeSchema))
            {
                DataSet ds = new DataSet();
                ds.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
                this.DataSetName        = ds.DataSetName;
                this.Prefix             = ds.Prefix;
                this.Namespace          = ds.Namespace;
                this.Locale             = ds.Locale;
                this.CaseSensitive      = ds.CaseSensitive;
                this.EnforceConstraints = ds.EnforceConstraints;
                this.Merge(ds, false, MissingSchemaAction.Add);
                this.InitVars();
            }
            else
            {
                this.ReadXmlSchema(new XmlTextReader(new StringReader(strSchema)));
            }
            this.GetSerializationData(info, context);
            CollectionChangeEventHandler schemaChangedHandler = new CollectionChangeEventHandler(this.SchemaChanged);

            base.Tables.CollectionChanged    += schemaChangedHandler;
            this.Relations.CollectionChanged += schemaChangedHandler;
        }
Example #37
0
 public SrPicker()
 {
     InitializeComponent();
     SR_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(SR_CollectionChanged);
 }
Example #38
0
 public FilterLocationToolStripDropDownButton()
 {
     ConnectionsManager.XenConnections.CollectionChanged += XenConnections_CollectionChanged;
     m_hostCollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
 }
Example #39
0
 protected HaNtolControl()
 {
     VM_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(VM_CollectionChanged);
 }
        protected override void Run()
        {
            Description = Messages.LICENSE_UPDATING_LICENSES;
            foreach (IXenObject xo in xos)
            {
                Connection = xo.Connection;

                if (!Connection.IsConnected)
                {
                    continue;
                }

                Host host = null;
                Pool pool = null;

                if (xo is Host)
                {
                    host = xo as Host;
                }
                if (xo is Pool)
                {
                    pool = xo as Pool;
                    host = xo.Connection.Resolve(pool.master);
                }

                string previousLicenseServerAddress = null;
                string previousLicenseServerPort    = null;
                CollectionChangeEventHandler alertsChangeHandler = null;
                string alertText = null;
                object lck       = new object();

                if (host != null && host.license_server.ContainsKey("address"))
                {
                    previousLicenseServerAddress = host.license_server["address"];
                }

                if (host != null && host.license_server.ContainsKey("port"))
                {
                    previousLicenseServerPort = host.license_server["port"];
                }

                try
                {
                    if (pool != null)
                    {
                        pool.Connection.Cache.Hosts.ToList().ForEach(h => SetLicenseServer(h, _licenseServerAddress, _licenseServerPort));
                    }
                    else
                    {
                        SetLicenseServer(host, _licenseServerAddress, _licenseServerPort);
                    }

                    IXenObject xoClosure = xo;
                    alertsChangeHandler = delegate(object sender, CollectionChangeEventArgs e)
                    {
                        if (e.Action == CollectionChangeAction.Add)
                        {
                            lock (lck)
                            {
                                Alert alert = (Alert)e.Element;
                                Message.MessageType messageType;
                                // if this is a message alert, its Name property will contain the MessageType
                                if (host != null && host.uuid == alert.HostUuid && Enum.TryParse(alert.Name, out messageType))
                                {
                                    switch (messageType)
                                    {
                                    case Message.MessageType.LICENSE_NOT_AVAILABLE:
                                    case Message.MessageType.LICENSE_SERVER_UNREACHABLE:
                                    case Message.MessageType.LICENSE_SERVER_VERSION_OBSOLETE:
                                        alertText = string.Format(Message.FriendlyBody(alert.Name), xoClosure.Name());
                                        break;

                                    case Message.MessageType.GRACE_LICENSE:
                                        alertText = string.Empty;
                                        break;
                                    }
                                }
                            }
                        }
                    };

                    Alert.RegisterAlertCollectionChanged(alertsChangeHandler);

                    if (xo is Host && host != null)
                    {
                        Host.apply_edition(host.Connection.Session, host.opaque_ref, host.GetEditionText(_edition), false);
                    }

                    if (xo is Pool)
                    {
                        var firstHost = xo.Connection.Cache.Hosts.FirstOrDefault();
                        if (firstHost != null)
                        {
                            Pool.apply_edition(xo.Connection.Session, pool.opaque_ref, firstHost.GetEditionText(_edition));
                        }
                    }

                    Description = Messages.APPLYLICENSE_UPDATED;
                }
                catch (Failure e)
                {
                    for (int i = 0; i < 50; i++)
                    {
                        Thread.Sleep(100);

                        lock (lck)
                        {
                            if (alertText != null)
                            {
                                break;
                            }
                        }
                    }

                    LicenseFailures.Add(new LicenseFailure(host, alertText ?? e.Message));

                    if (pool != null)
                    {
                        pool.Connection.Cache.Hosts.ToList().ForEach(h => SetLicenseServer(h, previousLicenseServerAddress, previousLicenseServerPort));
                    }
                    else
                    {
                        SetLicenseServer(host, previousLicenseServerAddress, previousLicenseServerPort);
                    }
                }
                finally
                {
                    Alert.DeregisterAlertCollectionChanged(alertsChangeHandler);
                }
            }

            if (LicenseFailures.Count > 0)
            {
                string exceptionText = LicenseFailures.Count == 1 ? string.Format(Messages.LICENSE_ERROR_1, LicenseFailures[0].Host.Name()) : string.Format(Messages.LICENSE_ERROR_MANY, LicenseFailures.Count, new List <IXenObject>(xos).Count);

                DoOnLicensingFailure?.Invoke(LicenseFailures, exceptionText);
                throw new InvalidOperationException(exceptionText);
            }
        }
Example #41
0
 public static CollectionChangeEventHandler InvokeHandler(ISynchronizeInvoke synchronizer, CollectionChangeEventHandler handler)
 {
     return(delegate(object s, CollectionChangeEventArgs args)
     {
         if (synchronizer != null)
         {
             BeginInvoke(synchronizer, delegate()
             {
                 if (handler != null)
                 {
                     handler(s, args);
                 }
             });
         }
     });
 }
Example #42
0
 public virtual void RegisterObjectStateManagerChangedEvent(CollectionChangeEventHandler handler)
 {
     this.ObjectContext.ObjectStateManager.ObjectStateManagerChanged += handler;
 }
Example #43
0
 public static void DeregisterCollectionChanged(CollectionChangeEventHandler handler)
 {
     updateAlerts.CollectionChanged -= handler;
 }
Example #44
0
 public static void DeregisterAlertCollectionChanged(CollectionChangeEventHandler handler)
 {
     XenCenterAlerts.CollectionChanged -= handler;
 }
Example #45
0
        protected override void Run()
        {
            List <LicenseFailure> licenseFailures = new List <LicenseFailure>();

            // PR-1102: hosts that have been updated, plus the previous edition information - this data will be sent to the licensing server
            Dictionary <Host, LicensingHelper.LicenseDataStruct> updatedHosts = new Dictionary <Host, LicensingHelper.LicenseDataStruct>();

            this.Description = Messages.LICENSE_UPDATING_LICENSES;
            foreach (IXenObject xo in xos)
            {
                Connection = xo.Connection;

                if (!Connection.IsConnected)
                {
                    continue;
                }

                Host host = null;
                Pool pool = null;

                if (xo is Host)
                {
                    host = xo as Host;
                }
                if (xo is Pool)
                {
                    pool = xo as Pool;
                    host = xo.Connection.Resolve(pool.master);
                }

                string previousLicenseServerAddress = null;
                string previousLicenseServerPort    = null;
                CollectionChangeEventHandler alertsChangeHandler = null;
                string alertText = null;
                object lck       = new object();

                if (host != null && host.license_server.ContainsKey("address"))
                {
                    previousLicenseServerAddress = host.license_server["address"];
                }

                if (host != null && host.license_server.ContainsKey("port"))
                {
                    previousLicenseServerPort = host.license_server["port"];
                }

                try
                {
                    if (pool != null)
                    {
                        pool.Connection.Cache.Hosts.ToList().ForEach(h => SetLicenseServer(h, _licenseServerAddress, _licenseServerPort));
                    }
                    else
                    {
                        SetLicenseServer(host, _licenseServerAddress, _licenseServerPort);
                    }

                    IXenObject xoClosure = xo;
                    alertsChangeHandler = delegate(object sender, CollectionChangeEventArgs e)
                    {
                        if (e.Action == CollectionChangeAction.Add)
                        {
                            lock (lck)
                            {
                                Alert alert = (Alert)e.Element;
                                if (host != null && host.uuid == alert.HostUuid)
                                {
                                    if (alert.Title == PropertyManager.GetFriendlyName("Message.name-license_not_available"))
                                    {
                                        // the license server reported there were no licenses available.
                                        alertText = string.Format(PropertyManager.GetFriendlyName("Message.body-license_not_available"), xoClosure.Name);
                                    }
                                    else if (alert.Title == PropertyManager.GetFriendlyName("Message.name-license_server_unreachable"))
                                    {
                                        // couldn't check out license because couldn't contact license server
                                        alertText = string.Format(PropertyManager.GetFriendlyName("Message.body-license_server_unreachable"), xoClosure.Name);
                                    }
                                    else if (alert.Title == PropertyManager.GetFriendlyName("Message.name-grace_license"))
                                    {
                                        alertText = string.Empty;
                                    }
                                }
                            }
                        }
                    };

                    Alert.XenCenterAlerts.CollectionChanged += alertsChangeHandler;

                    // PR-1102: catch the host's license data, before applying the new one, so it can be sent later to the licensing server
                    LicensingHelper.LicenseDataStruct previousLicenseData = new LicensingHelper.LicenseDataStruct(host);

                    if (xo is Host && host != null)
                    {
                        if (Helpers.ClearwaterOrGreater(host))
                        {
                            Host.apply_edition(host.Connection.Session, host.opaque_ref, Host.GetEditionText(_edition), false);
                        }
                        else
                        {
                            Host.apply_edition(host.Connection.Session, host.opaque_ref, Host.GetEditionText(_edition));
                        }

                        // PR-1102: populate the list of updated hosts
                        updatedHosts.Add(host, previousLicenseData);
                    }

                    if (xo is Pool)
                    {
                        if (!Helpers.ClearwaterOrGreater(xo.Connection))
                        {
                            foreach (Host poolHost in xo.Connection.Cache.Hosts)
                            {
                                Host.apply_edition(host.Connection.Session, poolHost.opaque_ref, Host.GetEditionText(_edition));
                            }
                        }
                        else
                        {
                            Pool.apply_edition(xo.Connection.Session, pool.opaque_ref, Host.GetEditionText(_edition));
                            //TODO: Look into why this is required. Event.Next returning late? XAPI returning before updated?
                            Thread.Sleep(200);
                        }


                        xo.Connection.Cache.Hosts.ToList().ForEach(h => updatedHosts.Add(h, previousLicenseData));
                    }

                    Description = Messages.APPLYLICENSE_UPDATED;
                }
                catch (Failure e)
                {
                    for (int i = 0; i < 50; i++)
                    {
                        Thread.Sleep(100);

                        lock (lck)
                        {
                            if (alertText != null)
                            {
                                break;
                            }
                        }
                    }

                    licenseFailures.Add(new LicenseFailure(host, alertText ?? e.Message));

                    if (pool != null)
                    {
                        pool.Connection.Cache.Hosts.ToList().ForEach(h => SetLicenseServer(h, previousLicenseServerAddress, previousLicenseServerPort));
                    }
                    else
                    {
                        SetLicenseServer(host, previousLicenseServerAddress, previousLicenseServerPort);
                    }
                }
                finally
                {
                    Alert.XenCenterAlerts.CollectionChanged -= alertsChangeHandler;
                }
            }

            // PR-1102: Send licensing data to the activation server
            if (updatedHosts.Count > 0)
            {
                LicensingHelper.SendLicenseEditionData(updatedHosts, Host.GetEditionText(_edition));
            }

            if (licenseFailures.Count > 0)
            {
                string exceptionText = licenseFailures.Count == 1 ? string.Format(Messages.LICENSE_ERROR_1, licenseFailures[0].Host.Name) : string.Format(Messages.LICENSE_ERROR_MANY, licenseFailures.Count, new List <IXenObject>(xos).Count);

                if (DoOnLicensingFailure != null)
                {
                    DoOnLicensingFailure(licenseFailures, exceptionText);
                }
                throw new InvalidOperationException(exceptionText);
            }
        }
Example #46
0
        private void OnTablesChanging(CollectionChangeAction collectionChangeAction, Object collection)
        {
            CollectionChangeEventHandler e = CollectionChanging;

            fireEvent(collectionChangeAction, collection, e);
        }
 public ToolboxItemCollection()
 {
     ItemChanged += new CollectionChangeEventHandler(OnToolBoxItemCollectionChanged);
 }
        protected override void Run()
        {
            // PR-1102: hosts that have been updated, plus the previous edition information - this data will be sent to the licensing server
            Dictionary <Host, LicensingHelper.LicenseDataStruct> updatedHosts = new Dictionary <Host, LicensingHelper.LicenseDataStruct>();

            this.Description = Messages.LICENSE_UPDATING_LICENSES;
            foreach (IXenObject xo in xos)
            {
                Connection = xo.Connection;

                if (!Connection.IsConnected)
                {
                    continue;
                }

                Host host = null;
                Pool pool = null;

                if (xo is Host)
                {
                    host = xo as Host;
                }
                if (xo is Pool)
                {
                    pool = xo as Pool;
                    host = xo.Connection.Resolve(pool.master);
                }

                string previousLicenseServerAddress = null;
                string previousLicenseServerPort    = null;
                CollectionChangeEventHandler alertsChangeHandler = null;
                string alertText = null;
                object lck       = new object();

                if (host != null && host.license_server.ContainsKey("address"))
                {
                    previousLicenseServerAddress = host.license_server["address"];
                }

                if (host != null && host.license_server.ContainsKey("port"))
                {
                    previousLicenseServerPort = host.license_server["port"];
                }

                try
                {
                    if (pool != null)
                    {
                        pool.Connection.Cache.Hosts.ToList().ForEach(h => SetLicenseServer(h, _licenseServerAddress, _licenseServerPort));
                    }
                    else
                    {
                        SetLicenseServer(host, _licenseServerAddress, _licenseServerPort);
                    }

                    IXenObject xoClosure = xo;
                    alertsChangeHandler = delegate(object sender, CollectionChangeEventArgs e)
                    {
                        if (e.Action == CollectionChangeAction.Add)
                        {
                            lock (lck)
                            {
                                Alert alert = (Alert)e.Element;
                                Message.MessageType messageType;
                                // if this is a message alert, its Name property will contain the MessageType
                                if (host != null && host.uuid == alert.HostUuid && Enum.TryParse(alert.Name, out messageType))
                                {
                                    switch (messageType)
                                    {
                                    case Message.MessageType.LICENSE_NOT_AVAILABLE:
                                    case Message.MessageType.LICENSE_SERVER_UNREACHABLE:
                                    case Message.MessageType.LICENSE_SERVER_VERSION_OBSOLETE:
                                        alertText = string.Format(Message.FriendlyBody(alert.Name), xoClosure.Name());
                                        break;

                                    case Message.MessageType.GRACE_LICENSE:
                                        alertText = string.Empty;
                                        break;
                                    }
                                }
                            }
                        }
                    };

                    Alert.RegisterAlertCollectionChanged(alertsChangeHandler);

                    // PR-1102: catch the host's license data, before applying the new one, so it can be sent later to the licensing server
                    LicensingHelper.LicenseDataStruct previousLicenseData = new LicensingHelper.LicenseDataStruct(host);

                    if (xo is Host && host != null)
                    {
                        Host.apply_edition(host.Connection.Session, host.opaque_ref, Host.GetEditionText(_edition), false);

                        // PR-1102: populate the list of updated hosts
                        updatedHosts.Add(host, previousLicenseData);
                    }

                    if (xo is Pool)
                    {
                        Pool.apply_edition(xo.Connection.Session, pool.opaque_ref, Host.GetEditionText(_edition));

                        xo.Connection.Cache.Hosts.ToList().ForEach(h => updatedHosts.Add(h, previousLicenseData));
                    }

                    Description = Messages.APPLYLICENSE_UPDATED;
                }
                catch (Failure e)
                {
                    for (int i = 0; i < 50; i++)
                    {
                        Thread.Sleep(100);

                        lock (lck)
                        {
                            if (alertText != null)
                            {
                                break;
                            }
                        }
                    }

                    LicenseFailures.Add(new LicenseFailure(host, alertText ?? e.Message));

                    if (pool != null)
                    {
                        pool.Connection.Cache.Hosts.ToList().ForEach(h => SetLicenseServer(h, previousLicenseServerAddress, previousLicenseServerPort));
                    }
                    else
                    {
                        SetLicenseServer(host, previousLicenseServerAddress, previousLicenseServerPort);
                    }
                }
                finally
                {
                    Alert.DeregisterAlertCollectionChanged(alertsChangeHandler);
                }
            }

            // PR-1102: Send licensing data to the activation server
            if (updatedHosts.Count > 0)
            {
                LicensingHelper.SendLicenseEditionData(updatedHosts, Host.GetEditionText(_edition));
            }

            if (LicenseFailures.Count > 0)
            {
                string exceptionText = LicenseFailures.Count == 1 ? string.Format(Messages.LICENSE_ERROR_1, LicenseFailures[0].Host.Name()) : string.Format(Messages.LICENSE_ERROR_MANY, LicenseFailures.Count, new List <IXenObject>(xos).Count);

                if (DoOnLicensingFailure != null)
                {
                    DoOnLicensingFailure(LicenseFailures, exceptionText);
                }
                throw new InvalidOperationException(exceptionText);
            }
        }
 public ToolBoxCategoryCollection()
 {
     ItemChanged += new CollectionChangeEventHandler(OnToolBoxCategoryCollectionChanged);
 }
Example #50
0
 public SrPicker()
 {
     SR_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(SR_CollectionChanged);
 }