public static Branches TableToBranch(DataTable table, Branch.Includes includes) { if (table == null) { return(null); } Branches branches = new Branches(); var branchList = table.AsEnumerable().GroupBy(row => DataRowHelper.GetValue <int>(row, Tables.Branches.Id.FullName), (key, group) => RowToBranch(group, includes)); branches.AddRange(branchList.ToList()); return(branches); }
public void Maintenance(int level, Token token) { if (HaveChildrenForMaintenance) { MaintenanceHelper[] helpers = new MaintenanceHelper[Branches.Count]; for (int index = Branches.Count - 1; index >= 0; index--) { helpers[index] = new MaintenanceHelper(level, token, helpers, Branches[index], index); } Branches.Clear(); for (int index = 0; index < helpers.Length; index++) { var helper = helpers[index]; helper.Task.Wait(); Branches.AddRange(helper.List); } RebuildOptimizator(); HaveChildrenForMaintenance = false; IsModified = true; } //sink branches int operationCount = Branches.Sum(x => x.Value.Cache.OperationCount); if (operationCount > Branch.Tree.MAX_OPERATIONS) { //Debug.WriteLine(string.Format("{0}: {1} = {2}", level, Branch.NodeHandle, operationCount)); foreach (var kv in Branches.Where(x => x.Value.Cache.OperationCount > 0).OrderByDescending(x => x.Value.Cache.OperationCount)) { Branch branch = kv.Value; operationCount -= branch.Cache.OperationCount; if (branch.Fall(level, token, new Params(WalkMethod.Current, WalkAction.None, null, true))) { IsModified = true; } if (operationCount <= Branch.Tree.MIN_OPERATIONS) { break; } //branch.WaitFall(); } } }
private void GetBranches() { using (var unitOfWork = new UnitOfWork()) { if (!Branches.Any()) { Branches.Clear(); Branches.Add(new Branch() { branch_name = "" }); Branches.AddRange(unitOfWork.BranchRepository.GetAll()); } branchBindingSource.DataSource = Branches; } }
public void NavigatedTo(string path, byte[] idl, int hash, bool autoNav) { if ((idl == null) || (idl.Length == 0)) { idl = ShellMethods.GetIDLData(path); } if (autoNav && stckHistoryBackward.Count > 0 && stckHistoryBackward.Peek().AutoNav) { stckHistoryBackward.Pop(); } stckHistoryBackward.Push(new LogData(path, idl, hash, autoNav)); Branches.AddRange(stckHistoryForward.Except(Branches)); foreach (LogData data2 in stckHistoryBackward) { Branches.Remove(data2); } stckHistoryForward.Clear(); CurrentPath = path; CurrentIDL = idl; }
public void AddRange(IEnumerable <Branch> branches) { Branches.AddRange(branches); }