public static void SubscribeMessage() { RegisterNavigation(); Messenger.Default.Register <NotificationMessage <Camera> >(_sender, message => { if (message.Notification == UIMessageType.LiveVideo_LiveVideoEvent) { ResponsiveMDIChild view = ViewMaker.MakeLiveVideoView(message.Content); view.Closing += new RoutedEventHandler((sender, e) => { // 实时视频窗体正在关闭 Messenger.Default.Send(new NotificationMessage <Camera>( UIMessageType.LiveVideo_LiveVideoClosingEvent, message.Content)); }); NavigationDeploy.DeployView(view); } }); Messenger.Default.Register <NotificationMessage>(_sender, message => { // 关闭皮肤窗体 if (message.Notification == UIMessageType.SkinConfiguration_CloseWindowEvent) { CloseView(ViewType.SkinConfiguration); } }); }
private static void MakeSingleView(ViewType viewType, Func <ResponsiveMDIChild> func) { if (_cacheSingle.ContainsKey(viewType) && _cacheSingle[viewType].IsAlive) { ResponsiveMDIChild view = (ResponsiveMDIChild)_cacheSingle[viewType].Target; NavigationDeploy.DeployView(view); } else { ResponsiveMDIChild view = func(); CloseView(viewType); _cacheSingle.Add(viewType, new WeakReference(view, false)); NavigationDeploy.DeployView(view); } }