public BookLocationShowViewModel(IUnityContainer container, IRegionManager regionManager) { this.container = container; this.regionManager = regionManager; this.eventAggregator = container.Resolve<IEventAggregator>(); this.dispatcherService = container.Resolve<IDispatcherService>(); //初始化UI的变量 this.bookName = ""; this.bookAccessCode = ""; this.bookLocation = ""; //初始化两个地图画板 this.libraryMapService = this.container.Resolve<DrawMapService>(); this.libraryMapService.initOneShapMap(150, 400, 150, 400); this.libraryMapService.drawOneShapeMapBackground(); //this.LibraryMapService = this.LibraryMapService; //通知更新UI //this.libraryMapService.initLibraryShelfMap(600,400,25000,22000); this.libraryMapService.initLibraryShelfMap(660, 400, 25000, 22000); //测试代码开始 this.libraryMapService.drawLibraryShelfMapBackgroundByLibraryName("图书馆W区6层22行3列A面书架第4层");//画出主书库的背景图,例如地板,测试代码 //测试代码结束 this.LibraryMapService = this.LibraryMapService;//通知更新UI }
private void clearBookInformation() { this.BookName = ""; this.BookAccessCode = ""; this.BookLocation = ""; this.libraryMapService.reinitOneShapMap();//刷新UI this.libraryMapService.drawOneShapeMapBackground(); //this.LibraryMapService = this.LibraryMapService; //通知更新UI,没必要重复了,等下面操作一起刷新 this.libraryMapService.reinitLibraryShelfMap(); this.LibraryMapService = this.LibraryMapService;//通知更新UI }
private void handleNewItemFromRFID(RFIDContent newItem) { if (newItem.bookRfidList.Count() != 0) { IBookLocationService bookLocationService = this.container.Resolve<IBookLocationService>(); IBookInformationService bookInformationService = this.container.Resolve<IBookInformationService>(); List<String> bookNameList = bookInformationService.getBookNameListByRfidList(newItem.bookRfidList); List<String> bookAccessCodeList = bookInformationService.getBookAccessCodeListByRfidList(newItem.bookRfidList); this.dispatcherService.Dispatch(() => {//显示图书基本信息 this.BookName = bookNameList[0]; this.BookAccessCode = bookAccessCodeList[0]; }); String shelfRfid = bookLocationService.getShelfRfidbyBookRfid(newItem.bookRfidList[0]); String bookLocationString = bookLocationService.getShelfNameByShelfRfid(shelfRfid); //在选定的书架层上绘图 this.dispatcherService.Dispatch(() => { this.BookLocation = bookLocationString; //test code here ,delete it this.libraryMapService.reinitOneShapMap();//刷新UI this.libraryMapService.drawOneShapeMapBackground(); this.libraryMapService.drawSelectedLayerOneShapeMap(bookLocationString); //this.LibraryMapService = this.LibraryMapService; //通知更新UI,没必要重复了,等下面操作一起刷新 this.libraryMapService.reinitLibraryShelfMap(); this.libraryMapService.drawLibraryShelfMapBackgroundByLibraryName(bookLocationString); this.libraryMapService.drawSelectedShelfLibraryShelfMapByLibraryName(shelfRfid); this.LibraryMapService = this.LibraryMapService;//通知更新UI }); } }