2012-03-13 9 views
0

..ApplicationBar WP7

どのように私はそれが本当にの最後に表示させることができます読み込み中。

これは私が使用するコードです。

public MainPage() 
    { 
     InitializeComponent(); 

     AnimationContext = LayoutRoot; // for page transitions 
     _tappedListBox = null; // used for setting the activated ListBox on panorama for animation to map page 

     // If the constructor has been called, this is not a page that was already in memory: 
     _newPageInstance = true; 

     // Setup the background thread worker properties: 
     _worker = new BackgroundWorker(); // Create a background thread worker for downloading/installing park maps 
     _worker.WorkerReportsProgress = true; 
     _worker.WorkerSupportsCancellation = true; 
     _worker.DoWork += new DoWorkEventHandler(worker_DoWork); 
     _worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged); 
     _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted); 

     // Set the data context of the listbox control to the sample data 
     this.DataContext = App.ViewModel; 
     this.Loaded += new RoutedEventHandler(MainPage_Loaded); 


    } 

ここでは公開設定を行っています。

private void MainPage_Loaded(object sender, RoutedEventArgs e) 
    { 
     if (!App.ViewModel.IsDataLoaded) 
      App.ViewModel.LoadData(); 
     ; // load panorama data (if need to) 

     if (!App.ViewModel.IsDataLoaded == false) 
     { 
      this.ApplicationBar.IsVisible = true; 
     } 
    } 
+3

_worker.RunWorkerCompletedイベントハンドラ内this.ApplicationBar.IsVisible = true;(偽!App.ViewModel.IsDataLoaded ==)もしあなたが本当にあなたのif文をこのように書くことを意味していましたか?私はどちらかを失うだろう!またはそこから==偽、それは読むのが非常に混乱しています! – mgnoonan

+0

同じ結果を維持するには、実際に両方を失う必要がありますが、同意します。ちょうど "if(App.ViewModel.IsDataLoaded)"にする必要があります。 – Nomad101

答えて

4

Puの代わりにそれをLoadedイベント

+0

ありがとうございました! – Kiwimoisi

関連する問題