示例#1
0
    /// <summary>
    /// Execution one dialog element
    /// </summary>
    /// <typeparam name="TData">Type of the element result</typeparam>
    /// <returns>Result</returns>
    public async Task <TData> RunForm <TData>() where TData : new()
    {
        var data = new TData();

        foreach (var property in data.GetType()
                 .GetProperties())
        {
            var attribute = property.GetCustomAttributes(typeof(DialogElementAssignmentAttribute), false)
                            .OfType <DialogElementAssignmentAttribute>()
                            .FirstOrDefault();

            if (attribute != null)
            {
                var service = (DialogElementBase)_serviceProvider.GetService(attribute.DialogElementType);

                service.Initialize(_commandContext, _serviceProvider, DialogContext);

                property.SetValue(data,
                                  await service.InternalRun()
                                  .ConfigureAwait(false));
            }
        }

        return(data);
    }
示例#2
0
        public VARIANT_TYPE GetType(int index)
        {
            if (mValueObject.Count > index)
            {
                TData data = (TData)mValueObject[index];

                return(data.GetType());
            }

            return(VARIANT_TYPE.VTYPE_UNKNOWN);
        }
示例#3
0
        public NFVector3 Vector3Val(int index)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_VECTOR3)
            {
                return(data.Vector3Val());
            }

            return(NFDataList.NULL_VECTOR3);
        }
示例#4
0
        public NFGUID ObjectVal(int index)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_OBJECT)
            {
                return(data.ObjectVal());
            }

            return(NFDataList.NULL_OBJECT);
        }
示例#5
0
        public string StringVal(int index)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_STRING)
            {
                return(data.StringVal());
            }

            return(NFDataList.NULL_STRING);
        }
示例#6
0
        public double FloatVal(int index)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_FLOAT)
            {
                return((double)data.FloatVal());
            }

            return((float)NFDataList.NULL_DOUBLE);
        }
示例#7
0
        public Int64 IntVal(int index)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_INT)
            {
                return(data.IntVal());
            }

            return(NFDataList.NULL_INT);
        }
示例#8
0
        public override double DoubleVal(int index)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_DOUBLE)
            {
                return(data.DoubleVal());
            }

            return(NFIDataList.NULL_DOUBLE);
        }
示例#9
0
        public override float FloatVal(int index)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_FLOAT)
            {
                return((float)data.DoubleVal());
            }

            return((float)NFIDataList.NULL_DOUBLE);
        }
示例#10
0
        public bool SetVector3(int index, NFVector3 value)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_VECTOR3)
            {
                data.Set(value);

                return(true);
            }

            return(false);
        }
示例#11
0
        public bool SetObject(int index, NFGUID value)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_OBJECT)
            {
                data.Set(value);

                return(true);
            }

            return(false);
        }
示例#12
0
        public bool SetString(int index, string value)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_STRING)
            {
                data.Set(value);

                return(true);
            }

            return(false);
        }
示例#13
0
        public bool SetFloat(int index, double value)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_FLOAT)
            {
                data.Set(value);

                return(true);
            }

            return(false);
        }
示例#14
0
        public bool SetInt(int index, Int64 value)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_INT)
            {
                data.Set(value);

                return(true);
            }

            return(false);
        }
示例#15
0
        public override bool SetDouble(int index, double value)
        {
            TData data = GetData(index);

            if (data != null && data.GetType() == VARIANT_TYPE.VTYPE_DOUBLE)
            {
                data.Set(value);

                return(true);
            }

            return(false);
        }