void m_browser_SelectionChanged(object sender, SelectionChangedEventArgs e) { var pageBrowser = sender as FrameworkElement; if (e.AddedItems.Count > 0) { PageTab tab = e.AddedItems[0] as PageTab; LoadingComponent component = tab.GetValue(LoadingSettingProperty) as LoadingComponent; if (component != null && component.m_loadingSpin != null) { component.m_loadingSpin.IsBusy = true; } } if (e.RemovedItems.Count > 0) { PageTab tab = e.RemovedItems[0] as PageTab; LoadingComponent component = tab.GetValue(LoadingSettingProperty) as LoadingComponent; if (component != null && component.m_loadingSpin != null) { component.m_loadingSpin.IsBusy = false; } } }
void m_browser_Navigating(object sender, LoadedMoudleEventArgs e) { var container = sender as IContainer; PageTab tab = PageBrowser.GetPageTabByChild(sender as FrameworkElement); if (tab != null) { LoadingComponent component = tab.GetValue(LoadingSettingProperty) as LoadingComponent; if (container != null) { container.LoadProgress -= new EventHandler <LoadProgressEventArgs>(container_LoadProgress); container.LoadProgress += new EventHandler <LoadProgressEventArgs>(container_LoadProgress); } if (e.Status == LoadModuleStatus.Begin) { if (component == null) { component = this.GetInstance(tab) as LoadingComponent; component.Show(); } } else { if (component != null) { component.Hide(); } } } }
void container_LoadProgress(object sender, LoadProgressEventArgs e) { PageTab tab = PageBrowser.GetPageTabByChild(sender as FrameworkElement); if (tab != null && tab.View == null) { LoadingComponent component = tab.GetValue(LoadingSettingProperty) as LoadingComponent; if (component != null && component.m_loadingSpin != null) { component.m_loadingSpin.BusyContent = string.Format(MessageResource.LoadingComponent_Loading, e.ProgressPercentage); } } }