public App() { LogonViewModel = new LogonViewModel(); MainPageViewModel = new MainPageViewModel(); LogonUserViewModel = new LogonUserViewModel(); UserManagerViewModel = new UserManagerViewModel(); FileTypeManagerViewModel = new FileTypeManagerViewModel(); TaxPayerTypeManagerViewModel = new TaxPayerTypeManagerViewModel(); TaxPayerManagerViewModel = new TaxPayerManagerViewModel(); DocumentManagerViewModel = new DocumentManagerViewModel(); this.Startup += this.Application_Startup; this.UnhandledException += this.Application_UnhandledException; this.CheckAndDownloadUpdateCompleted += new CheckAndDownloadUpdateCompletedEventHandler(App_CheckAndDownloadUpdateCompleted); InitializeComponent(); WebContext webContext = new WebContext(); webContext.Authentication = new FormsAuthentication(); this.ApplicationLifetimeObjects.Add(webContext); }
protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) { FileTypeManagerViewModel fileTypeManagerViewModel = this.DataContext as FileTypeManagerViewModel; fileTypeManagerViewModel.ConfirmLeave(); }
// 当用户导航到此页面时执行。 protected override void OnNavigatedTo(NavigationEventArgs e) { FileTypeManagerViewModel fileTypeManagerViewModel = this.DataContext as FileTypeManagerViewModel; fileTypeManagerViewModel.LoadData(); }