2012-03-13 3 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

내부? 나는 그 중 하나를 잃을 것이다! 또는 거기에서 == 거짓, 그것은 매우 혼란 읽기! – mgnoonan

+0

동의하지만 동일한 결과를 유지하려면 실제로 두 가지를 모두 잃어 버릴 필요가 있습니다. 그냥 "if (App.ViewModel.IsDataLoaded)"이어야합니다. – Nomad101

답변

4

푸 그것을 this.ApplicationBar.IsVisible = true; (! App.ViewModel.IsDataLoaded == false로) 당신이 정말로 당신의 if 문이 방법을 쓸하셨습니까 경우 _worker.RunWorkerCompleted 이벤트 핸들러 대신 Loaded 이벤트

+0

답변 해 주셔서 감사합니다. – Kiwimoisi