Ejemplo n.º 1
0
        private async void _add_Click(object sender, EventArgs e)
        {
            var connector = DevOpsManager.GetConnector(_model);

            if (connector != null)
            {
                var fieldsAsync = await connector.GetWorkItemDevOpsFieldsAsync();

                var fields = fieldsAsync?.ToArray();
                if (fields?.Any() ?? false)
                {
                    var dialog = new FieldAssociationDialog();
                    dialog.Initialize(_model, fields);
                    if (dialog.ShowDialog(this) == DialogResult.OK)
                    {
                        var field         = dialog.Field;
                        var identityField = dialog.IdentityField;
                        if (field != null && identityField != null)
                        {
                            connector.SetWorkItemFieldMapping(field, identityField);
                            var row = new GridRow(field.Label, identityField)
                            {
                                Tag = field
                            };
                            _gridFields.PrimaryGrid.Rows.Add(row);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private async Task <KeyValuePair <IDevOpsField, IdentityField> > ManageField(IDevOpsField field, IdentityField identityField)
        {
            KeyValuePair <IDevOpsField, IdentityField> result = new KeyValuePair <IDevOpsField, IdentityField>(null, null);

            var connector = DevOpsManager.GetConnector(_model);

            if (connector != null)
            {
                var fieldsAsync = await connector.GetWorkItemDevOpsFieldsAsync();

                var fields = fieldsAsync?.ToArray();
                if (fields?.Any() ?? false)
                {
                    var dialog = new FieldAssociationDialog();
                    dialog.Initialize(_model, fields);
                    if (field != null && identityField != null)
                    {
                        dialog.SetField(field, identityField);
                    }
                    if (dialog.ShowDialog(this) == DialogResult.OK)
                    {
                        field         = dialog.Field;
                        identityField = dialog.IdentityField;
                        if (field != null && identityField != null)
                        {
                            connector.SetWorkItemFieldMapping(field, identityField);
                            DevOpsManager.UpdateConfig(_model);
                            result = new KeyValuePair <IDevOpsField, IdentityField>(field, identityField);
                        }
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        private async void FieldButtonClick(object sender, EventArgs e)
        {
            if (sender is GridButtonXEditControl bc &&
                bc.EditorCell is GridCell cell &&
                cell.GridRow is GridRow row &&
                row.Tag is IDevOpsField field &&
                cell.Value is IdentityField identityField)
            {
                var connector = DevOpsManager.GetConnector(_model);
                if (connector != null)
                {
                    var fieldsAsync = await connector.GetWorkItemDevOpsFieldsAsync();

                    var fields = fieldsAsync?.ToArray();
                    if (fields?.Any() ?? false)
                    {
                        var dialog = new FieldAssociationDialog();
                        dialog.Initialize(_model, fields);
                        dialog.SetField(field, identityField);
                        if (dialog.ShowDialog(this) == DialogResult.OK)
                        {
                            connector.SetWorkItemFieldMapping(field, null);
                            field         = dialog.Field;
                            identityField = dialog.IdentityField;
                            if (field != null && identityField != null)
                            {
                                connector.SetWorkItemFieldMapping(field, identityField);
                                row.Cells["Field"].Value = field.Label;
                                cell.Value = identityField;
                                row.Tag    = field;
                            }
                        }
                    }
                }
            }
        }