public DictionaryControlGridViewModel(ObservableCollection<ControlView> properties,
            ObservableCollection<ControlView> propertiesValue,
            int itemsCount,
            Type fieldType,
            Type fieldValueType,
            ControlView baseTypeProperties,
            ControlView baseValueTypeProperties
            )
        {
            Properties = properties;
            PropertiesValue = propertiesValue;
            ItemsCount = itemsCount;
            FieldType = fieldType;
            FieldValueType = fieldValueType;
            _baseTypeProperties = baseTypeProperties;
            _baseValueTypeProperties = baseValueTypeProperties;

            if (Properties.Count < _itemsCount)
            {
                for (int i = Properties.Count; i < _itemsCount; i++)
                {
                    Properties.Add(Controller.DeepCopy(_baseTypeProperties));
                }
            }
            if (PropertiesValue.Count < _itemsCount)
            {
                for (int i = PropertiesValue.Count; i < _itemsCount; i++)
                {
                    PropertiesValue.Add(Controller.DeepCopy(_baseValueTypeProperties));
                }
            }
        }
        private void CommonCustomClassifyMenuPlugin_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem tsmi = sender as ToolStripMenuItem;

            if (tsmi != null)
            {
                CommonCustomClassify _Classify = tsmi.Tag as CommonCustomClassify;
                foreach (ViewBase _View in this.m_Application.Views)
                {
                    if (_View is ControlView)
                    {
                        ControlView _ControlView = _View as ControlView;
                        if (_ControlView.GetControl() is CommonCustomClassifyListControlView)
                        {
                            CommonCustomClassifyListControlView _CommonCustomClassifyListControlView = _ControlView.GetControl() as CommonCustomClassifyListControlView;
                            if (_CommonCustomClassifyListControlView.Classify != null && _CommonCustomClassifyListControlView.Classify.Equals(_Classify))
                            {
                                _ControlView.Focus();
                                return;
                            }
                        }
                    }
                }

                CommonCustomClassifyListControlView ctlControlView = new CommonCustomClassifyListControlView();
                ctlControlView.SetApplication(this.m_Application);
                ctlControlView.Classify = _Classify;

                ControlView view = new ControlView(this.m_Application, ctlControlView, _Classify.Name, _Classify.GetIcon16());
                this.m_Application.Views.Load(view, ViewDockOptions.Left);
            }
        }
        public DictionaryControlGridViewModel(ObservableCollection <ControlView> properties,
                                              ObservableCollection <ControlView> propertiesValue,
                                              int itemsCount,
                                              Type fieldType,
                                              Type fieldValueType,
                                              ControlView baseTypeProperties,
                                              ControlView baseValueTypeProperties
                                              )
        {
            Properties               = properties;
            PropertiesValue          = propertiesValue;
            ItemsCount               = itemsCount;
            FieldType                = fieldType;
            FieldValueType           = fieldValueType;
            _baseTypeProperties      = baseTypeProperties;
            _baseValueTypeProperties = baseValueTypeProperties;

            if (Properties.Count < _itemsCount)
            {
                for (int i = Properties.Count; i < _itemsCount; i++)
                {
                    Properties.Add(Controller.DeepCopy(_baseTypeProperties));
                }
            }
            if (PropertiesValue.Count < _itemsCount)
            {
                for (int i = PropertiesValue.Count; i < _itemsCount; i++)
                {
                    PropertiesValue.Add(Controller.DeepCopy(_baseValueTypeProperties));
                }
            }
        }
示例#4
0
        public void prepareControlView()
        {
            controlView = new ControlView(new CGRect(0, View.Bounds.Height - 56, View.Bounds.Width, 56));
            View.Layout(controlView).Bottom(0).Left(0).Right(0);

            var undoButton = new FlatButton();

            undoButton.PulseColor = MaterialColor.White;
            undoButton.SetTitle("UNDO", UIControlState.Normal);
            undoButton.SetTitleColor(MaterialColor.Teal.Accent3, UIControlState.Normal);

            var undoButton2 = new FlatButton();

            undoButton2.PulseColor = MaterialColor.White;
            undoButton2.SetTitle("UNDO", UIControlState.Normal);
            undoButton2.SetTitleColor(MaterialColor.Teal.Accent3, UIControlState.Normal);

            var label = new UILabel();

            label.Text      = "Archived";
            label.TextColor = MaterialColor.White;

            controlView.BackgroundColor = MaterialColor.Grey.Darken4;
            controlView.ContentView.AddSubview(label);
            controlView.RightControls = new UIControl[] {
                undoButton, undoButton2
            };
            controlView.ContentInsetPreset = MaterialEdgeInset.WideRectangle3;

            //View.AddSubview(controlView);
            controlView.ContentView.Grid().Views = new List <UIView>()
            {
                label
            };
        }
示例#5
0
        public MainForm()
        {
            InitializeComponent();

            outputView = new OutputView(this);

            registersView = new RegisterView(this);

            displayView = new DisplayView(this);
            controlView = new ControlView(this);

            callStackView  = new CallStackView(this);
            stackFrameView = new StackFrameView(this);

            statusView      = new StatusView(this);
            symbolView      = new SymbolView(this);
            watchView       = new WatchView(this);
            breakPointView  = new BreakpointView(this);
            instructionView = new InstructionView(this);
            methodView      = new MethodView(this);

            //scriptView = new ScriptView(this);

            sourceView     = new SourceView(this);
            sourceDataView = new SourceDataView(this);

            AppLocations.FindApplications();
            LauncherOptions.EnableQemuGDB = true;
        }
        private void SwitchActiveView(ControlView controlView)
        {
            mInboxView.Visible          = ControlView.Inbox == controlView;
            mOutboxView.Visible         = ControlView.Outbox == controlView;
            mComposeMessageView.Visible = ControlView.ComposeMessage == controlView;
            mRecordingView.Visible      = ControlView.RecordingAudio == controlView;

            //set accept button

            switch (controlView)
            {
            case ControlView.ComposeMessage:
                OnAcceptButtonChanged(mComposeMessageView.buttonTalk, new EventArgs());
                break;

            case ControlView.Inbox:
                OnAcceptButtonChanged(null, new EventArgs());
                break;

            case ControlView.Outbox:
                OnAcceptButtonChanged(null, new EventArgs());
                break;

            case ControlView.RecordingAudio:
                OnAcceptButtonChanged(mRecordingView.buttonStop, new EventArgs());
                break;

            default:
                break;
            }
        }
示例#7
0
        private static ControlView GetTypeDetailPrimitiveObject(Type fieldType, string fieldName, bool isNullableType, string value, string guid)
        {
            ControlView cv = new ControlView {
                IsPrimitive = true
            };

            if (isNullableType)
            {
                cv.PControlView = new PrimitiveControlViewModel()
                {
                    FieldName    = fieldName,
                    FieldValue   = value,
                    FieldType    = Nullable.GetUnderlyingType(fieldType),
                    AssemblyGuid = guid
                };
            }
            else
            {
                cv.PControlView = new PrimitiveControlViewModel()
                {
                    FieldName    = fieldName,
                    FieldValue   = value,
                    FieldType    = fieldType,
                    AssemblyGuid = guid
                };
            }
            return(cv);
        }
示例#8
0
 //public static void ShowListControlGridViewDialog(ObservableCollection<List<ControlView>> properties,
 public static void ShowListControlGridViewDialog(ObservableCollection <ControlView> properties,
                                                  BindingList <IntWrappper> arrayIndexes,
                                                  Type fieldType,
                                                  ControlView baseTypeProperties)
 {
     DialogHelper.ShowDialog <ListControlGridViewModel>(properties, arrayIndexes, fieldType, baseTypeProperties);
 }
示例#9
0
        /// <summary>
        /// Creates Dictionary object
        /// </summary>
        /// <param name="mParameter">Parameter info</param>
        /// <param name="parameterOrder">parameter order</param>
        /// <param name="paramValue">param value object from project</param>
        /// <returns></returns>
        private static ControlView GetDictionaryObject(ParameterInfo mParameter, int parameterOrder, string guid, ParamValue paramValue = null)
        {
            ControlView arrayObject = new ControlView
            {
                IsDictionary = true,
                DControlView = new DictionartControlViewModel
                {
                    FieldName               = mParameter.Name,
                    FieldType               = mParameter.ParameterType.GenericTypeArguments[0],
                    FieldValueType          = mParameter.ParameterType.GenericTypeArguments[1],
                    Order                   = parameterOrder,
                    DictionaryItemsCount    = paramValue != null ? paramValue.DictionaryLength : 0,
                    BaseTypeProperties      = GetTypeDetails(mParameter.ParameterType.GenericTypeArguments[0], guid),
                    BaseValueTypeProperties =
                        GetTypeDetails(mParameter.ParameterType.GenericTypeArguments[1], guid),
                    AssemblyGuid = guid
                }
            };

            for (int i = 0; i < arrayObject.DControlView.DictionaryItemsCount; i++)
            {
                arrayObject.DControlView.Properties.Add(GetTypeDetails(mParameter.ParameterType.GenericTypeArguments[0], guid,
                                                                       paramValue != null ? paramValue.DictKeyElements[i] : null));
                arrayObject.DControlView.PropertiesValue.Add(GetTypeDetails(mParameter.ParameterType.GenericTypeArguments[1], guid,
                                                                            paramValue != null ? paramValue.DictValueElements[i] : null));
            }
            return(arrayObject);
        }
示例#10
0
        /// <summary>
        /// Creates Complex object
        /// </summary>
        /// <param name="mParameter">Parameter info</param>
        /// <param name="parameterOrder">parameter order</param>
        /// <param name="guid"></param>
        /// <param name="paramValue">param value object from project</param>
        /// <returns></returns>
        private static ControlView GetComplexObject(ParameterInfo mParameter, int parameterOrder, string guid, ParamValue paramValue = null)
        {
            ObservableCollection <ControlView> parameterPropertiesNew = new ObservableCollection <ControlView>();

            foreach (PropertyInfo pProperty in mParameter.ParameterType.GetProperties())
            {
                if (pProperty.PropertyType.FullName == "System.Runtime.Serialization.ExtensionDataObject")
                {
                    continue;
                }
                parameterPropertiesNew.Add(GetPropertyDetails(pProperty, guid, paramValue));
            }

            var complexObject = new ControlView()
            {
                IsPrimitive  = false,
                CControlView = new ComplexControlViewModel()
                {
                    FieldName  = mParameter.Name,
                    Properties = parameterPropertiesNew,
                    Order      = parameterOrder
                }
            };

            return(complexObject);
        }
示例#11
0
        private static void GetComplexItemIm(ParamValue paramValue, ControlView property)
        {
            Guid g = Guid.NewGuid();

            paramValue.Param.Add(property.CControlView.FieldName, g.ToString());
            paramValue.GuidValues.Add(WriteComplexType(property.CControlView.Properties.ToList(), g));
        }
示例#12
0
        private static ControlView GetTypeDetailsDictionaryObject(Type propertyInfo, string fieldName, ParamValue newParamValues, string guid)
        {
            ControlView arrayObject = new ControlView
            {
                IsDictionary = true,
                DControlView = new DictionartControlViewModel
                {
                    FieldName      = fieldName,
                    FieldType      = propertyInfo.GenericTypeArguments[0],
                    FieldValueType = propertyInfo.GenericTypeArguments[1],
                    AssemblyGuid   = guid
                }
            };

            if (newParamValues != null)
            {
                arrayObject.DControlView.DictionaryItemsCount = newParamValues.DictionaryLength;

                for (int i = 0; i < arrayObject.DControlView.DictionaryItemsCount; i++)
                {
                    arrayObject.DControlView.Properties.Add(GetTypeDetails(propertyInfo.GenericTypeArguments[0], guid,
                                                                           newParamValues.DictKeyElements[i]));
                    arrayObject.DControlView.PropertiesValue.Add(GetTypeDetails(propertyInfo.GenericTypeArguments[1], guid,
                                                                                newParamValues.DictValueElements[i]));
                }
            }
            else
            {
                arrayObject.DControlView.BaseTypeProperties      = GetTypeDetails(propertyInfo.GenericTypeArguments[0], guid);
                arrayObject.DControlView.BaseValueTypeProperties = GetTypeDetails(propertyInfo.GenericTypeArguments[1], guid);
            }
            return(arrayObject);
        }
示例#13
0
 public LabelledBackButton(string Label) : base(new BackButton(), Label)
 {
     if (ControlView.GetType() == typeof(BackButton))
     {
         Control = ControlView as BackButton;
     }
 }
示例#14
0
        public MainForm()
        {
            InitializeComponent();

            outputView = new OutputView(this);

            registersView = new RegisterView(this);

            displayView = new DisplayView(this);
            controlView = new ControlView(this);

            callStackView  = new CallStackView(this);
            stackFrameView = new StackFrameView(this);

            //stackView = new StackView(this);
            //flagView = new FlagView(this);
            statusView      = new StatusView(this);
            symbolView      = new SymbolView(this);
            watchView       = new WatchView(this);
            breakPointView  = new BreakPointView(this);
            instructionView = new InstructionView(this);
            methodView      = new MethodView(this);

            //scriptView = new ScriptView(this);

            AppLocations.FindApplications();
        }
示例#15
0
 public LabelledCheckbox(string Label) : base(new Checkbox(), Label)
 {
     if (ControlView.GetType() == typeof(Checkbox))
     {
         Control = ControlView as Checkbox;
     }
 }
示例#16
0
        protected override void InitializeView()
        {
            base.InitializeView();
            Nodes.MakeArrayNode node = targetNode as Nodes.MakeArrayNode;
            if (node.elementType.isAssigned)
            {
                System.Type     type   = node.elementType.Get <System.Type>();
                FilterAttribute filter = new FilterAttribute(type);
                for (int i = 0; i < node.values.Count; i++)
                {
                    int x = i;
                    AddInputValuePort(
                        new PortData()
                    {
                        portID         = "Element#" + x,
                        onValueChanged = (o) => {
                            RegisterUndo();
                            node.values[x] = o as MemberData;
                        },
                        getPortName  = () => "Element " + x,
                        getPortType  = () => filter.GetActualType(),
                        getPortValue = () => node.values[x],
                        filter       = filter,
                    }
                        );
                }
            }
            ControlView control = new ControlView();

            control.Add(new Button(() => {
                if (node.values.Count > 0)
                {
                    RegisterUndo();
                    node.values.RemoveAt(node.values.Count - 1);
                    MarkRepaint();
                }
            })
            {
                text = "-"
            });
            control.Add(new Button(() => {
                RegisterUndo();
                MemberData val;
                if (ReflectionUtils.CanCreateInstance(node.elementType.Get <Type>()))
                {
                    val = new MemberData(ReflectionUtils.CreateInstance(node.elementType.Get <Type>()));
                }
                else
                {
                    val = MemberData.empty;
                }
                node.values.Add(val);
                MarkRepaint();
            })
            {
                text = "+"
            });
            AddControl(Direction.Input, control);
        }
示例#17
0
    void Start()
    {

        watchPoint = transform.FindChild("WatchPoint").GetComponent<ControlView>();
        messageBox = Camera.main.transform.FindChild("Mess").GetComponent<TextMesh>();
        rigidBody = GetComponent<Rigidbody>();

    }
示例#18
0
        public BlockControl AddControl(string label, ControlView control)
        {
            BlockControl block = new BlockControl(label, control);

            inputContainer.Add(block);
            controls.Add(block);
            return(block);
        }
示例#19
0
        public void ControlViewTest()
        {
            ControlView cv = ControlView.Instance();

            cv.Show();
            cv.Activate();
            CleanUp();
        }
示例#20
0
 private IViewFactory OnList(IRequest request)
 {
     return(ControlView.Payload <HomeView>(new[]
     {
         new { Title = "http://arutor.org", Path = "/Rutor" },
         new { Title = "http://p30downloads.com", Path = "/Thirty" },
         new { Title = "Logs", Path = "/Logs" }
     }));
 }
示例#21
0
 public static void ShowDictionaryControlGridViewDialog(ObservableCollection <ControlView> properties,
                                                        ObservableCollection <ControlView> propertiesValue,
                                                        int itemsCount,
                                                        Type fieldType,
                                                        Type fieldValueType,
                                                        ControlView baseTypeProperties,
                                                        ControlView baseValueTypeProperties)
 {
     DialogHelper.ShowDialog <DictionaryControlGridViewModel>(properties, propertiesValue, itemsCount, fieldType, fieldValueType, baseTypeProperties, baseValueTypeProperties);
 }
示例#22
0
        private async Task <IViewFactory> OnDetails(IRequest request)
        {
            DataRepository   repository = new DataRepository();
            ThirtyCollection collection = await repository.Get <ThirtyCollection>();

            object       payload = collection.Details(request.Parameters["id"]);
            IViewFactory factory = ControlView.Payload <ThirtyDetailsView>(payload);

            return(factory);
        }
示例#23
0
        private async Task <IViewFactory> OnList(IRequest request)
        {
            DataRepository   repository = new DataRepository();
            ThirtyCollection collection = await repository.Get <ThirtyCollection>();

            object       payload = collection.List();
            IViewFactory factory = ControlView.Payload <ThirtyListView>(payload);

            return(factory);
        }
示例#24
0
        private ControlView CreateMyControl()
        {
            var packageContext = (IPackageContext)Package;
            var viewMode       = new ControlViewModel(new ControlModel(), packageContext);
            var view           = new ControlView {
                DataContext = viewMode
            };

            return(view);
        }
示例#25
0
        private static ControlView GetPropertyDetails(PropertyInfo propertyInfo, string guid, ParamValue paramValue = null)
        {
            bool isNullableType = Nullable.GetUnderlyingType(propertyInfo.PropertyType) != null;


            if (
                propertyInfo.PropertyType.Name.ToLower() == "dictionary`2" &&
                propertyInfo.PropertyType.IsGenericType &&
                propertyInfo.PropertyType.GenericTypeArguments != null &&
                propertyInfo.PropertyType.GenericTypeArguments.Length == 2)
            {
                var newParamValues = GetNewParamValues(propertyInfo.Name, paramValue);


                var arrayObject = GetTypeDetailsDictionaryObject(propertyInfo.PropertyType, propertyInfo.Name, newParamValues, guid);
                return(arrayObject);
            }
            //for list
            else if (propertyInfo.PropertyType.IsArray)
            {
                int  dimensions    = propertyInfo.PropertyType.FullName.Split(new[] { "[]" }, StringSplitOptions.None).Length - 1;
                Type arrayBaseType = propertyInfo.PropertyType.GetElementType();
                for (int ii = 1; ii < dimensions; ii++)
                {
                    arrayBaseType = arrayBaseType.GetElementType();
                }

                var newParamValues = GetNewParamValues(propertyInfo.Name, paramValue);
                var arrayObject    = GetTypeDetailsArrayObject(propertyInfo.Name, arrayBaseType, newParamValues, dimensions, guid);
                return(arrayObject);
            }
            else if (propertyInfo.PropertyType.IsPrimitive ||
                     propertyInfo.GetType().IsPrimitive ||
                     propertyInfo.PropertyType.Name.ToLower() == "string" ||
                     (isNullableType && PrimitiveTypes.Test(Nullable.GetUnderlyingType(propertyInfo.PropertyType))) ||
                     PrimitiveTypes.Test(propertyInfo.PropertyType)
                     )
            {
                string value = string.Empty;
                if (paramValue != null)
                {
                    value = paramValue.Param.ContainsKey(propertyInfo.Name) ? paramValue.Param[propertyInfo.Name] : string.Empty;
                }


                var cv = GetTypeDetailPrimitiveObject(propertyInfo.PropertyType, propertyInfo.Name, isNullableType, value, guid);
                return(cv);
            }
            else
            {
                var         newParamValues = GetNewParamValues(propertyInfo.Name, paramValue);
                ControlView cv1            = GetTypeDetailComplexObject(propertyInfo.PropertyType, guid, newParamValues, propertyInfo.Name);
                return(cv1);
            }
        }
示例#26
0
        private async Task <IViewFactory> OnReleaseById(IRequest request)
        {
            DataRepository  repository = new DataRepository();
            RutorCollection collection = await repository.Get <RutorCollection>();

            string       id      = request.Parameters["id"];
            object       payload = collection.Release(id);
            IViewFactory factory = ControlView.Payload <RutorReleaseView>(payload);

            return(factory);
        }
示例#27
0
        private static ParamValue CreateArrayItem(ControlView cv, Guid?gf = null)
        {
            ParamValue paramValue = new ParamValue
            {
                ArrayElements = new List <ParamValue>(),
                Param         = new Dictionary <string, string>()
            };

            if (gf != null)
            {
                paramValue.Guid = gf.Value.ToString();
            }
            if (cv.IsDictionary)
            {
                paramValue.Order = cv.DControlView.Order;

                GetDictinaryItemIm(cv, paramValue);
            }
            else if (cv.IsList)
            {
                paramValue.Order = cv.LControlView.Order;

                GetArrayItemIm(cv, paramValue);
            }
            else if (cv.IsPrimitive)
            {
                paramValue.Order = cv.PControlView.Order;
                paramValue.Param.Add("value", cv.PControlView.FieldValue);
            }
            else
            {
                paramValue.Order = cv.CControlView.Order;
                foreach (var property in cv.CControlView.Properties)
                {
                    if (property.IsDictionary)
                    {
                        GetDictinaryItemIm(property, paramValue);
                    }
                    else if (property.IsList)
                    {
                        GetArrayItemIm(property, paramValue);
                    }
                    else if (property.IsPrimitive)
                    {
                        paramValue.Param.Add(property.PControlView.FieldName, property.PControlView.FieldValue);
                    }
                    else
                    {
                        GetComplexItemIm(paramValue, property);
                    }
                }
            }
            return(paramValue);
        }
示例#28
0
        private async Task <IViewFactory> OnMovieByTitle(IRequest request)
        {
            DataRepository  repository = new DataRepository();
            RutorCollection collection = await repository.Get <RutorCollection>();

            string year  = request.Parameters["year"];
            string title = request.Parameters["title"];

            object       payload = collection.Details(year, title);
            IViewFactory factory = ControlView.Payload <RutorMovieDetailsView>(payload);

            return(factory);
        }
示例#29
0
        private static IViewFactory OnMoviesAll(IRequest request)
        {
            async Task <object> result()
            {
                DataRepository  repository = new DataRepository();
                RutorCollection collection = await repository.Get <RutorCollection>();

                int?page = request.Payload;

                return(collection.Group(page.GetValueOrDefault(0)).ToArray());
            }

            return(ControlView.PayloadAsync <RutorMovieListView>(result));
        }
示例#30
0
 private static void GetArrayObjectIm(ControlView cv, ParamValue paramValue, Guid?g = null)
 {
     paramValue.ArrayIndexes = cv.LControlView.ArrayIndexes.ToList();
     paramValue.IsArray      = true;
     if (g != null)
     {
         paramValue.Guid = g.Value.ToString();
     }
     paramValue.ArrayElements = new List <ParamValue>();
     foreach (ControlView eleCv in cv.LControlView.Properties)
     {
         paramValue.ArrayElements.Add(CreateArrayItem(eleCv));
     }
 }
示例#31
0
        private static void GetDictinaryItemIm(ControlView cv, ParamValue paramValue)
        {
            Guid g = Guid.NewGuid();

            paramValue.Param.Add(cv.DControlView.FieldName, g.ToString());

            ParamValue paramValueList = new ParamValue {
                Param = new Dictionary <string, string>()
            };

            GetDictionaryObjectIm(cv, paramValueList, g);

            paramValue.GuidValues.Add(paramValueList);
        }
示例#32
0
        protected override void InitializeView()
        {
            base.InitializeView();
            Nodes.StringBuilderNode node = targetNode as Nodes.StringBuilderNode;
            if (node.stringValues == null)
            {
                node.stringValues = new List <MemberData>();
            }
            for (int x = 0; x < node.stringValues.Count; x++)
            {
                int index = x;
                AddInputValuePort(
                    new PortData()
                {
                    portID         = "stringValues#" + x,
                    onValueChanged = (o) => {
                        RegisterUndo();
                        node.stringValues[index] = o as MemberData;
                    },
                    getPortName  = () => "String " + x,
                    getPortType  = () => typeof(string),
                    getPortValue = () => node.stringValues[index],
                }
                    );
            }
            ControlView control = new ControlView();

            control.Add(new Button(() => {
                if (node.stringValues.Count > 0)
                {
                    RegisterUndo();
                    node.stringValues.RemoveAt(node.stringValues.Count - 1);
                    MarkRepaint();
                }
            })
            {
                text = "-"
            });
            control.Add(new Button(() => {
                RegisterUndo();
                node.stringValues.Add(new MemberData(""));
                MarkRepaint();
            })
            {
                text = "+"
            });
            AddControl(Direction.Input, control);
        }
示例#33
0
        private static ControlView GetTypeDetailsDictionaryObject(Type propertyInfo, string fieldName, ParamValue newParamValues, string guid)
        {
            ControlView arrayObject = new ControlView
            {
                IsDictionary = true,
                DControlView = new DictionartControlViewModel
                {
                    FieldName = fieldName,
                    FieldType = propertyInfo.GenericTypeArguments[0],
                    FieldValueType = propertyInfo.GenericTypeArguments[1],
                    AssemblyGuid = guid
                }
            };

            if (newParamValues != null)
            {
                arrayObject.DControlView.DictionaryItemsCount = newParamValues.DictionaryLength;

                for (int i = 0; i < arrayObject.DControlView.DictionaryItemsCount; i++)
                {
                    arrayObject.DControlView.Properties.Add(GetTypeDetails(propertyInfo.GenericTypeArguments[0], guid,
                        newParamValues.DictKeyElements[i]));
                    arrayObject.DControlView.PropertiesValue.Add(GetTypeDetails(propertyInfo.GenericTypeArguments[1], guid,
                        newParamValues.DictValueElements[i]));
                }
            }
            else
            {
                arrayObject.DControlView.BaseTypeProperties = GetTypeDetails(propertyInfo.GenericTypeArguments[0], guid);
                arrayObject.DControlView.BaseValueTypeProperties = GetTypeDetails(propertyInfo.GenericTypeArguments[1], guid);
            }
            return arrayObject;
        }
示例#34
0
	void Awake ()
	{
		Instance = this;
	}
示例#35
0
 private static void GetArrayObjectIm(ControlView cv, ParamValue paramValue, Guid? g = null)
 {
     paramValue.ArrayIndexes = cv.LControlView.ArrayIndexes.ToList();
     paramValue.IsArray = true;
     if (g != null)
     {
         paramValue.Guid = g.Value.ToString();
     }
     paramValue.ArrayElements = new List<ParamValue>();
     foreach (ControlView eleCv in cv.LControlView.Properties)
     {
         paramValue.ArrayElements.Add(CreateArrayItem(eleCv));
     }
 }
示例#36
0
        /// <summary>
        /// Creates Complex object
        /// </summary>
        /// <param name="mParameter">Parameter info</param>
        /// <param name="parameterOrder">parameter order</param>
        /// <param name="guid"></param>
        /// <param name="paramValue">param value object from project</param>
        /// <returns></returns>
        private static ControlView GetComplexObject(ParameterInfo mParameter, int parameterOrder, string guid, ParamValue paramValue = null)
        {
            ObservableCollection<ControlView> parameterPropertiesNew = new ObservableCollection<ControlView>();
            foreach (PropertyInfo pProperty in mParameter.ParameterType.GetProperties())
            {
                if (pProperty.PropertyType.FullName == "System.Runtime.Serialization.ExtensionDataObject")
                    continue;
                parameterPropertiesNew.Add(GetPropertyDetails(pProperty, guid, paramValue));
            }

            var complexObject = new ControlView()
            {
                IsPrimitive = false,
                CControlView = new ComplexControlViewModel()
                {
                    FieldName = mParameter.Name,
                    Properties = parameterPropertiesNew,
                    Order = parameterOrder
                }
            };
            return complexObject;
        }
示例#37
0
 private static void GetComplexItemIm(ParamValue paramValue, ControlView property)
 {
     Guid g = Guid.NewGuid();
     paramValue.Param.Add(property.CControlView.FieldName, g.ToString());
     paramValue.GuidValues.Add(WriteComplexType(property.CControlView.Properties.ToList(), g));
 }
示例#38
0
        /// <summary>
        /// Creates Dictionary object
        /// </summary>
        /// <param name="mParameter">Parameter info</param>
        /// <param name="parameterOrder">parameter order</param>
        /// <param name="paramValue">param value object from project</param>
        /// <returns></returns>
        private static ControlView GetDictionaryObject(ParameterInfo mParameter, int parameterOrder, string guid, ParamValue paramValue = null)
        {
            ControlView arrayObject = new ControlView
            {
                IsDictionary = true,
                DControlView = new DictionartControlViewModel
                {
                    FieldName = mParameter.Name,
                    FieldType = mParameter.ParameterType.GenericTypeArguments[0],
                    FieldValueType = mParameter.ParameterType.GenericTypeArguments[1],
                    Order = parameterOrder,
                    DictionaryItemsCount = paramValue != null ? paramValue.DictionaryLength : 0,
                    BaseTypeProperties = GetTypeDetails(mParameter.ParameterType.GenericTypeArguments[0], guid),
                    BaseValueTypeProperties =
                        GetTypeDetails(mParameter.ParameterType.GenericTypeArguments[1], guid),
                    AssemblyGuid = guid
                }
            };

            for (int i = 0; i < arrayObject.DControlView.DictionaryItemsCount; i++)
            {
                arrayObject.DControlView.Properties.Add(GetTypeDetails(mParameter.ParameterType.GenericTypeArguments[0], guid,
                    paramValue != null ? paramValue.DictKeyElements[i] : null));
                arrayObject.DControlView.PropertiesValue.Add(GetTypeDetails(mParameter.ParameterType.GenericTypeArguments[1], guid,
                    paramValue != null ? paramValue.DictValueElements[i] : null));
            }
            return arrayObject;
        }
示例#39
0
        private static void GetDictinaryItemIm(ControlView cv, ParamValue paramValue)
        {
            Guid g = Guid.NewGuid();
            paramValue.Param.Add(cv.DControlView.FieldName, g.ToString());

            ParamValue paramValueList = new ParamValue { Param = new Dictionary<string, string>() };
            GetDictionaryObjectIm(cv, paramValueList, g);

            paramValue.GuidValues.Add(paramValueList);
        }
示例#40
0
        // Create the standard view onto a regular course, or a single variation of a variation course.
        private static CourseView CreateStandardCourseView(EventDB eventDB, CourseDesignator courseDesignator)
        {
            Course course = eventDB.GetCourse(courseDesignator.CourseId);

            if (QueryEvent.HasVariations(eventDB, courseDesignator.CourseId) && courseDesignator.VariationInfo == null)
                throw new ApplicationException("Cannot create course view without specifying which variation");

            // Get sub-part of the course. firstCourseControls is the first control to process, lastCourseControl is the last one to
            // process, or None if process to the end of the course.
            Id<CourseControl> firstCourseControl, lastCourseControl;
            if (courseDesignator.AllParts) {
                firstCourseControl = course.firstCourseControl;
                lastCourseControl = Id<CourseControl>.None;
            }
            else {
                QueryEvent.GetCoursePartBounds(eventDB, courseDesignator, out firstCourseControl, out lastCourseControl);
            }

            CourseView courseView = new CourseView(eventDB, courseDesignator);
            int ordinal;

            courseView.courseName = course.name;
            courseView.scoreColumn = -1;

            ordinal = 1;
            ordinal = course.firstControlOrdinal;

            // To get the ordinals correct, we get the course control ids for all parts.
            List<Id<CourseControl>> courseControls = QueryEvent.EnumCourseControlIds(eventDB, courseDesignator.WithAllParts()).ToList();
            int index = 0;

            // Increase the ordinal value for each normal control before the first one we're considering.
            while (index < courseControls.Count && courseControls[index] != firstCourseControl) {
                CourseControl courseControl = eventDB.GetCourseControl(courseControls[index]);
                ControlPoint control = eventDB.GetControl(courseControl.control);
                if (control.kind == ControlPointKind.Normal)
                    ++ordinal;
                ++index;
            }

            for (; index < courseControls.Count; ++index) {
                Id<CourseControl> courseControlId = courseControls[index];

                ControlView controlView = new ControlView();
                CourseControl courseControl = eventDB.GetCourseControl(courseControlId);
                ControlPoint control = eventDB.GetControl(courseControl.control);

                controlView.courseControlIds = new[] { courseControlId };
                controlView.controlId = courseControl.control;

                // Set the ordinal number.
                if (control.kind == ControlPointKind.Normal)
                    controlView.ordinal = ordinal++;
                else if (control.kind == ControlPointKind.Start || control.kind == ControlPointKind.MapExchange)
                    controlView.ordinal = 0;
                else
                    controlView.ordinal = -1;

                controlView.joinIndex = -1;

                // Don't show the map exchange for the next part at the end of this part.
                if (courseControlId == lastCourseControl && !courseDesignator.AllParts && control.kind == ControlPointKind.MapExchange) {
                    controlView.hiddenControl = true;
                }

                // Set the legTo array with the next courseControlID. This is later updated
                // to the indices.
                if (index < courseControls.Count - 1 && courseControlId != lastCourseControl) {
                    Id<CourseControl> nextCourseControl = courseControls[index + 1];
                    controlView.legTo = new int[1] { nextCourseControl.id };   // legTo initially holds course control ids, later changed.
                }
                // Add the controlview.
                courseView.controlViews.Add(controlView);

                if (courseControlId == lastCourseControl)
                    break;
            }

            // If this is a part that should also have the finish on it, and it isn't the last part, then
            // add the finish.
            if (courseDesignator.IsNotAllControls && !courseDesignator.AllParts &&
                courseDesignator.Part != QueryEvent.CountCourseParts(eventDB, courseDesignator.CourseId) - 1 &&
                QueryEvent.GetPartOptions(eventDB, courseDesignator).ShowFinish)
            {
                if (QueryEvent.HasFinishControl(eventDB, courseDesignator.CourseId))
                    courseView.extraCourseControls.Add(QueryEvent.LastCourseControl(eventDB, courseDesignator.CourseId, false));
            }

            courseView.Finish();
            return courseView;
        }
示例#41
0
        private static void GetDictionaryObjectIm(ControlView cv, ParamValue paramValue, Guid? g = null)
        {
            paramValue.DictionaryLength = cv.DControlView.DictionaryItemsCount;
            paramValue.IsDictionary = true;
            if (g != null)
            {
                paramValue.Guid = g.Value.ToString();
            }

            foreach (ControlView eleCv in cv.DControlView.Properties)
            {
                paramValue.DictKeyElements.Add(CreateArrayItem(eleCv));
            }
            foreach (ControlView eleCv in cv.DControlView.PropertiesValue)
            {
                paramValue.DictValueElements.Add(CreateArrayItem(eleCv));
            }
        }
示例#42
0
 /// <summary>
 /// Creates Primitive object
 /// </summary>
 /// <param name="mParameter">Parameter info</param>
 /// <param name="parameterOrder">parameter order</param>
 /// <param name="guid"></param>
 /// <param name="paramValue">param value object from project</param>
 /// <returns></returns>
 private static ControlView GetPrimitiveObject(ParameterInfo mParameter, int parameterOrder, string guid, ParamValue paramValue = null)
 {
     var primitiveObject = new ControlView()
     {
         IsPrimitive = true,
         PControlView = new PrimitiveControlViewModel()
         {
             FieldName = mParameter.Name,
             FieldValue = paramValue != null ?
                 (paramValue.Param.ContainsKey("value") ? paramValue.Param["value"] : string.Empty) : string.Empty,
             Order = parameterOrder,
             FieldType = mParameter.ParameterType,
             AssemblyGuid = guid
         }
     };
     return primitiveObject;
 }
    void Start()
    {
        InitButtonLink();
		m_controlView = ControlView.Instance;
    }
示例#44
0
        private static ParamValue CreateArrayItem(ControlView cv, Guid? gf = null)
        {
            ParamValue paramValue = new ParamValue
            {
                ArrayElements = new List<ParamValue>(),
                Param = new Dictionary<string, string>()
            };
            if (gf != null)
            {
                paramValue.Guid = gf.Value.ToString();
            }
            if (cv.IsDictionary)
            {
                paramValue.Order = cv.DControlView.Order;

                GetDictinaryItemIm(cv, paramValue);
            }
            else if (cv.IsList)
            {
                paramValue.Order = cv.LControlView.Order;

                GetArrayItemIm(cv, paramValue);
            }
            else if (cv.IsPrimitive)
            {
                paramValue.Order = cv.PControlView.Order;
                paramValue.Param.Add("value", cv.PControlView.FieldValue);
            }
            else
            {
                paramValue.Order = cv.CControlView.Order;
                foreach (var property in cv.CControlView.Properties)
                {
                    if (property.IsDictionary)
                    {
                        GetDictinaryItemIm(property, paramValue);
                    }
                    else if (property.IsList)
                    {
                        GetArrayItemIm(property, paramValue);
                    }
                    else if (property.IsPrimitive)
                    {
                        paramValue.Param.Add(property.PControlView.FieldName, property.PControlView.FieldValue);
                    }
                    else
                    {
                        GetComplexItemIm(paramValue, property);
                    }
                }
            }
            return paramValue;
        }
示例#45
0
        /// <summary>
        /// Creates Dictionary object
        /// </summary>
        /// <param name="mParameter">Parameter info</param>
        /// <param name="parameterOrder">parameter order</param>
        /// <param name="paramValue">param value object from project</param>
        /// <returns></returns>
        private static ControlView GetArrayObject(ParameterInfo mParameter, int parameterOrder, string guid, ParamValue paramValue = null)
        {
            int dimensions = mParameter.ParameterType.FullName.Split(new[] { "[]" }, StringSplitOptions.None).Length - 1;
            Type arrayBaseType = mParameter.ParameterType.GetElementType();
            for (int ii = 1; ii < dimensions; ii++)
            {
                arrayBaseType = arrayBaseType.GetElementType();
            }

            ControlView arrayObject = new ControlView
            {
                IsList = true,
                LControlView = new ListControlViewModel
                {
                    FieldName = mParameter.Name,
                    FieldType = arrayBaseType,
                    Order = parameterOrder,
                    BaseTypeProperties = GetTypeDetails(arrayBaseType, guid),
                    AssemblyGuid = guid
                }
            };

            //for existing item, i.e. for value select from values list
            if (paramValue != null)
            {
                arrayObject.LControlView.ArrayIndexes = new BindingList<IntWrappper>(paramValue.ArrayIndexes);
                int totalElementsInList = arrayObject.LControlView.ArrayIndexes.Aggregate(1, (current, iw) => current * iw.Int);

                for (int i = 0; i < totalElementsInList; i++)
                {
                    arrayObject.LControlView.Properties.Add(GetTypeDetails(arrayBaseType, guid, paramValue.ArrayElements[i]));
                }
            }
            else
            {
                //for new object creation
                for (int ai = 0; ai < dimensions; ai++)
                {
                    arrayObject.LControlView.ArrayIndexes.Add(new IntWrappper()
                    {
                        Int = 0
                    });
                }
            }
            return arrayObject;
        }
示例#46
0
        // Create the normal view onto a score course
        private static CourseView CreateScoreCourseView(EventDB eventDB, CourseDesignator courseDesignator)
        {
            Course course = eventDB.GetCourse(courseDesignator.CourseId);
            CourseView courseView = new CourseView(eventDB, courseDesignator);
            Id<CourseControl> courseControlId;

            courseView.courseName = course.name;
            courseView.scoreColumn = course.scoreColumn;

            courseControlId = course.firstCourseControl;

            while (courseControlId.IsNotNone) {
                ControlView controlView = new ControlView();
                CourseControl courseControl = eventDB.GetCourseControl(courseControlId);

                controlView.courseControlIds = new[] { courseControlId };
                controlView.controlId = courseControl.control;

                // Ordinals assigned after sorting.
                controlView.ordinal = -1;

                controlView.joinIndex = -1;

                // Move to the next control.
                courseView.controlViews.Add(controlView);
                courseControlId = courseControl.nextCourseControl;
            }

            // Sort the control views: first by kind, then by score, then by code.
            courseView.controlViews.Sort(delegate(ControlView view1, ControlView view2) {
                ControlPoint control1 = eventDB.GetControl(view1.controlId);
                ControlPoint control2 = eventDB.GetControl(view2.controlId);
                CourseControl courseControl1 = eventDB.GetCourseControl(view1.courseControlIds[0]);
                CourseControl courseControl2 = eventDB.GetCourseControl(view2.courseControlIds[0]);

                if (control1.kind < control2.kind)
                    return -1;
                else if (control1.kind > control2.kind)
                    return 1;

                if (courseControl1.points != courseControl2.points)
                    return courseControl1.points.CompareTo(courseControl2.points);
                int result = Util.CompareCodes(control1.code, control2.code);
                if (result != 0)
                    return result;

                return view1.controlId.id.CompareTo(view2.controlId.id);
            });

            // Assign ordinals, if applicable. If scores in column A, then no ordinals will be assigned.
            if (courseView.scoreColumn != 0) {
                int ordinal = course.firstControlOrdinal;
                foreach (ControlView control in courseView.controlViews) {
                    if (eventDB.GetControl(control.controlId).kind == ControlPointKind.Normal)
                        control.ordinal = ordinal++;
                }
            }

            courseView.Finish();
            return courseView;
        }
示例#47
0
        // Create the view of all variations of a course with variations. Cannot be a single part of a multi-part course.
        // Does not contain ordinals.
        private static CourseView CreateAllVariationsCourseView(EventDB eventDB, CourseDesignator courseDesignator)
        {
            Course course = eventDB.GetCourse(courseDesignator.CourseId);

            if (!courseDesignator.AllParts)
                throw new ApplicationException("Cannot create all variations of a single part");

            CourseView courseView = new CourseView(eventDB, courseDesignator);

            courseView.courseName = course.name;
            courseView.scoreColumn = -1;

            // To get the ordinals correct, we get the course control ids for all parts.
            List<Id<CourseControl>> courseControls = QueryEvent.EnumCourseControlIds(eventDB, courseDesignator).ToList();

            for (int index = 0; index < courseControls.Count; ++index) {
                Id<CourseControl> courseControlId = courseControls[index];
                CourseControl courseControl = eventDB.GetCourseControl(courseControlId);

                // We add each split control only once, even though it has multiple variations. Check to see if we have already
                // handled it.
                bool alreadyHandled = false;
                if (courseControl.split) {
                    foreach (ControlView cv in courseView.controlViews) {
                        if (cv.courseControlIds.Contains(courseControlId))
                            alreadyHandled = true;
                    }
                }

                if (!alreadyHandled) {
                    ControlView controlView = new ControlView();

                    controlView.controlId = courseControl.control;

                    // Set the ordinal number. All variations does not include an ordinal.
                    controlView.ordinal = -1;

                    // Set all course control ids associated with split control, or a single one for a non-split control.
                    // Set the legTo array with the next courseControlID(s). This is later updated
                    // to the indices.
                    if (courseControl.split) {
                        controlView.courseControlIds = QueryEvent.AllVariationsOfCourseControl(eventDB, courseControlId).ToArray();
                        if (courseControl.nextCourseControl.IsNotNone) {
                            controlView.legTo = new int[controlView.courseControlIds.Length];
                            for (int i = 0; i < controlView.legTo.Length; ++i) {
                                controlView.legTo[i] = eventDB.GetCourseControl(controlView.courseControlIds[i]).nextCourseControl.id;
                            }
                        }
                        if (courseControl.loop)
                            controlView.joinIndex = courseControlId.id;
                        else
                            controlView.joinIndex = courseControl.splitEnd.id;
                    }
                    else {
                        controlView.courseControlIds = new[] { courseControlId };
                        if (courseControl.nextCourseControl.IsNotNone)
                            controlView.legTo = new int[1] { courseControl.nextCourseControl.id };   // legTo initially holds course control ids, later changed.
                        controlView.joinIndex = -1;
                    }

                    // Add the controlview.
                    courseView.controlViews.Add(controlView);
                }
            }

            courseView.Finish();
            return courseView;
        }
示例#48
0
        // Create an filtered All Controls view -- show controls from the control collection, but only includes some.
        // excludedCourses contains an array of course ids to excluded from the contgrols.
        // kindFilter, if non-null, limits the controls to this kind of controls.
        public static CourseView CreateFilteredAllControlsView(EventDB eventDB, CourseDesignator[] excludedCourses, ControlPointKind kindFilter, bool addSpecials, bool addDescription)
        {
            CourseView courseView = new CourseView(eventDB, CourseDesignator.AllControls);

            courseView.courseName = MiscText.AllControls;
            courseView.scoreColumn = -1;

            // Add every control to the course view, subject to the filters.
            foreach (Id<ControlPoint> controlId in eventDB.AllControlPointIds) {
                ControlPoint control = eventDB.GetControl(controlId);

                // Check if the control is filtered out.

                if (excludedCourses != null) {
                    // Filter excluded courses.
                    foreach (CourseDesignator excludedCourseDesignator in excludedCourses) {
                        if (QueryEvent.CourseUsesControl(eventDB, excludedCourseDesignator, controlId))
                            goto SKIP;
                    }
                }

                if (kindFilter != ControlPointKind.None) {
                    // Filter on control type.
                    if (control.kind != kindFilter)
                        goto SKIP;
                }

                // We are going to include this control in the collection.

                ControlView controlView = new ControlView();

                controlView.courseControlIds = new[] { Id<CourseControl>.None };
                controlView.controlId = controlId;

                // All controls doesn't have ordinals.
                controlView.ordinal = -1;

                controlView.joinIndex = -1;

                courseView.controlViews.Add(controlView);

               SKIP:        ;
            }

            // Sort the control views: first by kind, then by code.
            courseView.controlViews.Sort((view1, view2) => QueryEvent.CompareControlIds(eventDB, view1.controlId, view2.controlId));

            courseView.Finish();

            if (addSpecials) {
                // Add every special, regardless of courses it is on, except for descriptions. Descriptions are added to all
                // controls only if they appear in all courses (or specifically for the all controls view), and if "addDescription" is true
                foreach (Id<Special> specialId in eventDB.AllSpecialIds) {
                    Special special = eventDB.GetSpecial(specialId);
                    if (special.kind == SpecialKind.Descriptions) {
                        if (addDescription && QueryEvent.CourseContainsSpecial(eventDB, CourseDesignator.AllControls, specialId))
                            courseView.descriptionViews.Add(new DescriptionView(specialId, CourseDesignator.AllControls));
                    }
                    else
                        courseView.specialIds.Add(specialId);
                }
            }

            return courseView;
        }
示例#49
0
        private static ControlView GetTypeDetailsArrayObject(string fieldName, Type arrayBaseType, ParamValue newParamValues,
            int dimensions, string guid)
        {
            ControlView arrayObject = new ControlView
            {
                IsList = true,
                LControlView = new ListControlViewModel
                {
                    FieldName = fieldName,
                    FieldType = arrayBaseType,
                    BaseTypeProperties = GetTypeDetails(arrayBaseType, guid),
                    AssemblyGuid = guid
                }
            };

            if (newParamValues != null)
            {
                arrayObject.LControlView.ArrayIndexes = new BindingList<IntWrappper>(newParamValues.ArrayIndexes);
                int totalElementsInList = arrayObject.LControlView.ArrayIndexes.Aggregate(1, (current, iw) => current * iw.Int);

                for (int i = 0; i < totalElementsInList; i++)
                {
                    arrayObject.LControlView.Properties.Add(GetTypeDetails(arrayBaseType, guid, newParamValues.ArrayElements[i]));
                }
            }
            else
            {
                for (int ai = 0; ai < dimensions; ai++)
                {
                    arrayObject.LControlView.ArrayIndexes.Add(new IntWrappper()
                    {
                        Int = 0
                    });
                }
            }
            return arrayObject;
        }
示例#50
0
        private void SwitchActiveView(ControlView controlView)
        {
            try
            {
                mInboxView.Visible = (ControlView.Inbox == controlView);
                mOutboxView.Visible = (ControlView.Outbox == controlView);
                mComposeMessageView.Visible = (ControlView.ComposeMessage == controlView);
                mRecordingView.Visible = (ControlView.RecordingAudio == controlView);

                //set accept button

                switch (controlView)
                {
                    case ControlView.ComposeMessage:
                        OnAcceptButtonChanged(mComposeMessageView.buttonTalk, new EventArgs());
                        break;
                    case ControlView.Inbox:
                        OnAcceptButtonChanged(null, new EventArgs());
                        break;
                    case ControlView.Outbox:
                        OnAcceptButtonChanged(null, new EventArgs());
                        break;
                    case ControlView.RecordingAudio:
                        OnAcceptButtonChanged(mRecordingView.buttonStop, new EventArgs());
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
#if TRACE
                Console.WriteLine(" SwitchActiveView " + ex.Message);
#endif

            }
        }
示例#51
0
 private static ControlView GetTypeDetailPrimitiveObject(Type fieldType, string fieldName, bool isNullableType, string value, string guid)
 {
     ControlView cv = new ControlView { IsPrimitive = true };
     if (isNullableType)
     {
         cv.PControlView = new PrimitiveControlViewModel()
         {
             FieldName = fieldName,
             FieldValue = value,
             FieldType = Nullable.GetUnderlyingType(fieldType),
             AssemblyGuid = guid
         };
     }
     else
     {
         cv.PControlView = new PrimitiveControlViewModel()
         {
             FieldName = fieldName,
             FieldValue = value,
             FieldType = fieldType,
             AssemblyGuid = guid
         };
     }
     return cv;
 }
示例#52
0
 private static ControlView GetTypeDetailComplexObject(Type propertyInfo, string guid, ParamValue newParamValues = null, string fieldName = null)
 {
     ObservableCollection<ControlView> parameterPropertiesNew = new ObservableCollection<ControlView>();
     foreach (PropertyInfo pProperty in propertyInfo.GetProperties())
     {
         if (pProperty.PropertyType.FullName == "System.Runtime.Serialization.ExtensionDataObject")
             continue;
         parameterPropertiesNew.Add(GetPropertyDetails(pProperty, guid, newParamValues));
     }
     ControlView cv1 = new ControlView()
     {
         IsPrimitive = false,
         CControlView = new ComplexControlViewModel()
         {
             FieldName = !string.IsNullOrEmpty(fieldName) ? fieldName : propertyInfo.Name,
             Properties = parameterPropertiesNew
         }
     };
     return cv1;
 }
        public ListControlGridViewModel(ObservableCollection<ControlView> properties,
            BindingList<IntWrappper> arrayIndexes,
            Type fieldType,
            ControlView baseTypeProperties
            )
        {
            Properties = properties;
            ArrayIndexes = arrayIndexes;
            FieldType = fieldType;
            _baseTypeProperties = baseTypeProperties;

            int x = 1;
            if (ArrayIndexes.Count == 1) x = 1;
            else if (ArrayIndexes.Count > 1)
            {
                for (var i = 0; i < ArrayIndexes.Count - 1; i++)
                {
                    x = x * ArrayIndexes[i].Int;
                }
            }
            int y = ArrayIndexes[ArrayIndexes.Count - 1].Int;

            _listOfListItemGrid = new List<List<ArrayItem>>();

            int totalElementsInList = arrayIndexes.Aggregate(1, (current, iw) => current * iw.Int);
            if (Properties.Count < totalElementsInList)
            {
                for (int i = Properties.Count; i < totalElementsInList; i++)
                {
                    Properties.Add(Controller.DeepCopy(_baseTypeProperties));
                }
            }

            var indexCount = 0;
            List<ArrayItem> l = new List<ArrayItem>();
            List<int> arrayIndexesInt = arrayIndexes.Select(o => o.Int).ToList();
            for (var j = 0; j < x * y; j++)
            {
                if (j % y == 0)
                {
                    l = new List<ArrayItem>();
                    _listOfListItemGrid.Add(l);
                }

                List<int> indexes = new List<int>();

                for (int ir = 0; ir < arrayIndexesInt.Count; ir++)
                {
                    TestHelper.GetArrayIndexesFromLinearIndex(arrayIndexesInt, ir, indexes, j);
                }

                l.Add(new ArrayItem()
                {
                    Index = Convert.ToString(indexCount),
                    DisplayIndex = string.Join(",", indexes.ToArray())
                });
                indexCount++;
            }

            NotifyOfPropertyChange(() => ListOfListItemGrid);
        }
示例#54
0
        private void SwitchActiveView(ControlView controlView)
        {
            mInboxView.Visible = ControlView.Inbox == controlView;
            mOutboxView.Visible = ControlView.Outbox == controlView;
            mComposeMessageView.Visible = ControlView.ComposeMessage == controlView;
            mRecordingView.Visible = ControlView.RecordingAudio == controlView;

            //set accept button

            switch (controlView)
            {
                case ControlView.ComposeMessage:
                    OnAcceptButtonChanged(mComposeMessageView.buttonTalk, new EventArgs());
                    break;
                case ControlView.Inbox:
                    OnAcceptButtonChanged(null,new EventArgs());
                    break;
                case ControlView.Outbox:
                    OnAcceptButtonChanged(null, new EventArgs());
                    break;
                case ControlView.RecordingAudio:
                    OnAcceptButtonChanged(mRecordingView.buttonStop, new EventArgs());
                    break;
                default:
                    break;
            }
        }