2013-06-22 65 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)/////////////////////// ///////// –