コード例 #1
0
 void MainPage_Loaded(object sender, RoutedEventArgs e)
 {
     if (this.mainPage_ViewModel == null)
         this.mainPage_ViewModel = new MainPage_ViewModel();
     this.mainPage_ViewModel.LoadCatalogDefaultData();
     this.DataContext = mainPage_ViewModel;
 }
コード例 #2
0
 public void DataCatalogTitle_CatalogTitle_Test()
 {
     bool isEventChanged = false;
     MainPage_ViewModel currentViewModel = new MainPage_ViewModel();  
     currentViewModel.PropertyChanged += (x, se) => 
     {
         if(currentViewModel.catalogTitle.Equals("newTitle"))
             isEventChanged=true;
     };
     currentViewModel.CatalogTitle = "newTitle";
     Assert.IsTrue(isEventChanged);
 }
コード例 #3
0
 public void DataColIsChanged_Test()
 {
     bool isPropertyChanged = false;
     MainPage_ViewModel currentViewModel = new MainPage_ViewModel();
     currentViewModel.PropertyChanged += (x, se) => 
     {
         if(currentViewModel.CatalogInfoCol.Count>0)
            isPropertyChanged = true;
     };
     currentViewModel.CatalogInfoCol = new System.Collections.ObjectModel.ObservableCollection<CatalogInfo>() 
     {
         new CatalogInfo(){CatalogName="ComplateTestChanged",CatalogComment="TestData"}
     };
     Assert.IsTrue(isPropertyChanged);
 }