Exemple #1
0
        public AimpActionResult <IAimpGroupingTreeDataProviderSelection> GetData(IAimpGroupingTreeSelection selection)
        {
            IAimpGroupingTreeDataProviderSelection data = null;

            var valueResult = selection.GetValue(0);

            if (valueResult.ResultType == ActionResultType.OK)
            {
                try
                {
                    object outValue = valueResult.Item2;

                    if (!string.IsNullOrWhiteSpace(outValue?.ToString()))
                    {
                        var pathParts = outValue.ToString().Split(new[] { "\\" }, StringSplitOptions.RemoveEmptyEntries);
                        var category  =
                            (DataStorageCategoryType)Enum.Parse(typeof(DataStorageCategoryType), pathParts[1]);
                        data = new DataProviderGroupingTreeSelection(_dataProviders[category](outValue.ToString()));
                        return(new AimpActionResult <IAimpGroupingTreeDataProviderSelection>(ActionResultType.OK, data));
                    }
                }
                catch (Exception)
                {
                    return(new AimpActionResult <IAimpGroupingTreeDataProviderSelection>(ActionResultType.Fail, null));
                }
            }

            data = new DataProviderGroupingTreeSelection(PopulateRoot());

            return(new AimpActionResult <IAimpGroupingTreeDataProviderSelection>(ActionResultType.OK, data));
        }
Exemple #2
0
        public AimpActionResult AppendFilter(IAimpDataFilterGroup filter, IAimpGroupingTreeSelection selection)
        {
            filter.BeginUpdate();
            try
            {
                filter.Operation = FilterGroupOperationType.And;
                for (var i = 0; i < selection.GetCount(); i++)
                {
                    var selectionResult = selection.GetValue(i);
                    if (selectionResult.ResultType == ActionResultType.OK)
                    {
                        string fName  = selectionResult.Item1;
                        object fValue = selectionResult.Item2;

                        IAimpDataFieldFilter fFilter;
                        fValue = fValue.ToString()
                                 .Replace($"MyComputer\\{DataStorageCategoryType.LocalDisks}\\", string.Empty)
                                 .Replace($"MyComputer\\{DataStorageCategoryType.Other}\\", string.Empty);
                        var result = filter.Add(fName, fValue, null, FieldFilterOperationType.Equals);
                        fFilter = result.Result;
                    }
                }
            }
            finally
            {
                filter.EndUpdate();
            }

            return(new AimpActionResult(ActionResultType.OK));
        }
Exemple #3
0
        public AimpActionResult <IAimpGroupingTreeDataProviderSelection> GetData(IAimpGroupingTreeSelection selection)
        {
            IAimpGroupingTreeDataProviderSelection data = null;

            var count = selection.GetCount();

            if (count > 0)
            {
                var r = selection.GetValue(0);
                if (r.ResultType == ActionResultType.OK)
                {
                    return(new AimpActionResult <IAimpGroupingTreeDataProviderSelection>(ActionResultType.OK, data));
                }
            }

            data = new CustomAimpGroupingTreeDataProviderSelection();

            return(new AimpActionResult <IAimpGroupingTreeDataProviderSelection>(ActionResultType.OK, data));
        }
Exemple #4
0
 public AimpActionResult AppendFilter(IAimpDataFilterGroup filter, IAimpGroupingTreeSelection selection)
 {
     return(new AimpActionResult(ActionResultType.NotImplemented));
 }