Пример #1
0
        public void Sort(ProcessSort sort, bool reverse = false)
        {
            List <ProcessConfig> sorted = List.ToList();

            switch (sort)
            {
            case ProcessSort.Name:
                sorted.Sort(delegate(ProcessConfig c1, ProcessConfig c2) { return(c1.ProcessName.CompareTo(c2.ProcessName)); });
                break;

            case ProcessSort.Priority:
                sorted.Sort(delegate(ProcessConfig c1, ProcessConfig c2) { return(c1.Priority.CompareTo(c2.Priority)); });
                break;

            case ProcessSort.System:
                sorted.Sort(delegate(ProcessConfig c1, ProcessConfig c2) { return(c1.System.CompareTo(c2.System)); });
                break;
            }

            List.Clear();

            if (reverse)
            {
                sorted.Reverse();
            }

            foreach (var v in sorted)
            {
                List.Add(v);
            }
        }
        public IGenericProcess GetGenericProcess(ProcessType processType)
        {
            IGenericProcess genericProcess = null;

            switch (processType)
            {
            case ProcessType.Buffer:
                genericProcess = new ProcessBuffer();
                break;

            case ProcessType.CircularBuffer:
                genericProcess = new ProcessCircularBuffer();
                break;

            case ProcessType.Array:
                genericProcess = new ProcessArray();
                break;

            case ProcessType.List:
                genericProcess = new ProcessList();
                break;

            case ProcessType.Queue:
                genericProcess = new ProcessQueue();
                break;

            case ProcessType.Stack:
                genericProcess = new ProcessStack();
                break;

            case ProcessType.HashSet:
                genericProcess = new ProcessHashSet();
                break;

            case ProcessType.LinkedList:
                genericProcess = new ProcessLinkedList();
                break;

            case ProcessType.Dictionary:
                genericProcess = new ProcessDictionary();
                break;

            case ProcessType.Sort:
                genericProcess = new ProcessSort();
                break;

            case ProcessType.ComparingEmployees:
                genericProcess = new ProcessComparingEmployees();
                break;

            case ProcessType.Delegates:
                genericProcess = new ProcessDelegates();
                break;

            case ProcessType.Constraints:
                genericProcess = new ProcessConstraints();
                break;

            case ProcessType.GenericMethods:
                genericProcess = new ProcessGenericMethods();
                break;

            case ProcessType.IocContainer:
                genericProcess = new ProcessIocContainer();
                break;

            case ProcessType.GenericEnum:
                genericProcess = new ProcessGenericEnum();
                break;

            case ProcessType.BaseTypes:
                genericProcess = new ProcessBaseTypes();
                break;

            case ProcessType.GenericStatics:
                genericProcess = new ProcessGenericStatics();
                break;

            default:
                break;
            }
            return(genericProcess);
        }