private static string FallbackTranslateItem(ActivityTranslator translator, ModelItem item)
        {
            ActivityEntry entry = item.GetActivityEntry();

            if (null != entry)
            {
                return(entry.DisplayName);
            }
            return(item.GetCurrentValue().ToString());
        }
示例#2
0
        /// <summary>
        /// Adds the common activity translation items to the given translator.
        /// </summary>
        /// <param name="translator">The given ActivityTranslator object representing a translator.</param>
        public static void AddCommonTranslateItems(ActivityTranslator translator)
        {
            // Dynamic Operators (AUD dynamic value-typed operators)
            translator.AddTranslateItem(typeof(Add), Autodesk.IM.UI.Rule.Properties.Resources.Add);
            translator.AddTranslateItem(typeof(Subtract), Autodesk.IM.UI.Rule.Properties.Resources.Subtract);
            translator.AddTranslateItem(typeof(Multiply), Autodesk.IM.UI.Rule.Properties.Resources.Multiply);
            translator.AddTranslateItem(typeof(Divide), Autodesk.IM.UI.Rule.Properties.Resources.Divide);
            translator.AddTranslateItem(typeof(Equal), Autodesk.IM.UI.Rule.Properties.Resources.Equal);
            translator.AddTranslateItem(typeof(NotEqual), Autodesk.IM.UI.Rule.Properties.Resources.NotEqual);
            translator.AddTranslateItem(typeof(GreaterThan), Autodesk.IM.UI.Rule.Properties.Resources.GreaterThan);
            translator.AddTranslateItem(typeof(LessThan), Autodesk.IM.UI.Rule.Properties.Resources.LessThan);
            translator.AddTranslateItem(typeof(GreaterThanOrEqual), Autodesk.IM.UI.Rule.Properties.Resources.GreaterThanOrEqual);
            translator.AddTranslateItem(typeof(LessThanOrEqual), Autodesk.IM.UI.Rule.Properties.Resources.LessThanOrEqual);

            translator.AddTranslateItem(typeof(AndAlso), Autodesk.IM.UI.Rule.Properties.Resources.And);
            translator.AddTranslateItem(typeof(OrElse), Autodesk.IM.UI.Rule.Properties.Resources.Or);
            translator.AddTranslateItem(typeof(Xor), Autodesk.IM.UI.Rule.Properties.Resources.Xor);
            translator.AddTranslateItem(typeof(Not), Autodesk.IM.UI.Rule.Properties.Resources.Not);

            // Operators (built-in WF4 operators)
            translator.AddTranslateItem(typeof(sae.Add <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.Add);
            translator.AddTranslateItem(typeof(sae.Subtract <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.Subtract);
            translator.AddTranslateItem(typeof(sae.Multiply <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.Multiply);
            translator.AddTranslateItem(typeof(sae.Divide <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.Divide);
            translator.AddTranslateItem(typeof(sae.Equal <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.Equal);
            translator.AddTranslateItem(typeof(sae.GreaterThan <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.GreaterThan);
            translator.AddTranslateItem(typeof(sae.LessThan <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.LessThan);
            translator.AddTranslateItem(typeof(sae.GreaterThanOrEqual <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.GreaterThanOrEqual);
            translator.AddTranslateItem(typeof(sae.LessThanOrEqual <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.LessThanOrEqual);

            translator.AddTranslateItem(typeof(sae.And <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.And);
            translator.AddTranslateItem(typeof(sae.Or <, ,>), Autodesk.IM.UI.Rule.Properties.Resources.Or);
            translator.AddTranslateItem(typeof(sae.Not <,>), Autodesk.IM.UI.Rule.Properties.Resources.Not);

            // Rules
            translator.AddTranslateItem(typeof(sas.If), Autodesk.IM.UI.Rule.Properties.Resources.If);
            translator.AddTranslateItem(typeof(If), "If (Dynamic)"); //NOXLATE

            // Literals
            translator.AddTranslateItem(typeof(StringLiteral), StringLiteralValueTranslateItem);

            // Types
            translator.AddTranslateItem(typeof(MatchOperator), MatchOperatorTranslateItem);
        }
示例#3
0
        private static string MatchOperatorTranslateItem(ActivityTranslator translator, ModelItem item)
        {
            object obj = item.GetCurrentValue();

            Debug.Assert(obj is MatchOperator);
            MatchOperator operator_ = (MatchOperator)obj;
            string        result    = null;

            switch (operator_)
            {
            case MatchOperator.Equals:
                result = Autodesk.IM.UI.Rule.Properties.Resources.Equal;
                break;

            case MatchOperator.GreaterThan:
                result = Autodesk.IM.UI.Rule.Properties.Resources.GreaterThan;
                break;

            case MatchOperator.GreaterThanOrEqual:
                result = Autodesk.IM.UI.Rule.Properties.Resources.GreaterThanOrEqual;
                break;

            case MatchOperator.LessThan:
                result = Autodesk.IM.UI.Rule.Properties.Resources.LessThan;
                break;

            case MatchOperator.LessThanOrEqual:
                result = Autodesk.IM.UI.Rule.Properties.Resources.LessThanOrEqual;
                break;

            case MatchOperator.NotEqual:
                result = Autodesk.IM.UI.Rule.Properties.Resources.NotEqual;
                break;
            }
            return(result);
        }
示例#4
0
        private static string StringLiteralValueTranslateItem(ActivityTranslator translator, ModelItem item)
        {
            object value = item.Properties[Constants.ValuePropertyName].Value.GetCurrentValue();

            return(value.ToString());
        }
示例#5
0
        /// <summary>
        /// Gets display text of the ItemSelector object.
        /// </summary>
        /// <returns>The display text.</returns>
        protected virtual string GetDisplayText()
        {
            ActivityTranslator translator = EditingContext.Services.GetService <ActivityTranslator>();

            return(translator.Translate(this.Item));
        }