示例#1
0
        public UnitPresenter(IUnityContainer container, IUnitView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<UnitModel>();

            //Event Delegate
            View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch);
            View.New += new EventHandler<EventArgs>(this.OnNew);
            View.LoadData += new EventHandler<DataEventArgs<Unit>>(this.OnLoadData);
            View.Save += new EventHandler<EventArgs>(this.OnSave);
            View.Delete += new EventHandler<EventArgs>(this.OnDelete);
            View.ShowOnlyGroups += new EventHandler<EventArgs>(OnShowOnlyGroups);


            ProcessWindow pw = new ProcessWindow("Loading ...");

            View.Model.EntityList = service.GetUnit(new Unit { Company = App.curCompany });
            View.Model.Record = null;
            View.TxtUnitGroup.IsEnabled = false;

            //List Height
            View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250;

            //loading Units
            View.Model.UnitGroupList = service.GetUnit(new Unit { Company = App.curCompany,  BaseAmount = 1 }).Where(f=>f.BaseAmount==1).ToList();

            pw.Close();
        }