Ejemplo n.º 1
0
        public override void ApplyState(Gum.DataTypes.Variables.StateSave state)
        {
            bool matches = this.ElementSave.AllStates.Contains(state);

            if (matches)
            {
                var category = this.ElementSave.Categories.FirstOrDefault(item => item.States.Contains(state));
                if (category == null)
                {
                    if (state.Name == "Default")
                    {
                        this.mCurrentVariableState = VariableState.Default;
                    }
                }
                else if (category.Name == "EnabledStatus")
                {
                    if (state.Name == "Enabled")
                    {
                        this.mCurrentEnabledStatusState = EnabledStatus.Enabled;
                    }
                    if (state.Name == "Unaffordable")
                    {
                        this.mCurrentEnabledStatusState = EnabledStatus.Unaffordable;
                    }
                    if (state.Name == "Disabled")
                    {
                        this.mCurrentEnabledStatusState = EnabledStatus.Disabled;
                    }
                }
            }
            base.ApplyState(state);
        }
 public override string[] GetFileAttachments(Article article, EnabledStatus enabledStatus)
 {
     using (TransactionScope transaction = new TransactionScope(mConfiguration))
     {
         FileAttachmentDataStore dataStore = new FileAttachmentDataStore(transaction);
         return(dataStore.GetArticleAttachments(article, enabledStatus));
     }
 }
Ejemplo n.º 3
0
 private void OnEnabledStatusChanged(EnabledStatus _oldValue, EnabledStatus _activationStatus)
 {
     if (_enabledStatus == Primitives.EnabledStatus.Enabled)
     {
         base.SetValue(IsEnabledProperty, true);
     }
     else if (_enabledStatus == Primitives.EnabledStatus.Disabled)
     {
         base.SetValue(IsEnabledProperty, false);
     }
 }
Ejemplo n.º 4
0
        public override int GetHashCode()
        {
            int hash = 17;

            hash = hash * 23 + FieldState.GetHashCode();
            hash = hash * 23 + FieldValue.GetHashCode();
            hash = hash * 23 + RequiredStatus.GetHashCode();
            hash = hash * 23 + EnabledStatus.GetHashCode();
            hash = hash * 23 + FieldNumber.GetHashCode();
            hash = hash * 23 + LockedStatus.GetHashCode();
            return(hash);
        }
Ejemplo n.º 5
0
 public static bool Equals(this Nullable <EnabledStatus> Value1, EnabledStatus Value2)
 {
     if (Value1 == null)
     {
         return(false);
     }
     else if (Value1.Value == Value2)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 6
0
        private Gum.DataTypes.Variables.StateSave AddToCurrentValuesWithState(EnabledStatus state)
        {
            Gum.DataTypes.Variables.StateSave newState = new Gum.DataTypes.Variables.StateSave();
            switch (state)
            {
            case  EnabledStatus.Enabled:
                break;

            case  EnabledStatus.Unaffordable:
                break;

            case  EnabledStatus.Disabled:
                break;
            }
            return(newState);
        }
Ejemplo n.º 7
0
 public FlatRedBall.Glue.StateInterpolation.Tweener InterpolateToRelative(EnabledStatus toState, double secondsToTake, FlatRedBall.Glue.StateInterpolation.InterpolationType interpolationType, FlatRedBall.Glue.StateInterpolation.Easing easing, object owner = null)
 {
     Gum.DataTypes.Variables.StateSave           current       = GetCurrentValuesOnState(toState);
     Gum.DataTypes.Variables.StateSave           toAsStateSave = AddToCurrentValuesWithState(toState);
     FlatRedBall.Glue.StateInterpolation.Tweener tweener       = new FlatRedBall.Glue.StateInterpolation.Tweener(from: 0, to: 1, duration: (float)secondsToTake, type: interpolationType, easing: easing);
     if (owner == null)
     {
         tweener.Owner = this;
     }
     else
     {
         tweener.Owner = owner;
     }
     tweener.PositionChanged = newPosition => this.InterpolateBetween(current, toAsStateSave, newPosition);
     tweener.Ended          += () => this.CurrentEnabledStatusState = toState;
     tweener.Start();
     StateInterpolationPlugin.TweenerManager.Self.Add(tweener);
     return(tweener);
 }
Ejemplo n.º 8
0
        public void InterpolateBetween(EnabledStatus firstState, EnabledStatus secondState, float interpolationValue)
        {
                #if DEBUG
            if (float.IsNaN(interpolationValue))
            {
                throw new System.Exception("interpolationValue cannot be NaN");
            }
                #endif
            switch (firstState)
            {
            case  EnabledStatus.Enabled:
                break;

            case  EnabledStatus.Unaffordable:
                break;

            case  EnabledStatus.Disabled:
                break;
            }
            switch (secondState)
            {
            case  EnabledStatus.Enabled:
                break;

            case  EnabledStatus.Unaffordable:
                break;

            case  EnabledStatus.Disabled:
                break;
            }
            if (interpolationValue < 1)
            {
                mCurrentEnabledStatusState = firstState;
            }
            else
            {
                mCurrentEnabledStatusState = secondState;
            }
        }
Ejemplo n.º 9
0
        public string[] GetArticleAttachments(Article article, EnabledStatus enabledStatus)
        {
            string hql = "SELECT T.Name FROM FileAttachment T INNER JOIN T.Article A WHERE A.Id = :articleId";

            if (enabledStatus == EnabledStatus.Disabled)
            {
                hql += " AND T.Enabled = 0";
            }
            else if (enabledStatus == EnabledStatus.Enabled)
            {
                hql += " AND T.Enabled = 1";
            }

            IQuery query = CreateQuery(hql);

            query.SetParameter("articleId", article.Id);

            IList <string> names = query.List <string>();

            string[] arrNames = new string[names.Count];
            names.CopyTo(arrNames, 0);
            return(arrNames);
        }
Ejemplo n.º 10
0
        public override string[] GetFileAttachments(Article article, EnabledStatus enabledStatus)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                FileAttachmentDataStore dataStore = new FileAttachmentDataStore(transaction);

                return dataStore.GetArticleAttachments(article, enabledStatus);
            }
        }
Ejemplo n.º 11
0
 public static string[] GetFileAttachments(Article article, EnabledStatus enabledStatus)
 {
     return(Provider.GetFileAttachments(article, enabledStatus));
 }
Ejemplo n.º 12
0
 public abstract string[] GetFileAttachments(Article article, EnabledStatus enabledStatus);
Ejemplo n.º 13
0
 public abstract string[] GetFileAttachments(Article article, EnabledStatus enabledStatus);
Ejemplo n.º 14
0
 public static bool ToBoolean(this EnabledStatus status)
 {
     return(status == EnabledStatus.Enabled);
 }
Ejemplo n.º 15
0
 public static string[] GetFileAttachments(Article article, EnabledStatus enabledStatus)
 {
     return Provider.GetFileAttachments(article, enabledStatus);
 }