2013-06-22 227 views
-4

我已经创建了数据库和所有的编码。但信息现在出现在电话中。 我如何让它们出现? 它不能显示任何细节。它告诉我它不能从编码“this.listBox.ItemsSource = CarScores;”到这一行。信息未显示

//Main Page Coding .xaml.CS 
namespace carDatabaseCreater 
{ 
public partial class MainPage : PhoneApplicationPage 
{ 

    public static List<Car> CarScoresList = new List<Car>(); 
    Uri uri; 
    Grid CarGrid; 
    CarHisrotyRepository CarHisrotyRepository; 
    ObservableCollection<Car> CarScores; 


    // Constructor 
    public MainPage() 
    { 
     InitializeComponent(); 


     this.DisplayCarHistory(); 
     this.UpdateCarScoresFromDB(); 
    } 


     public void SaveCarToCarHistory(Car _Car) 
     { 
      CarHisrotyRepository _CarHisrotyRepository = new CarHisrotyRepository(); 

     Car item0 = new Car() { CarName = "Arion", CarSupplierName = "Bahowan", CarImage = "Image/BMW.jpg", CarCompanyName = "Toyota" }; 
     Car item1 = new Car() { CarName = "Arion", CarSupplierName = "Bahowan", CarImage = "Image/BMW.jpg", CarCompanyName = "Toyota" }; 
     Car item2 = new Car() { CarName = "Arion", CarSupplierName = "Bahowan", CarImage = "Image/BMW.jpg", CarCompanyName = "Toyota" }; 
     Car item3 = new Car() { CarName = "Arion", CarSupplierName = "Bahowan", CarImage = "Image/BMW.jpg", CarCompanyName = "Toyota" }; 
     Car item4 = new Car() { CarName = "Arion", CarSupplierName = "Bahowan", CarImage = "Image/BMW.jpg", CarCompanyName = "Toyota" }; 
     CarScoresList.Add(item0); 
     _CarHisrotyRepository.Save(item0); 
     CarScoresList.Add(item1); 
     _CarHisrotyRepository.Save(item1); 
     CarScoresList.Add(item2); 
     _CarHisrotyRepository.Save(item2); 
     CarScoresList.Add(item3); 
     _CarHisrotyRepository.Save(item3); 
     CarScoresList.Add(item4); 
     _CarHisrotyRepository.Save(item4); 


    } 

    private void UpdateCarScoresFromDB() 
    { 
     CarHisrotyRepository CarHisrotyRepository = new carDatabaseCreater.CarHisrotyRepository(); 

     List<Car> AllGames = CarHisrotyRepository.allQuery(CarHisrotyRepository.CarContext).ToList(); 


     } 


    public void DisplayCarHistory() 
    { 
     this.CarHisrotyRepository = new CarHisrotyRepository(); 

     // Get Game History from IsoStore 
     List<Car> CarHistory = this.CarHisrotyRepository.Load(); 

     // Display to Screen 
     CarScores = new ObservableCollection<Car>(CarHistory); 
     this.listBox.ItemsSource = CarScores;// the Error appears here 
     } 

    } 
    } 
+3

你已经在这里给了*远*太多的代码。请将它缩减为只包含相关代码的简短但完整的程序 - 换句话说,您的真实应用程序的削减版本,它仍然表明问题。 –

+0

我现在将它发布 –

+0

我无法发布错误照片 –

回答

0

我没有看到任何代码行,你把汽车网格的视觉树。也许这是原因?

+0

谢谢我现在做它 –

+0

(n)/////////////////////// ///////// –