private void _viewModel_DialogActions(object sender, CommandArgs args) { if (args.parameter.Equals("YES")) { switch (_lastCommand) { case "NewDic": CustomDicManage.AddACustomDictionary(_viewModel.NewName); break; case "ReName": CustomDicManage.ChangeDictionaryName(_viewModel.OpenedDic.Name, _viewModel.NewName); break; case "ReMove": WordBook.Custom.Remove(WordBook.Custom[_viewModel.OpenedDic.DBName - 10]); CustomDicManage.DeleteDictionary(_viewModel.OpenedDic.Name); if (WordBook.SelectedDic == _viewModel.OpenedDic.DBName) { WordBook.CustomeDicCounts--; WordBook.SelectedDic = WordBook.CustomeDicCounts > 10 ? WordBook.CustomeDicCounts : 5; } _viewModel.UpdateDicinfo(); VisualStateManager.GoToState(this, "BrifeInfo", true); break; default: break; } } _lastCommand = null; NewDialog.Hide(); MessageDialog.Hide(); }
public void ChangeDictionaryNameTest() { Assert.AreEqual(true, CustomDicManage.AddACustomDictionary("testDic")); Assert.AreEqual(true, CustomDicManage.ChangeDictionaryName("testDic", "testDicChanged")); }