private void ShutdownAndReactivate() { if (this.platformChangeState == null) { return; } PlatformContextChanger.PlatformChangeState platformChangeState = this.platformChangeState; this.platformChangeState = (PlatformContextChanger.PlatformChangeState)null; try { if (platformChangeState.NewView.IsClosing) { return; } ViewRootResolver viewRootResolver = platformChangeState.NewView.DesignerContext.ViewRootResolver; List <SceneView> list1 = new List <SceneView>((IEnumerable <SceneView>)viewRootResolver.ResolvedViews); if (platformChangeState.OldView != null && !list1.Contains(platformChangeState.OldView)) { list1.Add(platformChangeState.OldView); } string identifier = platformChangeState.Platform.Metadata.TargetFramework.Identifier; list1.RemoveAll((Predicate <SceneView>)(v => { if (!v.IsClosing) { return(!v.Platform.Metadata.TargetFramework.Identifier.Equals(identifier)); } return(true); })); platformChangeState.ViewUpdateManager.InvalidateViews((ICollection <SceneView>)list1, false); platformChangeState.Platform.ActivatePlatformContext(); List <SceneView> list2 = new List <SceneView>((IEnumerable <SceneView>)viewRootResolver.ResolvedViews); if (platformChangeState.OldView != null && !list2.Contains(platformChangeState.OldView)) { list2.Add(platformChangeState.OldView); } platformChangeState.ViewUpdateManager.InvalidateViews((ICollection <SceneView>)list2, false); platformChangeState.PostponeToken.Dispose(); platformChangeState.PostponeToken = (IDisposable)null; this.RefreshAssemblies(platformChangeState.NewView); platformChangeState.NewView.ShutdownVisualTree(); platformChangeState.NewView.Activated(); if (this.HostPlatformRestarted == null) { return; } this.HostPlatformRestarted((object)this, EventArgs.Empty); } finally { platformChangeState.Dispose(); } }
public void UpdateForPlatformChange(SceneView view, SceneView oldView, bool useAsyncShutdown, bool needsContextUpdate) { bool flag1 = this.oldProjectContext != view.ProjectContext; this.oldProjectContext = view.ProjectContext; bool flag2 = !view.DesignerContext.ViewRootResolver.IsInitializingUnopenedView; if (needsContextUpdate) { if (!flag2) { return; } IPlatform platform = view.Platform; IDisposable postponeToken = this.platformChangeState == null?view.ViewUpdateManager.PostponeUpdates() : this.platformChangeState.PostponeToken; bool flag3 = this.platformChangeState == null; this.platformChangeState = new PlatformContextChanger.PlatformChangeState(view.ViewUpdateManager, platform, oldView, view, postponeToken); if (useAsyncShutdown) { if (!flag3) { return; } UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.Send, (Action)(() => this.ShutdownAndReactivate())); } else { this.ShutdownAndReactivate(); } } else { if (flag1) { this.RefreshAssemblies(view); } if (this.platformChangeState == null) { return; } this.platformChangeState.Dispose(); this.platformChangeState = (PlatformContextChanger.PlatformChangeState)null; } }
public void Dispose() { if (this.viewService != null) { this.viewService.ActiveViewChanging -= new ViewChangedEventHandler(this.OnViewServiceActiveViewChanging); this.viewService = (IViewService)null; } if (this.platformChangeState != null) { this.platformChangeState.Dispose(); this.platformChangeState = (PlatformContextChanger.PlatformChangeState)null; } if (this.projectManager == null) { return; } this.projectManager.SolutionClosed -= new EventHandler <SolutionEventArgs>(this.OnProjectManagerSolutionClosed); this.projectManager = (IProjectManager)null; }