protected override void InitializeBindData() { Action Initialize = () => { var allsheeps = this.Service.GetSheepBind(null); SheepBind defaultSheep = new SheepBind { SerialNumber = defaultSelection }; var breeds = this.Service.GetBreedBind(); this.UIDispatcher.Invoke(new Action(() => { this.Sheeps.Clear(); this.Sheeps.Add(defaultSheep); allsheeps.ForEach(s => this.Sheeps.Add(s)); this.Breeds.Clear(); this.Breeds.Add(new BreedBind { Name = defaultSelection }); breeds.ForEach(b => this.Breeds.Add(b)); this.Reset(); }), DispatcherPriority.Send, null); }; if (!this.IsInDesignMode) { Initialize.BeginInvoke(ar => Initialize.EndInvoke(ar as IAsyncResult), Initialize); } }
protected override void InitializeBindItem() { this.studSheeps = this.Service.GetStudSheepBindWithOuter(); List <BreedBind> breeds = null; List <SheepfoldBind> sheepfolds = null; List <EmployeeBind> principals = null; if (!this.isContinue) { breeds = this.Service.GetBreedBind(); sheepfolds = this.Service.GetSheepfoldBind(); principals = this.Service.GetEmployeeBind(); } this.UIDispatcher.Invoke(new Action(() => { SheepBind defaultSheep = new SheepBind { SerialNumber = defaultSelection }; this.Fathers.Clear(); this.Mothers.Clear(); this.Fathers.Add(defaultSheep); this.Mothers.Add(defaultSheep); this.studSheeps.ForEach(s => { if (s.Gender == GenderEnum.Male) { this.Fathers.Add(s); } else { this.Mothers.Add(s); } }); if (this.isContinue) { return; } this.Breeds.Add(new BreedBind { Name = defaultSelection }); breeds.ForEach(b => this.Breeds.Add(b)); this.Sheepfolds.Add(new SheepfoldBind { Name = defaultSelection }); sheepfolds.ForEach(sf => this.Sheepfolds.Add(sf)); this.Principals.Add(new EmployeeBind { Name = defaultSelection }); principals.ForEach(p => this.Principals.Add(p)); }), null); }
protected override void InitializeBindData() { Action Initialize = () => { var allsheeps = this.Service.GetSheepBind(null); var studSheeps = this.Service.GetSheepParentBind(null); SheepBind defaultSheep = new SheepBind { SerialNumber = defaultSelection }; var breeds = this.Service.GetBreedBind(); var sheepfolds = this.Service.GetSheepfoldBind(); var principals = this.Service.GetAllEmployeeBind(); var operators = this.Service.GetUserBind(); this.UIDispatcher.Invoke(new Action(() => { this.Sheeps.Clear(); this.Sheeps.Add(defaultSheep); this.Fathers.Clear(); this.Fathers.Add(defaultSheep); this.Mothers.Clear(); this.Mothers.Add(defaultSheep); allsheeps.ForEach(s => { this.Sheeps.Add(s); }); studSheeps.ForEach(s => { if (s.Gender == GenderEnum.Male) { this.Fathers.Add(s); } else { this.Mothers.Add(s); } }); this.Breeds.Clear(); this.Breeds.Add(new BreedBind { Name = defaultSelection }); breeds.ForEach(b => this.Breeds.Add(b)); this.Sheepfolds.Clear(); this.Sheepfolds.Add(new SheepfoldBind { Name = defaultSelection }); sheepfolds.ForEach(sf => this.Sheepfolds.Add(sf)); this.Principals.Clear(); this.Principals.Add(new EmployeeBind { Name = defaultSelection }); principals.ForEach(p => this.Principals.Add(p)); this.Operators.Clear(); this.Operators.Add(new UserBind { UserName = defaultSelection }); operators.ForEach(o => this.Operators.Add(o)); this.Reset(); }), DispatcherPriority.Send, null); }; if (!this.IsInDesignMode) { Initialize.BeginInvoke(ar => Initialize.EndInvoke(ar as IAsyncResult), Initialize); } }