예제 #1
0
        public void LoadOptions(string taskId, IEnumerable <PropertyItem> properties, CoreDispatcher dispatcher)
        {
            var hasOptionsProps = properties.Where(p => _hasOptionControls.Contains(p.Control));

            Parallel.ForEach(hasOptionsProps, async property =>
            {
                string uri             = $"api/mission-vnext/tasks/{taskId}/properties/{property.PropertyId}/options";
                var data               = await WtHttpClient.GetAsync <ApiMissionVnexTaskProperties>(uri);
                var dataSource         = new List <DropdownItem>();
                IPropertyReader reader = null;
                switch (property.Control)
                {
                case "Priority":
                    reader = new PriorityReader();
                    break;

                case "ComboBox":
                    reader = new ComboBoxReader();
                    break;

                case "CheckBox":
                    reader = new CheckBoxReader();
                    break;

                case "Tag":
                    reader = new TagReader();
                    break;
                }
                if (reader != null)
                {
                    await reader.LoadOptionsAsync(property, data.Data.Value, dispatcher);
                }
            });
        }
예제 #2
0
        public IEnumerable <PropertyItem> Read(Data task)
        {
            foreach (var prop in task.References.Properties)
            {
                if (!_ignorePropertyKeys.Contains(prop.RawKey))
                {
                    var item = new PropertyItem
                    {
                        Header = prop.Name,
                    };
                    IPropertyReader reader = null;
                    switch (prop.Type)
                    {
                    case WtTaskPropertyType.Text:
                    case WtTaskPropertyType.Number:
                        reader = new TextBoxReader();
                        break;

                    case WtTaskPropertyType.Priority:
                        reader = new PriorityReader();
                        break;

                    case WtTaskPropertyType.DropDown:
                    case WtTaskPropertyType.Iteration:
                        reader = new ComboBoxReader();
                        break;

                    case WtTaskPropertyType.MultiSelect:
                        reader = new CheckBoxReader();
                        break;

                    case WtTaskPropertyType.Tag:
                        reader = new TagReader();
                        break;

                    case WtTaskPropertyType.DateTime:
                        reader = new DateTimeReader();
                        break;

                    case WtTaskPropertyType.DateSpan:
                        reader = new DateSpanReader();
                        break;
                    }
                    if (reader != null)
                    {
                        reader.Read(prop, item, task);
                        item.Control = reader.Control;
                        yield return(item);
                    }
                }
            }
        }