Esempio n. 1
0
        private void propertyChanged(object sender, PropertyChangedEventArgs e)
        {
            Contract.Requires(sender != null);
            Contract.Requires(e != null);
            var propertyInfo = sender.GetType().GetProperty(e.PropertyName);

            Contract.Requires(propertyInfo != null, $"No public property '{e.PropertyName}' could not be found on an instance of type '{sender.GetType().FullName}'");

            if (IncludeDeep(sender, e.PropertyName))
            {
                if (!(e is IPropertyMutatedEventArgs m))
                {
                    throw new ContractException("For view model properties that have nested viewmodels, the old value needs to be accessible (for unregistering). ");
                }
                // Alternatively, we may store the old values ourselves.
                // A potential bug (or it's more like an assumption) is this:
                // Suppose a property is mutated, but it's property changed event invocation is suspended, then it is modified again, and then the event is raised.
                // Here I'm assuming that the old value is then the original value, not the intermediate value, because I still need to unregister the original value

                if (m.OldValue != null)
                {
                    this.unregisterViewModel(m.OldValue);
                }
                if (m.NewValue != null)
                {
                    this.registerViewmodelAndAddCompleteStateAsChanges(m.NewValue);
                }
            }

            if (IncludeProperty(sender, propertyInfo))
            {
                var value = propertyInfo.GetValue(sender);
                this.AddChange(PropertyChange.Create(idProvider[sender], e.PropertyName, value));
            }
        }
Esempio n. 2
0
                public override bool Equals(object o)
                {
                    if (this == o)
                    {
                        return(true);
                    }
                    if (o == null || this.GetType() != o.GetType())
                    {
                        return(false);
                    }

                    PropertyChange that = ( PropertyChange )o;

                    if (EntityId != that.EntityId)
                    {
                        return(false);
                    }
//JAVA TO C# CONVERTER WARNING: LINQ 'SequenceEqual' is not always identical to Java AbstractList 'equals':
//ORIGINAL LINE: if (!added.equals(that.added))
                    if (!Added.SequenceEqual(that.Added))
                    {
                        return(false);
                    }
//JAVA TO C# CONVERTER WARNING: LINQ 'SequenceEqual' is not always identical to Java AbstractList 'equals':
//ORIGINAL LINE: if (!changed.equals(that.changed))
                    if (!Changed.SequenceEqual(that.Changed))
                    {
                        return(false);
                    }
                    return(Removed.Equals(that.Removed));
                }
Esempio n. 3
0
        /// <summary>
        /// Updates the check box's Checked state based on the boolean property value.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            // let the base handle everything except value change
            base.UpdateElement(change - PropertyChange.Value);
            if (property == null)
            {
                return;
            }

            bool check = property.InternalValue is bool && (bool)property.InternalValue;

            if (change.IncludesValue())
            {
                ((CheckBox)control).Checked = check;
                DataListObject list = property.GetParent() as DataListObject;
                if (list != null)
                {
                    SetControlAttribute("row", "" + list.CurrentRow);
                }
            }
            // Update property value after binding to make it in sync with the checkbox.
            // Otherwise if the checkbox stays unchecked it will not post a false value
            // and the property value will remain whatever it was, e.g. null.
            if (change == PropertyChange.All && !check)
            {
                PostedValue = "false";
            }
        }
        protected internal virtual void SetJobRetriesByJobId(string jobId, int retries, CommandContext commandContext)
        {
            JobEntity job = commandContext.JobManager.FindJobById(jobId);

            if (job != null)
            {
                foreach (var checker in commandContext.ProcessEngineConfiguration.CommandCheckers)
                {
                    checker.CheckUpdateJob(job);
                }

                if (job.InInconsistentLockState)
                {
                    job.ResetLock();
                }
                int oldRetries = job.Retries;
                job.Retries = retries;

                PropertyChange propertyChange = new PropertyChange(Retries, oldRetries, job.Retries);
                commandContext.OperationLogManager.LogJobOperation(LogEntryOperation, job.Id, job.JobDefinitionId,
                                                                   job.ProcessInstanceId, job.ProcessDefinitionId, job.ProcessDefinitionKey, propertyChange);
            }
            else
            {
                throw new ProcessEngineException("No job found with id '" + jobId + "'.");
            }
        }
Esempio n. 5
0
        public ActionResult UnAssignTicket(int Id)
        {
            var ticket = (from t in DbContext.Tickets
                          where t.Id == Id
                          select t).FirstOrDefault();
            var userid = User.Identity.GetUserId();
            var user   = GetUserById(userid);

            var newHistory = new TicketHistory();
            var propChange = new PropertyChange();

            propChange.PropertyName = nameof(ticket.AssignedDeveloper);
            propChange.OldValue     = ticket.AssignedDeveloper.Name;
            propChange.NewValue     = "none";
            newHistory.PropertyChanges.Add(propChange);
            newHistory.User     = user;
            newHistory.DateTime = DateTime.Now;
            ticket.Histories.Add(newHistory);
            SendNotification(newHistory, user, ticket);

            ticket.AssignedDeveloper   = null;
            ticket.AssignedDeveloperId = null;
            DbContext.SaveChanges();

            return(RedirectToAction(nameof(BugController.ViewTicketDetails), "Bug", new { Id = ticket.Id }));
        }
Esempio n. 6
0
        /// <summary>
        /// Updates the toggle button based on the given property change.
        /// If the property is not required the toggle button will allow three states
        /// to support an indeterminate state when the property value is not set.
        /// Otherwise turns the toggle button on or off based on the Boolean value of the property.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            base.UpdateElement(change);
            if (property == null)
            {
                return;
            }

            if (change.IncludesRequired())
            {
                ((ToggleButton)element).IsThreeState = !property.Required;
            }
            if (change.IncludesValue())
            {
                bool?  check = null;
                object val   = property.InternalValue;
                if (val is bool)
                {
                    check = (bool)val;
                }
                else
                {
                    check = val as bool?;
                }
                ((ToggleButton)element).IsChecked = check;
            }
        }
Esempio n. 7
0
        /* Function: SetShebangStrings
         * Sets the list of the shebang strings for this language.  If <AlterLanguage> is true then you must set either <PropertyChange.Add>
         * or <PropertyChange.Replace>.
         */
        public void SetShebangStrings(IList <string> shebangStrings, PropertyLocation propertyLocation,
                                      PropertyChange propertyChange = PropertyChange.None)
        {
                        #if DEBUG
            if (alterLanguage == true && propertyChange == PropertyChange.None)
            {
                throw new Exception("You must set PropertyChange when setting shebang strings on an Alter Language entry.");
            }
            if (alterLanguage == false && propertyChange != PropertyChange.None)
            {
                throw new Exception("You can't set PropertyChange when setting shebang strings on a non-Alter Language entry.");
            }
                        #endif

            if (shebangStrings == null)
            {
                this.shebangStrings = null;
            }
            else
            {
                this.shebangStrings = new List <string>(shebangStrings.Count);
                this.shebangStrings.AddRange(shebangStrings);
            }

            this.shebangStringsPropertyChange   = propertyChange;
            this.shebangStringsPropertyLocation = propertyLocation;
        }
Esempio n. 8
0
        private static Dictionary <string, PropertyData> WriteExtendedProperties(PropertyChange propertyChange, EntityChangeType changeType)
        {
            var result = new Dictionary <string, PropertyData>();

            var collectionName = propertyChange.PropertyName;
            var oldColl        = propertyChange.OldValue == null ? new Hashtable() : (IDictionary)propertyChange.OldValue;
            var newColl        = propertyChange.NewValue == null ? new Hashtable() : (IDictionary)propertyChange.NewValue;

            // obtain unique set of keys over both items
            var keys = CollectionUtils.Unique(CollectionUtils.Concat(oldColl.Keys, newColl.Keys));

            // enumerate each key
            foreach (var key in keys)
            {
                var oldValue = oldColl.Contains(key) ? oldColl[key] : null;
                var newValue = newColl.Contains(key) ? newColl[key] : null;

                // has this "property" changed?
                if (!Equals(oldValue, newValue))
                {
                    var propertyName = string.Concat(collectionName, ".", key);
                    var propertyData = WriteProperty(oldValue, newValue, changeType);
                    result.Add(propertyName, propertyData);
                }
            }
            return(result);
        }
Esempio n. 9
0
 public MetaBase(
     PropertyChange <DependencyObject, TValue> propertyChangedCallback,
     PropertyCoerce <DependencyObject, TValue> propertyCoerceCallback) : base(
         propertyChangedCallback,
         propertyCoerceCallback)
 {
 }
Esempio n. 10
0
 public MetaBase(
     TValue defaultValue,
     PropertyChange <DependencyObject, TValue> propertyChangedCallback) : base(
         defaultValue,
         propertyChangedCallback)
 {
 }
Esempio n. 11
0
 void IEventsVisitor.Visit(PropertyChange change)
 {
     message = string.Format("'{0}'->'{1}'", change.PropertyName,
                             change.ValueType == SI.ValueType.UserHash ? shortNames.AddShortNameToUserHash(change.Value) :
                             change.ValueType == SI.ValueType.Reference && currentObject.Owner.TryGetDisplayName(change.Value, out var displayName) ? displayName :
                             change.Value);
 }
Esempio n. 12
0
        public virtual object Execute(CommandContext commandContext)
        {
            var attachment =
                (AttachmentEntity)
                commandContext.AttachmentManager.FindAttachmentByTaskIdAndAttachmentId(TaskId, AttachmentId);

            EnsureUtil.EnsureNotNull(
                "No attachment exist for ITask id '" + TaskId + " and attachmentId '" + AttachmentId + "'.", "attachment",
                attachment);

            commandContext.AttachmentManager.Delete(attachment);

            if (!ReferenceEquals(attachment.ContentId, null))
            {
                commandContext.ByteArrayManager.DeleteByteArrayById(attachment.ContentId);
            }

            if (!ReferenceEquals(attachment.TaskId, null))
            {
                TaskEntity task = commandContext.TaskManager.FindTaskById(attachment.TaskId);

                PropertyChange propertyChange = new PropertyChange("name", null, attachment.Name);

                commandContext.OperationLogManager.LogAttachmentOperation(
                    UserOperationLogEntryFields.OperationTypeDeleteAttachment, task, propertyChange);
            }

            return(null);
        }
Esempio n. 13
0
 public MetaBase(
     PropertyChange <DependencyObject, TValue> propertyChangedCallback,
     FrameworkPropertyMetadataOptions optionFlags) : base(
         propertyChangedCallback)
 {
     OptionFlags = optionFlags;
 }
Esempio n. 14
0
    public void UpdateValueToDefault()
    {
        object value = PropertyChange.GetValue(selectedComponent, selectedProperty, selectedSubProperty);

        if (value.GetType() == typeof(float))
        {
            PropertyChange.SetValue(selectedComponent, selectedProperty, actionValue.GetFloat(), selectedSubProperty);
        }
        if (value.GetType() == typeof(int))
        {
            PropertyChange.SetValue(selectedComponent, selectedProperty, actionValue.GetInt(), selectedSubProperty);
        }
        if (value.GetType() == typeof(Color))
        {
            PropertyChange.SetValue(selectedComponent, selectedProperty, actionValue.GetColor(), selectedSubProperty);
        }
        if (value.GetType() == typeof(Vector2))
        {
            PropertyChange.SetValue(selectedComponent, selectedProperty, actionValue.GetVector2(), selectedSubProperty);
        }
        if (value.GetType() == typeof(Vector3))
        {
            PropertyChange.SetValue(selectedComponent, selectedProperty, actionValue.GetVector3(), selectedSubProperty);
        }
        if (value.GetType() == typeof(string))
        {
            PropertyChange.SetValue(selectedComponent, selectedProperty, actionValue.GetString(), selectedSubProperty);
        }
    }
Esempio n. 15
0
 public Meta(
     TValue defaultValue,
     PropertyChange <TOwner, TValue> propertyChangedCallback)
 {
     _defaultValue            = defaultValue;
     _propertyChangedCallback = propertyChangedCallback;
 }
 public EntityChangeEventArgument(string propName, bool isMainProperty, object previousValue, object currentValue)
 {
     Change = new PropertyChange(isMainProperty)
     {
         Property = propName, PrevisousValue = previousValue, CurrentValue = currentValue
     };
 }
Esempio n. 17
0
        private void HandleReceivedMessages(PropertyChange OnPropertyChange)
        {
            _inProgress = true;

            MessagingCenter.Subscribe <TickMessage>(this, "TickMessage", message =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    lock (_lock)
                    {
                        _time = _time.Add(new TimeSpan(0, 0, 1));

                        if (_time > RentPrice.Time)
                        {
                            CurentTime.Color = Color.Red;
                            CurentTime.Time  = $"+{(_time - RentPrice.Time):T}";
                            if (!isNotify)
                            {
                                App.DoNotify = $"У {Client.Name} закончилось время!";
                                isNotify     = true;
                            }
                        }
                        else
                        {
                            CurentTime.Color = Color.Green;
                            CurentTime.Time  = $"{(RentPrice.Time - _time):T}";
                        }
                        OnPropertyChange("Time");
                        OnPropertyChange("TimeColor");
                    }
                });
            });
        }
Esempio n. 18
0
        /// <summary>

        /// set values into the return array

        /// </summary>

        /// <param name="props">property names</param>

        /// <param name="vals">return array</param>

        /// <param name="propchg">Change received</param>

        protected void UpdateValues(string[] props, object[] vals, PropertyChange propchg)

        {
            for (int findi = 0; findi < props.Length; findi++)

            {
                if (propchg.name.LastIndexOf(props[findi]) >= 0)

                {
                    if (propchg.op == PropertyChangeOp.remove)

                    {
                        vals[findi] = "";
                    }

                    else

                    {
                        var value = propchg.val;

                        if (propchg.val is XmlNode[]) // This happens only for the ENUMs whose definitions are not there.

                        {
                            value = getValueOfUnrecognizedEnumInstance(propchg.val as XmlNode[]);
                        }

                        vals[findi] = value;
                    }
                }
            }
        }
Esempio n. 19
0
        public void StartChangeDetection(params string[] tables)
        {
            _tables = tables;
            if (filter.Length > 0)
            {
                _tables = _tables.Where(s => !s.StartsWithAny(filter)).ToArray();
            }

            SqlProperties = new PropertyChange <string> [_tables.Length];

            for (int i = 0; i < _tables.Length; i++)
            {
                SqlProperties[i] = new PropertyChange <string>("AbpSqlEvents");
                RegisterEvent(SqlProperties[i]);
            }

            new Thread(async _ =>
            {
                for (int j = 0; j < SqlProperties.Length; j++)
                {
                    await foreach (EventModel m in GetLastChange(j))
                    {
                        SqlProperties[j].Value = m.SERIALIZE();
                    }
                }
            })
            {
                IsBackground = true
            }.Start();
        protected internal override void LogUserOperation(CommandContext commandContext)
        {
            PropertyChange propertyChange = new PropertyChange(SuspensionStateProperty, null, NewSuspensionState.Name);

            commandContext.OperationLogManager.LogJobDefinitionOperation(LogEntryOperation, JobDefinitionId,
                                                                         ProcessDefinitionId, ProcessDefinitionKey, propertyChange);
        }
Esempio n. 21
0
 public Meta(
     PropertyChange <TOwner, TValue> propertyChangedCallback,
     PropertyCoerce <TOwner, TValue> propertyCoerceCallback)
 {
     _propertyChangedCallback = propertyChangedCallback;
     _coerceValueCallback     = propertyCoerceCallback;
 }
Esempio n. 22
0
        /* Function: SetFileExtensions
         * Sets the list of the file extensions for this language.  If <AlterLanguage> is true then you must set either <PropertyChange.Add>
         * or <PropertyChange.Replace>.
         */
        public void SetFileExtensions(IList <string> fileExtensions, PropertyLocation propertyLocation,
                                      PropertyChange propertyChange = PropertyChange.None)
        {
                        #if DEBUG
            if (alterLanguage == true && propertyChange == PropertyChange.None)
            {
                throw new Exception("You must set PropertyChange when setting extensions on an Alter Language entry.");
            }
            if (alterLanguage == false && propertyChange != PropertyChange.None)
            {
                throw new Exception("You can't set PropertyChange when setting extensions on a non-Alter Language entry.");
            }
                        #endif

            if (fileExtensions == null)
            {
                this.fileExtensions = null;
            }
            else
            {
                this.fileExtensions = new List <string>(fileExtensions.Count);
                this.fileExtensions.AddRange(fileExtensions);
            }

            this.fileExtensionsPropertyChange   = propertyChange;
            this.fileExtensionsPropertyLocation = propertyLocation;
        }
Esempio n. 23
0
        public virtual UserOperationLogContextEntryBuilder propertyChanges(PropertyChange propertyChange)
        {
            IList <PropertyChange> propertyChanges = new List <PropertyChange>();

            propertyChanges.Add(propertyChange);
            entry_Renamed.PropertyChanges = propertyChanges;
            return(this);
        }
Esempio n. 24
0
 public Meta(T _defaultValue = default(T),
             PropertyChange <D, T> changedCallback = null,
             PropertyCoerce <D, T> coerceCallback  = null)
 {
     DefaultValue    = _defaultValue;
     ChangedCallback = changedCallback;
     CoerceCallback  = coerceCallback;
 }
Esempio n. 25
0
        protected internal virtual void CreateOpLogEntry(CommandContext commandContext, long previousPriority,
                                                         JobEntity job)
        {
            PropertyChange propertyChange = new PropertyChange(JobPriorityProperty, previousPriority, job.Priority);

            commandContext.OperationLogManager.LogJobOperation(
                UserOperationLogEntryFields.OperationTypeSetPriority, job.Id, job.JobDefinitionId,
                job.ProcessInstanceId, job.ProcessDefinitionId, job.ProcessDefinitionKey, propertyChange);
        }
Esempio n. 26
0
        protected internal override void LogUserOperation(CommandContext commandContext)
        {
            PropertyChange propertyChange = new PropertyChange(SuspensionStateProperty, null, NewSuspensionState.Name);

            commandContext.OperationLogManager.LogProcessInstanceOperation(LogEntryOperation, ProcessInstanceId, ProcessDefinitionId, ProcessDefinitionKey, new List <PropertyChange>()
            {
                propertyChange
            });                                                                                                                                                                                            // Collections.singletonList());
        }
Esempio n. 27
0
        public override object Execute(CommandContext commandContext)
        {
            base.Execute(commandContext);

            PropertyChange propertyChange = new PropertyChange(Type, null, GroupId);

            commandContext.OperationLogManager.LogLinkOperation(UserOperationLogEntryFields.OperationTypeAddGroupLink, Task, propertyChange);
            return(null);
        }
        public void IsOrphan_one_to_many_relation_entity_true()
        {
            MockEntity     entity           = new MockEntity();
            MockEntity     relationalEntity = new MockEntity();
            string         entityPath       = ".RelationalEntities[Guid=" + relationalEntity.Guid + "]";
            PropertyChange change           = new PropertyChange(entityPath, string.Empty, string.Empty, relationalEntity, null);

            Assert.IsTrue(change.IsOrphan(entity));
        }
 public static void AddNamePropertyChange(this DiscordEmbedBuilder builder, PropertyChange <string> nChange)
 {
     if (nChange != null)
     {
         var before = nChange.Before.IsRelevant() ? nChange.Before : "Стандартное имя";
         var after  = nChange.After.IsRelevant() ? nChange.After : "Стандартное имя";
         builder.AddBeforeAfter("Имя", before, after);
     }
 }
        /// <summary>
        /// Updates the text of the text block to the property value formatted
        /// according to the property's DisplayString format.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            base.UpdateElement(change);
            if (property == null) return;

            if (change.IncludesValue())
            {
                ((TextBlock)element).Text = property.DisplayStringValue;
            }
        }
 private PropertyChangeItem(
     PropertyChange change,
     XElement left,
     XElement right)
 {
     Change = change;
     Left   = left;
     Right  = right;
     Name   = (left ?? right).Name;
 }
        /// <summary>
        /// Updates the text of the hyperlink to the property value formatted
        /// according to the property's DisplayString format.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            base.UpdateElement(change);
            if (property == null) return;

            if (change.IncludesValue())
            {
                Hyperlink lnk = (Hyperlink)element;
                lnk.Inlines.Clear();
                lnk.Inlines.Add(property.DisplayStringValue);
            }
        }
        /// <summary>
        /// Updates the text of a hyper link to the property value formatted
        /// according to the property's DisplayString format. Also updates the NavigateUrl
        /// to replace the '{value}' placeholder with the value of the data property.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            base.UpdateElement(change - PropertyChange.Value);
            if (property == null) return;

            HyperLink lnk = (HyperLink)control;
            lnk.Text = property.DisplayStringValue;
            if (lnk.NavigateUrl != null)
            {
                lnk.NavigateUrl = lnk.NavigateUrl.Replace("{value}", property.EditStringValue);
                lnk.NavigateUrl = Regex.Replace(lnk.NavigateUrl, @"\[(.*?)\]", GetPropertyValue);
            }
        }
        /// <summary>
        /// Updates the toggle button based on the given property change.
        /// If the property is not required the toggle button will allow three states
        /// to support an indeterminate state when the property value is not set.
        /// Otherwise turns the toggle button on or off based on the Boolean value of the property.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            base.UpdateElement(change);
            if (property == null) return;

            if (change.IncludesRequired())
            {
                ((ToggleButton)element).IsThreeState = !property.Required;
            }
            if (change.IncludesValue())
            {
                bool? check = null;
                object val = property.InternalValue;
                if (val is bool) check = (bool)val;
                else check = val as bool?;
                ((ToggleButton)element).IsChecked = check;
            }
        }
        /// <summary>
        /// Updates the check box's Checked state based on the boolean property value.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            // let the base handle everything except value change
            base.UpdateElement(change - PropertyChange.Value);
            if (property == null) return;

            bool check = property.InternalValue is bool && (bool)property.InternalValue;
            if (change.IncludesValue())
            {
                ((CheckBox)control).Checked = check;
                DataListObject list = property.GetParent() as DataListObject;
                if (list != null)
                    SetControlAttribute("row", "" + list.CurrentRow);
            }
            // Update property value after binding to make it in sync with the checkbox.
            // Otherwise if the checkbox stays unchecked it will not post a false value
            // and the property value will remain whatever it was, e.g. null.
            if (change == PropertyChange.All && !check)
            {
                PostedValue = "false";
            }
        }
Esempio n. 36
0
 public Property(PropertyChange change, string player)
 {
     Change = change;
     Player = player;
 }
            /// <summary>
            /// Updates the control and fills the items and selection listboxes.
            /// </summary>
            /// <param name="change">The property change.</param>
            protected override void UpdateElement(PropertyChange change)
            {
                base.UpdateElement(change);

                if (change.IncludesItems() || change.IncludesValue())
                {
                    // update selection list
                    ListBox lbxSelection = (control as BasePickListControl).lbx_Selection;
                    lbxSelection.Items.Clear();

                    IEnumerable values = property.IsMultiValued ?
                        property.InternalValue as IEnumerable :
                        new object[] { property.InternalValue };

                    if (values != null) foreach (object i in values)
                    {
                        lbxSelection.Items.Add(new ListItem(
                            property.ValueToString(i, ValueFormat.DisplayString),
                            property.ValueToString(i, ValueFormat.EditString)));
                    }

                    // update items list
                    ListBox lbxItems = (control as BasePickListControl).lbx_Items;
                    lbxItems.Items.Clear();

                    IEnumerable items = property.ItemsProvider != null ? property.ItemsProvider(null) : null;
                    if (items != null) foreach (object i in items)
                    {
                        string value = property.ValueToString(i, ValueFormat.EditString);
                        ListItem li = lbxSelection.Items.FindByValue(value);
                        if (li == null)
                        {
                            lbxItems.Items.Add(new ListItem(
                                property.ValueToString(i, ValueFormat.DisplayString),
                                value));
                        }
                    }
                }
            }
        /// <summary>
        /// Updates the text of a text control to the property value formatted
        /// according to the property's EditString format if editable or DisplayString if not editable.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            base.UpdateElement(change);
            if (property == null) return;

            ITextControl txtCtl = control as ITextControl;
            if (change.IncludesValue() && txtCtl != null)
            {
                txtCtl.Text = control is IEditableTextControl && property.Editable ?
                    property.EditStringValue : property.DisplayStringValue;
            }
        }
Esempio n. 39
0
        public void handleElementDeletion(Repository repository, int elementID)
        {
            try
            {
                changed = false;
                EA.Element element = repository.GetElementByID(elementID);

                PropertyChange modelChange = new PropertyChange();
                modelChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                modelChange.itemGUID = element.ElementGUID;
                modelChange.elementType = itemTypes.getElementType(element.ElementGUID); ;
                modelChange.elementDeleted = 1;

                changeService.saveChange(modelChange);

                if (element.Type == "UseCase")
                {
                    currentExtensionPoints.Remove(element.ElementGUID);
                }
            }
            catch (Exception ex) { }
        }
Esempio n. 40
0
        public void handleUseCaseChanges(string GUID, EA.Element changedElement)
        {
            if (changedElement.Type != "UseCase")
            {
                return;
            }

            // CONSTRAINTS
            EA.Collection changedConstraints = changedElement.Constraints;
            List<ConstraintWrapper> changedConstraintsList = new List<ConstraintWrapper>();

            foreach (EA.Constraint constraint in changedConstraints)
            {
                changedConstraintsList.Add(new ConstraintWrapper(constraint));
            }

            if (!((changedConstraintsList.Count == currentConstraintsList.Count)
                && !changedConstraintsList.Except(currentConstraintsList).Any()))
            {
                List<ConstraintWrapper> createdConstraints = changedConstraintsList.Except(currentConstraintsList).ToList();
                List<ConstraintWrapper> removedConstraints = currentConstraintsList.Except(changedConstraintsList).ToList();

                foreach (ConstraintWrapper constraintWrapper in removedConstraints)
                {
                    PropertyChange propertyChange = new PropertyChange();
                    propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                    propertyChange.itemGUID = GUID;
                    propertyChange.elementType = itemTypes.getElementType(GUID);
                    propertyChange.propertyType = 11;
                    propertyChange.propertyBody = constraintWrapper.constraint.Name;
                    propertyChange.oldPropertyBody = constraintWrapper.constraint.Type;
                    propertyChange.elementDeleted = 1;

                    changeService.saveChange(propertyChange);
                }

                foreach (ConstraintWrapper constraintWrapper in createdConstraints)
                {
                    PropertyChange propertyChange = new PropertyChange();
                    propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                    propertyChange.itemGUID = GUID;
                    propertyChange.elementType = itemTypes.getElementType(GUID);
                    propertyChange.propertyType = 10;
                    propertyChange.propertyBody = constraintWrapper.constraint.Name + ",notes:=" + constraintWrapper.constraint.Notes;
                    propertyChange.oldPropertyBody = constraintWrapper.constraint.Type;

                    changeService.saveChange(propertyChange);
                }
            }

            // SCENARIO
            EA.Collection changedScenarios = changedElement.Scenarios;
            List<ScenarioWrapper> changedScenariosList = new List<ScenarioWrapper>();

            foreach (EA.Scenario scenario in changedScenarios)
            {
                changedScenariosList.Add(new ScenarioWrapper(scenario));
            }

            Dictionary<string, ScenarioWrapper> changedDict = new Dictionary<string, ScenarioWrapper>();
            foreach (ScenarioWrapper wrapper in changedScenariosList)
            {
                if (!changedDict.ContainsKey(wrapper.getGUID()))
                {
                    changedDict.Add(wrapper.getGUID(), wrapper);
                }
            }

            Dictionary<string, ScenarioWrapper> currentDict = new Dictionary<string, ScenarioWrapper>();
            foreach (ScenarioWrapper wrapper in currentScenarioList)
            {
                if (!currentDict.ContainsKey(wrapper.getGUID()))
                {
                    currentDict.Add(wrapper.getGUID(), wrapper);
                }
            }

            if (!((changedScenariosList.Count == currentScenarioList.Count)
                && !changedScenariosList.Except(currentScenarioList).Any()))
            {
                // scenario delete
                foreach (KeyValuePair<string, ScenarioWrapper> scenario in currentDict)
                {
                    if (!changedDict.ContainsKey(scenario.Key))
                    {
                        EA.Scenario eaScenario = scenario.Value.scenario;
                        StepChange scenarioChange = new StepChange();
                        scenarioChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                        scenarioChange.itemGUID = GUID;
                        scenarioChange.elementType = itemTypes.getElementType(GUID);
                        scenarioChange.status = 0;
                        scenarioChange.scenarioGUID = eaScenario.ScenarioGUID;

                        changeService.saveChange(scenarioChange);
                    }
                }

                // scenario add
                foreach (KeyValuePair<string, ScenarioWrapper> scenario in changedDict)
                {
                    if (!currentDict.ContainsKey(scenario.Key))
                    {
                        // pridaj scenar
                        EA.Scenario eaScenario = scenario.Value.scenario;
                        StepChange scenarioChange = new StepChange();
                        scenarioChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                        scenarioChange.itemGUID = GUID;
                        scenarioChange.elementType = itemTypes.getElementType(GUID);
                        scenarioChange.name = eaScenario.Name;
                        scenarioChange.stepType = eaScenario.Type;
                        scenarioChange.status = 1;
                        scenarioChange.scenarioGUID = eaScenario.ScenarioGUID;
                        scenarioChange.state = eaScenario.XMLContent;

                        changeService.saveChange(scenarioChange);
                    }
                    else
                    {
                        try
                        {
                            // zisti zmeny v scenari
                            EA.Scenario eaChangedScenario = scenario.Value.scenario;
                            EA.Scenario eaCurrentScenario = currentDict[scenario.Key].scenario;
                            bool wasChanged = false;

                            StepChange changedScenario = new StepChange();
                            changedScenario.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                            changedScenario.itemGUID = GUID;
                            changedScenario.elementType = itemTypes.getElementType(GUID);
                            changedScenario.status = 2;
                            changedScenario.scenarioGUID = eaChangedScenario.ScenarioGUID;
                            changedScenario.name = eaChangedScenario.Name;
                            changedScenario.stepType = eaChangedScenario.Type;
                            changedScenario.state = eaChangedScenario.XMLContent;

                            if (eaChangedScenario.Name != eaCurrentScenario.Name)
                            {
                                wasChanged = true;
                                changedScenario.name = eaChangedScenario.Name;
                            }

                            if (eaChangedScenario.Type != eaCurrentScenario.Type)
                            {
                                wasChanged = true;
                                changedScenario.stepType = eaChangedScenario.Type;
                            }

                            if (eaChangedScenario.XMLContent != eaCurrentScenario.XMLContent)
                            {
                                wasChanged = true;
                                changedScenario.state = eaChangedScenario.XMLContent;
                            }

                            if (wasChanged)
                            {
                                changeService.saveChange(changedScenario);
                            }
                        }
                        catch (Exception ex) { }
                    }
                }
            }

            // EXTENSION POINTS
            if (!currentItem.ExtensionPoints.Equals(changedElement.ExtensionPoints))
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getElementType(GUID);
                propertyChange.propertyType = 13;
                propertyChange.propertyBody = changedElement.ExtensionPoints;
                propertyChange.oldPropertyBody = currentItem.ExtensionPoints;

                changeService.saveChange(propertyChange);
            }
        }
Esempio n. 41
0
        public void handleDiagramChange(string GUID)
        {
            EA.Diagram changedDiagram = (EA.Diagram)model.getWrappedModel().GetDiagramByGuid(GUID);
            EA.Diagram changedPositionDiagram = (EA.Diagram)model.getWrappedModel().GetDiagramByGuid(currentDiagram.DiagramGUID);

            if ((currentDiagram.PackageID != changedDiagram.PackageID) || (currentDiagram.ParentID != changedDiagram.ParentID) ||
                (currentParent != changedDiagram.ParentID.ToString()))
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.elementType = 0;

                EA.Package targetPackage = model.getWrappedModel().GetPackageByID(changedDiagram.PackageID);

                if (changedDiagram.ParentID != 0)
                {
                    EA.Element targetElement = model.getWrappedModel().GetElementByID(changedDiagram.ParentID);
                    propertyChange.itemGUID = changedDiagram.DiagramGUID;
                    propertyChange.propertyType = 403;
                    propertyChange.propertyBody = targetElement.ElementGUID;
                }
                else
                {
                    propertyChange.itemGUID = changedDiagram.DiagramGUID;
                    propertyChange.propertyType = 404;
                    propertyChange.propertyBody = targetPackage.PackageGUID;
                }

                changeService.saveChange(propertyChange);
            }

            // check name
            if (currentDiagram.Name != changedDiagram.Name)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getDiagramType(GUID);
                propertyChange.propertyType = 0;
                propertyChange.propertyBody = changedDiagram.Name;
                propertyChange.oldPropertyBody = currentDiagram.Name;

                changeService.saveChange(propertyChange);
            }

            // check author
            if (currentAuthor != changedDiagram.Author)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getDiagramType(GUID);
                propertyChange.propertyType = 1;
                propertyChange.propertyBody = changedDiagram.Author;
                propertyChange.oldPropertyBody = currentAuthor;

                changeService.saveChange(propertyChange);
            }

            // check stereotype
            string changedDiagStereotype = changedDiagram.Stereotype;
            string currentDiagStereotype = currentDiagram.Stereotype;

            if (changedDiagStereotype != currentDiagStereotype)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getDiagramType(GUID);
                propertyChange.propertyType = 200;
                propertyChange.propertyBody = changedDiagStereotype;
                propertyChange.oldPropertyBody = currentDiagStereotype;

                changeService.saveChange(propertyChange);
            }

            // check notes
            if (changedDiagram.Notes != currentDiagram.Notes)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getDiagramType(GUID);
                propertyChange.propertyType = 2;
                propertyChange.propertyBody = changedDiagram.Notes;
                propertyChange.oldPropertyBody = currentDiagram.Notes;

                changeService.saveChange(propertyChange);
            }

            currentDiagram = changedDiagram;
        }
Esempio n. 42
0
        public void handleDiagramDeletion(Repository repository, int diagramID)
        {
            try
            {
                changed = false;
                EA.Diagram diagram = repository.GetDiagramByID(diagramID);

                PropertyChange modelChange = new PropertyChange();
                modelChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                modelChange.itemGUID = diagram.DiagramGUID;
                modelChange.elementType = itemTypes.getDiagramType(diagram.DiagramGUID); ;
                modelChange.elementDeleted = 1;

                changeService.saveChange(modelChange);
            }
            catch (Exception ex) { }
        }
Esempio n. 43
0
        public void handleDiagramObjectDeletion(Repository repository, int elementID)
        {
            try
            {
                changed = false;

                EA.Element element = repository.GetElementByID(elementID);
                EA.Diagram diagram = repository.GetCurrentDiagram();

                PropertyChange modelChange = new PropertyChange();
                modelChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                modelChange.itemGUID = element.ElementGUID;
                modelChange.propertyBody = diagram.DiagramGUID;
                modelChange.elementType = 700;
                modelChange.elementDeleted = 1;

                changeService.saveChange(modelChange);

                currentDiagramObjectPositions.Remove(element.ElementID);
            }
            catch (Exception ex) { }
        }
Esempio n. 44
0
        public void handleElementChange(string GUID)
        {
            EA.Element changedElement = model.getWrappedModel().GetElementByGuid(GUID);
            EA.Element changedPositionElement = model.getWrappedModel().GetElementByGuid(currentItem.ElementGUID);

            //check move
            if ((currentItem.PackageID != changedPositionElement.PackageID) || (currentItem.ParentID != changedPositionElement.ParentID))
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.elementType = 0;

                if (changedPositionElement.ParentID == 0)
                {
                    EA.Package targetPackage = model.getWrappedModel().GetPackageByID(changedPositionElement.PackageID);
                    propertyChange.itemGUID = changedPositionElement.ElementGUID;
                    propertyChange.elementType = itemTypes.getElementType(changedPositionElement.ElementGUID);
                    propertyChange.propertyType = 401;
                    propertyChange.propertyBody = targetPackage.PackageGUID;
                }
                else
                {
                    EA.Element targetElement = model.getWrappedModel().GetElementByID(changedPositionElement.ParentID);
                    propertyChange.itemGUID = changedPositionElement.ElementGUID;
                    propertyChange.propertyType = 402;
                    propertyChange.propertyBody = targetElement.ElementGUID;
                }

                changeService.saveChange(propertyChange);
                return;
            }

            // check name
            if (currentItem.Name != changedElement.Name)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getElementType(GUID);
                propertyChange.propertyType = 0;
                propertyChange.propertyBody = changedElement.Name;
                propertyChange.oldPropertyBody = currentItem.Name;

                changeService.saveChange(propertyChange);
            }

            // check author
            if (currentItem.Author != changedElement.Author)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getElementType(GUID);
                propertyChange.propertyType = 1;
                propertyChange.propertyBody = changedElement.Author;
                propertyChange.oldPropertyBody = currentItem.Author;

                changeService.saveChange(propertyChange);
            }

            // check stereotype
            string changedElemStereotype = changedElement.Stereotype;
            string currentElemStereotype = currentItem.Stereotype;

            if (changedElemStereotype != currentElemStereotype)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getElementType(GUID);
                propertyChange.propertyType = 200;
                propertyChange.propertyBody = changedElemStereotype;
                propertyChange.oldPropertyBody = currentElemStereotype;

                changeService.saveChange(propertyChange);
            }

            // check notes
            if (currentItem.Notes != changedElement.Notes)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getElementType(GUID);
                propertyChange.propertyType = 2;
                propertyChange.propertyBody = changedElement.Notes;
                propertyChange.oldPropertyBody = currentItem.Notes;

                changeService.saveChange(propertyChange);
            }

            // check subtype
            if (currentItem.Subtype != changedElement.Subtype)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getElementType(GUID);
                propertyChange.propertyType = 3;
                propertyChange.propertyBody = changedElement.Subtype.ToString();
                propertyChange.oldPropertyBody = currentItem.Subtype.ToString();

                changeService.saveChange(propertyChange);
            }

            try
            {
                handleUseCaseChanges(GUID, changedElement);
            }
            catch (Exception ex) { }

            currentItem = changedElement;
        }
Esempio n. 45
0
 private static void NullChanged(PropertyChange type, string player)
 {
 }
Esempio n. 46
0
        private void checkPropertyChange(PropertyChange propertyChange, string expectedName, object value)
        {
            Assert.AreEqual(expectedName, propertyChange.PropertyName);
            Assert.AreEqual(toString(value), propertyChange.Value);

            if (value is int)
                Assert.AreEqual(value, propertyChange.ValueAsInt);
            else
                Assert.Null(propertyChange.ValueAsInt);
        }
Esempio n. 47
0
 /// <summary>
 /// method handles item changes during synchronization
 /// </summary>
 /// <param name="propertyChange">instance of property change carrying information about item change</param>
 /// <param name="repository">EA repository</param>
 public void handleSynchronizationChanges(PropertyChange propertyChange, EA.Repository repository)
 {
     switch (propertyChange.propertyType)
     {
         case 0:                                                                 //zmena mena
             if (propertyChange.elementType == 3)
             {
                 synchronizationChanges.changePackageName(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody);
             }
             else if (propertyChange.elementType < 50)
             {
                 synchronizationChanges.changeElementName(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             }
             else if (propertyChange.elementType >= 50 && propertyChange.elementType < 70)
             {
                 synchronizationChanges.changeDiagramName(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             }
             else if (propertyChange.elementType >= 70 && propertyChange.elementType <= 79)
             {
                 synchronizationChanges.changeConnectorName(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             }
             else if (propertyChange.elementType == 90)
             {
                 synchronizationChanges.changeAttributeName(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody);
             }
             break;
         case 1:                                                                 //zmena autora
             if (propertyChange.elementType == 3)
             {
                 synchronizationChanges.changePackageAuthor(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody);
             }
             else if (propertyChange.elementType >= 50 && propertyChange.elementType < 70)
             {
                 synchronizationChanges.changeDiagramAuthor(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             }
             else if (propertyChange.elementType < 50)
             {
                 synchronizationChanges.changeElementAuthor(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             }
             break;
         case 2:                                                                 //zmena poznamok
             if (propertyChange.elementType == 3)
             {
                 synchronizationChanges.changePackageNotes(repository, propertyChange.itemGUID, propertyChange.propertyBody);
             }
             else if (propertyChange.elementType < 50)
             {
                 synchronizationChanges.changeElementNotes(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.elementType);
             }
             else if (propertyChange.elementType >= 50 && propertyChange.elementType < 70)
             {
                 synchronizationChanges.changeDiagramNotes(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.elementType);
             }
             else if (propertyChange.elementType >= 70 && propertyChange.elementType <= 79)
             {
                 synchronizationChanges.changeConnectorNotes(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.elementType);
             }
             break;
         case 13:                                                                 //zmena bodov rozsirenia
             synchronizationChanges.setExtensionPoints(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.elementType);
             break;
         case 200:                                                               //zmena stereotypu
             if (propertyChange.elementType < 50)
             {
                 synchronizationChanges.changeElementStereotype(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             }
             else if (propertyChange.elementType >= 50 && propertyChange.elementType < 70)
             {
                 synchronizationChanges.changeDiagramStereotype(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             }
             else if (propertyChange.elementType >= 70 && propertyChange.elementType <= 79)
             {
                 synchronizationChanges.changeConnectorStereotype(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             }
             break;
         case 300:                                                                  //zmena scope atributu
             synchronizationChanges.changeAttributeVisibility(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody);
             break;
         case 301:                                                                   //zmena cieloveho elementu spojenia
             synchronizationChanges.changeConnectorTarget(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             break;
         case 302:                                                                   //zmena zdrojoveho elementu spojenia
             synchronizationChanges.changeConnectorSource(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             break;
         case 303:                                                                   //zmena kardinality zdroja spojenia
             synchronizationChanges.changeConnectorSourceCardinality(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             break;
         case 304:                                                                   //zmena kardinality ciela spojenia
             synchronizationChanges.changeConnectorTargetCardinality(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             break;
         case 305:                                                                   //zmena guard spojenia
             synchronizationChanges.changeConnectorGuard(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             break;
         case 307:                                                                   //zmena smeru spojenia
             synchronizationChanges.changeConnectorDirection(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             break;
         case 10:                                                                   //pridanie obmedzenia
             synchronizationChanges.addConstraint(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody, propertyChange.elementType);
             break;
         case 401:                                                                   //presun elementu alebo balika do balika
             synchronizationMovements.moveElementOrPackageToPackage(repository, propertyChange.itemGUID, propertyChange.propertyBody,
             propertyChange.elementType);
             break;
         case 402:                                                                   //presun elementu do elementu
             synchronizationMovements.moveElementToElement(repository, propertyChange.itemGUID, propertyChange.propertyBody);
             break;
         case 403:                                                                   //zmena diagramu do elementu
             synchronizationMovements.moveDiagramToElement(repository, propertyChange.itemGUID, propertyChange.propertyBody);
             break;
         case 404:                                                                   //zmena diagramu do balika
             synchronizationMovements.moveDiagramToPackage(repository, propertyChange.itemGUID, propertyChange.propertyBody);
             break;
         case 405:                                                                   //zmena suradnic elementu v diagrame
             synchronizationMovements.moveElementInDiagram(repository, propertyChange.itemGUID, propertyChange.oldPropertyBody,
                 propertyChange.propertyBody);
             break;
     }
 }
Esempio n. 48
0
		/// <summary>
		/// Returns a new <see cref="PropertyChange"/> that is the result of adding this change
		/// to <paramref name="previousChange"/>.
		/// </summary>
		/// <param name="previousChange"></param>
		/// <returns></returns>
		/// <remarks>
		/// This operation is not commutative.
		/// </remarks>
		public PropertyChange AddTo(PropertyChange previousChange)
		{
			return new PropertyChange(PropertyName, IsCollection, previousChange.OldValue, NewValue);
		}
Esempio n. 49
0
        public void handleAttributeChange(string GUID)
        {
            EA.Element changedElement = model.getWrappedModel().GetElementByGuid(GUID);

            foreach (EA.Attribute attr in changedElement.Attributes)
            {
                EA.Attribute currentAttribute = currentAttributes[attr.AttributeGUID];

                // check name
                if (currentAttribute.Name != attr.Name)
                {
                    PropertyChange propertyChange = new PropertyChange();
                    propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                    propertyChange.itemGUID = attr.AttributeGUID;
                    propertyChange.elementType = 90;
                    propertyChange.propertyType = 0;
                    propertyChange.propertyBody = attr.Name;
                    propertyChange.oldPropertyBody = currentAttribute.Name;

                    changeService.saveChange(propertyChange);
                    currentAttributes[attr.AttributeGUID].Name = attr.Name;
                }

                // check scope
                if (currentAttribute.Visibility != attr.Visibility)
                {
                    PropertyChange propertyChange = new PropertyChange();
                    propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                    propertyChange.itemGUID = attr.AttributeGUID;
                    propertyChange.elementType = 90;
                    propertyChange.propertyType = 300;
                    propertyChange.propertyBody = attr.Visibility;
                    propertyChange.oldPropertyBody = currentAttribute.Visibility;

                    changeService.saveChange(propertyChange);
                    currentAttributes[attr.AttributeGUID].Visibility = attr.Visibility;
                }

                // check notes
                if (currentAttribute.Notes != attr.Notes)
                {
                    PropertyChange propertyChange = new PropertyChange();
                    propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                    propertyChange.itemGUID = attr.AttributeGUID;
                    propertyChange.elementType = 90;
                    propertyChange.propertyType = 2;
                    propertyChange.propertyBody = attr.Notes;
                    propertyChange.oldPropertyBody = currentAttribute.Notes;

                    changeService.saveChange(propertyChange);
                    currentAttributes[attr.AttributeGUID].Visibility = attr.Visibility;
                }
            }
        }
Esempio n. 50
0
        public void handleConnectorDeletion(Repository repository, int connectorID)
        {
            try
            {
                changed = false;
                EA.Connector connector = repository.GetConnectorByID(connectorID);
                EA.Element sourceElement = (EA.Element)repository.GetElementByID(connector.ClientID);

                PropertyChange modelChange = new PropertyChange();
                modelChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                modelChange.itemGUID = connector.ConnectorGUID;
                modelChange.elementType = itemTypes.getConnectorType(connector.ConnectorGUID);
                modelChange.elementDeleted = 1;
                changeService.saveChange(modelChange);
            }
            catch (Exception ex) { }
        }
Esempio n. 51
0
        public void handlePackageDeletion(Repository repository, int packageID)
        {
            try
            {
                changed = false;
                EA.Package package = repository.GetPackageByID(packageID);

                PropertyChange modelChange = new PropertyChange();
                modelChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                modelChange.itemGUID = package.PackageGUID;
                modelChange.elementType = 3;
                modelChange.elementDeleted = 1;

                changeService.saveChange(modelChange);
            }
            catch (Exception ex) { }
        }
Esempio n. 52
0
        public void handleConnectorChange(string GUID)
        {
            EA.Connector changedConnector = model.getWrappedModel().GetConnectorByGuid(GUID);

            // check name
            if (currentConnector.Name != changedConnector.Name)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 0;
                propertyChange.propertyBody = changedConnector.Name;
                propertyChange.oldPropertyBody = currentConnector.Name;

                changeService.saveChange(propertyChange);
            }

            // check stereotype
            if (changedConnector.Stereotype != currentConnector.Stereotype)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 200;
                propertyChange.propertyBody = changedConnector.Stereotype;
                propertyChange.oldPropertyBody = currentConnector.Stereotype;

                changeService.saveChange(propertyChange);
            }

            // check notes
            if (changedConnector.Notes != currentConnector.Notes)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 2;
                propertyChange.propertyBody = changedConnector.Notes;
                propertyChange.oldPropertyBody = currentConnector.Notes;

                changeService.saveChange(propertyChange);
            }

            // check target
            if (changedConnector.SupplierID != currentConnector.SupplierID)
            {
                string changedSupplierGUID = model.getWrappedModel().GetElementByID(changedConnector.SupplierID).ElementGUID;
                string currentSupplierGUID = model.getWrappedModel().GetElementByID(currentConnector.SupplierID).ElementGUID;

                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 301;
                propertyChange.propertyBody = changedSupplierGUID;
                propertyChange.oldPropertyBody = currentSupplierGUID;

                changeService.saveChange(propertyChange);
            }

            // check source
            if (changedConnector.ClientID != currentConnector.ClientID)
            {
                string changedClientGUID = model.getWrappedModel().GetElementByID(changedConnector.ClientID).ElementGUID;
                string currentClientGUID = model.getWrappedModel().GetElementByID(currentConnector.ClientID).ElementGUID;

                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 302;
                propertyChange.propertyBody = changedClientGUID;
                propertyChange.oldPropertyBody = currentClientGUID;

                changeService.saveChange(propertyChange);
            }

            // check source cardinality
            if (changedConnector.ClientEnd.Cardinality != currentConnector.ClientEnd.Cardinality)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 303;
                propertyChange.propertyBody = changedConnector.ClientEnd.Cardinality;
                propertyChange.oldPropertyBody = currentConnector.ClientEnd.Cardinality;

                changeService.saveChange(propertyChange);
            }

            // check target cardinality
            if (changedConnector.SupplierEnd.Cardinality != currentConnector.SupplierEnd.Cardinality)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 304;
                propertyChange.propertyBody = changedConnector.SupplierEnd.Cardinality;
                propertyChange.oldPropertyBody = currentConnector.SupplierEnd.Cardinality;

                changeService.saveChange(propertyChange);
            }

            // check guard
            if (changedConnector.TransitionGuard != currentConnector.TransitionGuard)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 305;
                propertyChange.propertyBody = changedConnector.TransitionGuard;
                propertyChange.oldPropertyBody = currentConnector.TransitionGuard;

                changeService.saveChange(propertyChange);
            }

            // check action
            if (changedConnector.TransitionAction != currentConnector.TransitionAction)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 306;
                propertyChange.propertyBody = changedConnector.TransitionAction;
                propertyChange.oldPropertyBody = currentConnector.TransitionAction;

                changeService.saveChange(propertyChange);
            }

            // check direction
            if (changedConnector.Direction != currentConnector.Direction)
            {
                PropertyChange propertyChange = new PropertyChange();
                propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                propertyChange.itemGUID = GUID;
                propertyChange.elementType = itemTypes.getConnectorType(GUID);
                propertyChange.propertyType = 307;
                propertyChange.propertyBody = changedConnector.Direction;
                propertyChange.oldPropertyBody = currentConnector.Direction;

                changeService.saveChange(propertyChange);
            }

            currentConnector = changedConnector;
        }
        /// <summary>
        /// Updates the list control based on the given property change.
        /// Updates the list of possible items based on the values provided by the property
        /// and inserts a blank item for a drop down list if the property is editable and not required.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            // let the base handle everything except value change
            base.UpdateElement(change - PropertyChange.Value);
            ListControl list = control as ListControl;

            if (property == null || list == null) return;

            object val = property.InternalValue;
            IList lst = val == null ? new ArrayList() : val as IList;
            ListBox lb = control as ListBox;
            bool isMultiVal = lst != null && (control is CheckBoxList
                || lb != null && lb.SelectionMode == ListSelectionMode.Multiple);
            DropDownList dl = control as DropDownList;

            if (change.IncludesItems() // if items list changed,
                || isMultiVal && change.IncludesEditable() // or control shows all items and Editable changed,
                || dl != null && change.IncludesRequired() // or control is DropDownList and Required changed,
                || change.IncludesValue()) // or property value changed
            {
                // get the list of items to show
                IEnumerable src = null;
                if (isMultiVal && !property.Editable) src = lst;
                else if (property.ItemsProvider != null) src = property.ItemsProvider(null);

                list.Items.Clear(); // clear control's item collection

                // for DropDownList, add special items in case when not Required or Required and has no value
                if (dl != null && !property.Required)
                    list.Items.Add(new ListItem("", property.NullString));
                if (dl != null && property.Required && property.IsNull())
                    list.Items.Add(new ListItem("Select Value...", ""));
                int insertionPoint = list.Items.Count;

                // add items to show
                if (src != null)
                {
                    foreach (object i in src)
                    {
                        ListItem li = new ListItem(property.ValueToString(i, ValueFormat.DisplayString),
                            property.ValueToString(i, ValueFormat.EditString));
                        list.Items.Add(li);
                        li.Selected = src == lst; // if items are values, mark them as selected
                    }
                }

                // if not showing only values, make sure the values are present in the list and mark them as selected
                if (src != lst)
                {
                    IEnumerable values = isMultiVal ? lst : new object[] { (lst != null && lst.Count > 0) ? lst[0] : property.InternalValue };
                    foreach (object i in values)
                    {
                        ListItem li = list.Items.FindByValue(property.ValueToString(i, ValueFormat.EditString));
                        if (li == null) // add values not in list
                        {
                            li = new ListItem(property.ValueToString(i, ValueFormat.DisplayString),
                                property.ValueToString(i, ValueFormat.EditString));
                            li.Attributes["disabled"] = "disabled"; ; // disable items not included in the list of expected values
                            list.Items.Insert(insertionPoint++, li); // insert them after special items and before expected values
                        }
                        li.Selected = true;
                    }
                }
            }
        }
Esempio n. 54
0
        public void handleChange(EA.Repository repository, string GUID, EA.ObjectType ot)
        {
            // check extension pointy
            if (ot == ObjectType.otDiagram)
            {
                try
                {
                    EA.Diagram changedDiagram = (EA.Diagram)model.getWrappedModel().GetDiagramByGuid(GUID);
                    foreach (EA.DiagramObject diagramObject in changedDiagram.DiagramObjects)
                    {
                        string coordinates = "";
                        coordinates += "l=" + diagramObject.left + ";";
                        coordinates += "r=" + diagramObject.right + ";";
                        coordinates += "t=" + diagramObject.top + ";";
                        coordinates += "b=" + diagramObject.bottom + ";";

                        if (currentDiagramObjectPositions[diagramObject.ElementID] != coordinates)
                        {
                            EA.Element element = model.getWrappedModel().GetElementByID(diagramObject.ElementID);

                            PropertyChange propertyChange = new PropertyChange();
                            propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                            propertyChange.itemGUID = element.ElementGUID;
                            propertyChange.elementType = itemTypes.getElementType(element.ElementGUID);
                            propertyChange.propertyType = 405;
                            propertyChange.propertyBody = coordinates;
                            propertyChange.oldPropertyBody = GUID;

                            changeService.saveChange(propertyChange);

                            currentDiagramObjectPositions[diagramObject.ElementID] = coordinates;
                        }
                    }
                }
                catch (Exception ex) { }

                try
                {
                    EA.Diagram changedDiagram = (EA.Diagram)model.getWrappedModel().GetDiagramByGuid(GUID);
                    if (changedDiagram.Type == "Use Case")
                    {
                        Dictionary<string, string> updatedExtensionPoints = new Dictionary<string, string>();

                        foreach (EA.DiagramObject diagramObjects in changedDiagram.DiagramObjects)
                        {
                            EA.Element element = (EA.Element)repository.GetElementByID(diagramObjects.ElementID);
                            if (element.Type == "UseCase")
                            {
                                if (!currentExtensionPoints.ContainsKey(element.ElementGUID))
                                {
                                    PropertyChange propertyChange = new PropertyChange();
                                    propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                                    propertyChange.itemGUID = element.ElementGUID;
                                    propertyChange.elementType = itemTypes.getElementType(element.ElementGUID);
                                    propertyChange.propertyType = 13;
                                    propertyChange.propertyBody = element.ExtensionPoints;
                                    propertyChange.oldPropertyBody = "";

                                    changeService.saveChange(propertyChange);
                                    updatedExtensionPoints.Add(element.ElementGUID, element.ExtensionPoints);
                                    currentExtensionPoints.Add(element.ElementGUID, element.ExtensionPoints);
                                }
                                else if (currentExtensionPoints[element.ElementGUID] != element.ExtensionPoints)
                                {
                                    PropertyChange propertyChange = new PropertyChange();
                                    propertyChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                                    propertyChange.itemGUID = element.ElementGUID;
                                    propertyChange.elementType = itemTypes.getElementType(element.ElementGUID);
                                    propertyChange.propertyType = 13;
                                    propertyChange.propertyBody = element.ExtensionPoints;
                                    propertyChange.oldPropertyBody = currentExtensionPoints[element.ElementGUID];

                                    changeService.saveChange(propertyChange);
                                    updatedExtensionPoints.Add(element.ElementGUID, element.ExtensionPoints);
                                    currentExtensionPoints[element.ElementGUID] = element.ExtensionPoints;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex) { }

            }

            if (GUID != null && changed == false && currentItem != null)
            {
                try
                {
                    handleAttributeChange(GUID);
                    handleElementChange(GUID);
                }
                catch (NullReferenceException ex2) { }
                catch (Exception ex) { }
            }

            if (GUID != null && changed == false && currentDiagram != null)
            {
                try
                {
                    handleDiagramChange(GUID);
                }
                catch (NullReferenceException ex2) { }
                catch (Exception ex) { }
            }

            if (GUID != null && changed == false && currentConnector != null)
            {
                try
                {
                    handleConnectorChange(GUID);
                }
                catch (NullReferenceException ex2) { }
                catch (Exception ex) { }
            }
        }
Esempio n. 55
0
        public void handleAttributeDeletion(Repository repository, int attributeID)
        {
            try
            {
                changed = false;
                EA.Attribute attribute = repository.GetAttributeByID(attributeID);

                PropertyChange modelChange = new PropertyChange();
                modelChange.modelGUID = model.getWrappedModel().GetPackageByID(1).PackageGUID;
                modelChange.itemGUID = attribute.AttributeGUID;
                modelChange.elementType = 90;
                modelChange.elementDeleted = 1;

                changeService.saveChange(modelChange);

                currentAttributes.Remove(attribute.AttributeGUID);
            }
            catch (Exception ex) { }
        }
Esempio n. 56
0
 private void PropertyChanged(PropertyChange type, string player)
 {
     lock (_changes)
     {
         Now++;
         //remove overrides
         foreach (var i in _changes.Where((id, prop) => prop.Equals(type)).Select((id, prop) => id))
             _changes.Remove(i);
         _changes[Now] = new Property(type, player);
         Monitor.PulseAll(_changes);
     }
 }
Esempio n. 57
0
 /// <summary>
 /// set values into the return array
 /// </summary>
 /// <param name="props">property names</param>
 /// <param name="vals">return array</param>
 /// <param name="propchg">Change received</param>
 protected void UpdateValues(string[] props, object[] vals, PropertyChange propchg)
 {
     for (int findi = 0; findi < props.Length; findi++)
     {
         if (propchg.name.LastIndexOf(props[findi]) >= 0)
         {
             if (propchg.op == PropertyChangeOp.remove)
             {
                 vals[findi] = "";
             }
             else
             {
                 var value = propchg.val;
                 if (propchg.val is XmlNode[]) // This happens only for the ENUMs whose definitions are not there.
                 {
                     value = getValueOfUnrecognizedEnumInstance(propchg.val as XmlNode[]);
                 }
                 vals[findi] = value;
             }
         }
     }
 }
        /// <summary>
        /// Updates the selector based on the given property change.
        /// Updates the list of possible items based on the values provided by the property
        /// and inserts a blank item for a combo box if the property is editable and not required.
        /// </summary>
        /// <param name="change">The property change.</param>
        protected override void UpdateElement(PropertyChange change)
        {
            base.UpdateElement(change);
            Selector sel = element as Selector;

            if (property == null || sel == null) return;

            object val = property.InternalValue;
            IList lst = val as IList;
            ListBox lb = element as ListBox;
            ComboBox cb = element as ComboBox;

            if (change.IncludesItems() ||
                lb != null && change.IncludesEditable() ||
                cb != null && change.IncludesRequired())
            {
                sel.Items.Clear();
                IEnumerable src = null;
                if (lb != null && !property.Editable && lst != null) src = lst;
                else if (property.ItemsProvider != null) src = property.ItemsProvider(null);

                // for non-required drop down lists add null string option
                if (cb != null && !cb.IsEditable && !property.Required)
                    sel.Items.Add(property.NullString);

                // add items explicitly. Don't use sel.ItemSource since src is not observable
                if (src != null) foreach (object item in src) sel.Items.Add(item);
            }
            if (change.IncludesValue() || change.IncludesItems())
            {
                if (lb != null && lst != null && lb.SelectionMode != SelectionMode.Single)
                {
                    lb.SelectedItems.Clear();
                    foreach (object item in lst) lb.SelectedItems.Add(item);
                }
                else if (lst != null && lst.Count > 0) sel.SelectedItem = lst[0];
                else sel.SelectedItem = val;

                if (cb != null && cb.IsEditable) cb.Text = property.EditStringValue;
            }
        }
Esempio n. 59
0
 /// <summary>
 /// method handles item deletions during synchronization
 /// </summary>
 /// <param name="propertyChange">instance of property change carrying information about item deletion</param>
 /// <param name="repository">EA repository</param>
 public void handleSynchronizationDeletions(PropertyChange propertyChange, EA.Repository repository)
 {
     if (propertyChange.elementType == 3)                   //odstranenie
     {
         synchronizationDeletions.deletePackage(repository, propertyChange.itemGUID);
     }
     else if (propertyChange.elementType >= 50 && propertyChange.elementType < 70)
     {
         synchronizationDeletions.deleteDiagram(repository, propertyChange.itemGUID, propertyChange.elementType);
     }
     else if (propertyChange.propertyType == 11)
     {
         synchronizationDeletions.deleteConstraint(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.oldPropertyBody);
     }
     else if (propertyChange.elementType < 50)
     {
         synchronizationDeletions.deleteElement(repository, propertyChange.itemGUID, propertyChange.elementType);
     }
     else if (propertyChange.elementType >= 70 && propertyChange.elementType <= 79)
     {
         synchronizationDeletions.deleteConnector(repository, propertyChange.itemGUID, propertyChange.propertyBody, propertyChange.elementType);
     }
     else if (propertyChange.elementType == 90)
     {
         synchronizationDeletions.deleteAttribute(repository, propertyChange.itemGUID);
     }
     else if (propertyChange.elementType == 700)
     {
         synchronizationDeletions.deleteDiagramObject(repository, propertyChange.itemGUID, propertyChange.propertyBody);
     }
 }
Esempio n. 60
0
 void handleChanges(PropertyChange[] changes) {
    for(int pci=0; pci<changes.Length; ++pci) {
       String name = changes[pci].name;
       Object value = changes[pci].val;
       PropertyChangeOp op = changes[pci].op;
       if(op!=PropertyChangeOp.remove) {
          Console.WriteLine("  Property Name: "+name);
          if("summary.quickStats".Equals(name)) {               
             if(value.GetType().Name.Equals("VirtualMachineQuickStats")) {
                VirtualMachineQuickStats vmqs = (VirtualMachineQuickStats)value;
                String cpu = vmqs.overallCpuUsage.ToString() ==null ? "unavailable" :vmqs.overallCpuUsage.ToString();
                String memory = vmqs.hostMemoryUsage.ToString() ==null ? "unavailable" : vmqs.hostMemoryUsage.ToString();
                Console.WriteLine("   Guest Status: " + 
                      vmqs.guestHeartbeatStatus.ToString());
                Console.WriteLine("   CPU Load %: " + cpu);
                Console.WriteLine("   Memory Load %: " + memory);
             } else if (value.GetType().Name.Equals("HostListSummaryQuickStats")) {
                HostListSummaryQuickStats hsqs = (HostListSummaryQuickStats)value;
                String cpu = hsqs.overallCpuUsage.ToString() ==null ? "unavailable" : hsqs.overallCpuUsage.ToString();
                String memory = hsqs.overallMemoryUsage.ToString() == null ? "unavailable" : hsqs.overallMemoryUsage.ToString();
                Console.WriteLine("   CPU Load %: " + cpu);
                Console.WriteLine("   Memory Load %: " + memory);
             }
          } else if("runtime".Equals(name)) {
             if(value.GetType().Name.Equals("VirtualMachineRuntimeInfo")) {
                VirtualMachineRuntimeInfo vmri = (VirtualMachineRuntimeInfo)value;
                Console.WriteLine("   Power State: "
                                   + vmri.powerState.ToString());
                Console.WriteLine("   Connection State: " 
                                   + vmri.connectionState.ToString());
                DateTime bTime = vmri.bootTime;
                if(bTime != null) {
                   Console.WriteLine("   Boot Time: " + bTime.TimeOfDay);
                }
                long mOverhead = vmri.memoryOverhead;
                if(mOverhead.ToString() != null) {
                   Console.WriteLine("   Memory Overhead: "+mOverhead);
                }
            }
            else if (value.GetType().Name.Equals("HostRuntimeInfo"))
            {
                HostRuntimeInfo hri = (HostRuntimeInfo)value;
                Console.WriteLine("   Connection State: " 
                                  + hri.connectionState.ToString());
                DateTime bTime = hri.bootTime;
                if(bTime != null) {
                   Console.WriteLine("   Boot Time: " + bTime.TimeOfDay);
                }
             }
          } else if("name".Equals(name)) {
             Console.WriteLine("   "+value);
          } else {
             Console.WriteLine("   "+value.ToString());
          }
       } else {
          Console.WriteLine("Property Name: " +name+ " value removed.");
       }
    }
 }