private void AttributeChangesListView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            AttributeChangesViewModel vm = ((ListView)sender).DataContext as AttributeChangesViewModel;

            if (vm == null)
            {
                return;
            }

            AttributeChangeViewModel attributeChange = vm.FirstOrDefault(t => t.IsSelected);

            if (attributeChange == null)
            {
                return;
            }

            ValueChangeViewModel valueChange = attributeChange.ValueChanges.FirstOrDefault(t => t.IsSelected);

            if (valueChange == null)
            {
                valueChange = attributeChange.ValueChanges.FirstOrDefault();

                if (valueChange == null)
                {
                    return;
                }
            }

            valueChange.EditValueChange();
        }
Example #2
0
        public NewValueChangeViewModel(
            Window window,
            IEnumerable <UnitTestStepObjectCreation> allowedReferenceObjects,
            ExtendedAttributeType dataType,
            ValueModificationType modificationType,
            ValueChangeViewModel existingValueChange = null)
            : base()
        {
            this.IgnoreOwnPropertyChanges = true;
            this.AllowedObjects           = allowedReferenceObjects;
            this.existingValueChange      = existingValueChange;
            this.ModificationType         = modificationType;
            this.Type = dataType;

            if (this.existingValueChange != null)
            {
                this.ModificationType = this.existingValueChange.ModificationType;

                if (this.Type == ExtendedAttributeType.Reference)
                {
                    if (!string.IsNullOrEmpty(this.existingValueChange.Value))
                    {
                        object modelValue     = this.existingValueChange.ModelValue;
                        Guid   modelValueGuid = Lithnet.MetadirectoryServices.TypeConverter.ConvertData <Guid>(modelValue);
                        this.ReferenceValue = modelValueGuid;
                    }
                    else
                    {
                        this.ReferenceValue = Guid.Empty;
                    }
                }
                else
                {
                    this.Value = this.existingValueChange.Value;
                }
            }
            else
            {
                if (this.type == ExtendedAttributeType.Reference)
                {
                    if (this.AllowedObjects.Any())
                    {
                        this.ReferenceValue = this.AllowedObjects.First().ObjectId;
                    }
                }
            }
            this.Commands.AddItem("Create", t => this.Create(window), t => this.CanCreate());
        }