Пример #1
0
 private static int CompareConditions(ConditionModel a, ConditionModel b)
 {
     if (a.TriggerSource == b.TriggerSource)
     {
         if ((TriggerSourceInformation)a.Property == (TriggerSourceInformation)null && (TriggerSourceInformation)b.Property == (TriggerSourceInformation)null)
         {
             return(0);
         }
         if ((TriggerSourceInformation)a.Property == (TriggerSourceInformation)null)
         {
             return(-1);
         }
         if ((TriggerSourceInformation)b.Property == (TriggerSourceInformation)null)
         {
             return(1);
         }
         return(a.Property.CompareTo((object)b.Property));
     }
     if (a.TriggerSource is FrameworkTemplateElement)
     {
         return(-1);
     }
     if (b.TriggerSource is FrameworkTemplateElement)
     {
         return(1);
     }
     return(a.TriggerSourceDisplayName.CompareTo(b.TriggerSourceDisplayName));
 }
Пример #2
0
        public ConditionModel AddCondition(ITriggerConditionNode condition)
        {
            ConditionModel conditionModel = new ConditionModel(condition, this);

            conditionModel.Initialize();
            conditionModel.PropertyChanged += new PropertyChangedEventHandler(this.Condition_PropertyChanged);
            this.conditions.Add(conditionModel);
            this.AsyncSortConditions();
            return(conditionModel);
        }
Пример #3
0
        private void SetTriggerValueCore(string value)
        {
            object obj  = (object)null;
            bool   flag = false;

            if (value != null && !this.Property.PropertyReferenceStep.TargetType.IsValueType)
            {
                string[] strArray = new string[4]
                {
                    "null",
                    "x:null",
                    "{x:null}",
                    "nothing"
                };
                foreach (string strA in strArray)
                {
                    if (string.Compare(strA, value, StringComparison.CurrentCultureIgnoreCase) == 0)
                    {
                        flag = true;
                    }
                }
            }
            if (!flag)
            {
                TypeConverter converterForProperty = ConditionModel.GetTypeConverterForProperty(this.condition.PropertyKey);
                if (converterForProperty != null)
                {
                    if (converterForProperty.CanConvertFrom(typeof(string)))
                    {
                        try
                        {
                            obj  = converterForProperty.ConvertFromString((ITypeDescriptorContext)null, CultureInfo.InvariantCulture, value);
                            flag = true;
                        }
                        catch (NotSupportedException ex)
                        {
                        }
                    }
                }
            }
            if (!flag || object.Equals((object)value, this.condition.Value))
            {
                return;
            }
            using (SceneEditTransaction editTransaction = this.condition.TriggerNode.ViewModel.CreateEditTransaction(StringTable.TriggerChangeUndoUnit))
            {
                this.condition.Value = obj;
                editTransaction.Commit();
            }
        }
Пример #4
0
 private void ConditionSubscription_ContentChanged(object sender, SceneNode pathNode, ConditionModel content, DocumentNodeMarker damageMarker, DocumentNodeChange damage)
 {
     content.Update();
     this.OnPropertyChanged("TriggerNode");
 }
Пример #5
0
 private void ConditionSubscription_Removed(object sender, SceneNode basisNode, object basisContent, SceneNode oldPathNode, ConditionModel oldContent)
 {
     this.RemoveCondition(oldContent.Condition);
 }