diff --git a/BBWY.Client/ViewModels/MainViewModel.cs b/BBWY.Client/ViewModels/MainViewModel.cs index 8d6758d6..ec1fb5d9 100644 --- a/BBWY.Client/ViewModels/MainViewModel.cs +++ b/BBWY.Client/ViewModels/MainViewModel.cs @@ -236,25 +236,31 @@ namespace BBWY.Client.ViewModels private void OpenSelectShop() { - var selectShop = new SelectShop(GlobalContext.User.DepartmentList); - if (selectShop.ShowDialog() == true) + try { - ChooseShop(selectShop.Shop, true); - var vm = App.Current.Resources["Locator"] as ViewModelLocator; - if (vm.IsCreateOrderList) - vm.OrderList.Refresh(); - if (vm.IsCreateWareManager) - vm.WareManager.Refresh(); - if (vm.IsCreateWareStock) - vm.WareStock.Refresh(); - - try + var selectShop = new SelectShop(GlobalContext.User.DepartmentList); + if (selectShop.ShowDialog() == true) { - w2m.Close(); + ChooseShop(selectShop.Shop, true); + var vm = App.Current.Resources["Locator"] as ViewModelLocator; + if (vm.IsCreateOrderList) + vm.OrderList.Refresh(); + if (vm.IsCreateWareManager) + vm.WareManager.Refresh(); + if (vm.IsCreateWareStock) + vm.WareStock.Refresh(); + + try + { + w2m.Close(); + } + catch { } } - catch { } } - + catch (Exception ex) + { + MessageBox.Show(ex.Message, "切换失败"); + } } private void ChooseShop(Shop shop, bool _throw = false)