Beispiel #1
0
        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);
                }
            });
        }
Beispiel #2
0
        private static void CloseView(string correlationId)
        {
            if (_cacheMultiple.ContainsKey(correlationId) && _cacheMultiple[correlationId].IsAlive)
            {
                ResponsiveMDIChild view = _cacheMultiple[correlationId].Target as ResponsiveMDIChild;
                if (view != null)
                {
                    view.Close();
                }
                _cacheMultiple[correlationId].Target = null;
                _cacheMultiple.Remove(correlationId);
            }

            List <string> deleteItems = new List <string>();

            foreach (var item in _cacheMultiple)
            {
                if (item.Value.IsAlive == false || item.Value.Target == null)
                {
                    deleteItems.Add(item.Key);
                }
            }
            foreach (var item in deleteItems)
            {
                _cacheMultiple.Remove(item);
            }
        }
Beispiel #3
0
        private static void CloseView(ViewType viewType)
        {
            if (_cacheSingle.ContainsKey(viewType) && _cacheSingle[viewType].IsAlive)
            {
                ResponsiveMDIChild view = _cacheSingle[viewType].Target as ResponsiveMDIChild;
                if (view != null)
                {
                    view.Close();
                }
                _cacheSingle[viewType].Target = null;
                _cacheSingle.Remove(viewType);
            }

            List <ViewType> deleteItems = new List <ViewType>();

            foreach (var item in _cacheSingle)
            {
                if (item.Value.IsAlive == false || item.Value.Target == null)
                {
                    deleteItems.Add(item.Key);
                }
            }
            foreach (var item in deleteItems)
            {
                _cacheSingle.Remove(item);
            }
        }
Beispiel #4
0
 private static void UpdateViewLanguageResource()
 {
     foreach (var item in _cacheSingle)
     {
         ResponsiveMDIChild view = item.Value.Target as ResponsiveMDIChild;
         if (view != null)
         {
             view.RefreshTitle();
         }
     }
 }
Beispiel #5
0
        public static void DeployView(ResponsiveMDIChild child)
        {
            if (child == null)
            throw new ArgumentNullException("child");
              if (Container == null)
            throw new ArgumentNullException("Container", "The container must be set before deploy child view.");

              if (!Container.Children.Contains(child))
              {
            Container.Children.Add(child);
              }
        }
Beispiel #6
0
        internal static ResponsiveMDIChild MakeDeviceConfigurationView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
              {
            TitleSource = "Widgets_MDI_CameraManagement",
            Content = new Grid()
              };
              mdi.RefreshTitle();

              DeviceConfigurationViewRouter.SetEntry(mdi.Content as Grid);

              return mdi;
        }
Beispiel #7
0
        internal static ResponsiveMDIChild MakePublishMediaView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
              {
            TitleSource = "Widgets_MDI_PublishMedia",
            Content = new Grid()
              };
              mdi.RefreshTitle();

              PublishMediaViewRouter.SetEntry(mdi.Content as Grid);

              return mdi;
        }
Beispiel #8
0
        internal static ResponsiveMDIChild MakeLiveVideoCameraListView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
              {
            TitleSource = "Widgets_MDI_LiveCameraList",
            Content = new Grid()
              };
              mdi.RefreshTitle();

              CameraListViewRouter.SetEntry(mdi.Content as Grid);

              return mdi;
        }
Beispiel #9
0
        internal static ResponsiveMDIChild MakeAboutView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
              {
            TitleSource = "Widgets_MDI_Abort",
            Content = new Grid()
              };
              mdi.RefreshTitle();

              WidgetsViewRouter.SetEntry(mdi.Content as Grid);

              return mdi;
        }
Beispiel #10
0
        internal static ResponsiveMDIChild MakeAboutView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
            {
                TitleSource = "Widgets_MDI_Abort",
                Content     = new Grid()
            };

            mdi.RefreshTitle();

            WidgetsViewRouter.SetEntry(mdi.Content as Grid);

            return(mdi);
        }
Beispiel #11
0
        internal static ResponsiveMDIChild MakeSkinConfigurationView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
            {
                TitleSource = "Widgets_MDI_ChangeSkin",
                Content     = new Grid()
            };

            mdi.RefreshTitle();

            SkinConfigurationViewRouter.SetEntry(mdi.Content as Grid);

            return(mdi);
        }
Beispiel #12
0
        internal static ResponsiveMDIChild MakeLiveVideoCameraListView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
            {
                TitleSource = "Widgets_MDI_LiveCameraList",
                Content     = new Grid()
            };

            mdi.RefreshTitle();

            CameraListViewRouter.SetEntry(mdi.Content as Grid);

            return(mdi);
        }
Beispiel #13
0
        internal static ResponsiveMDIChild MakeDeviceConfigurationView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
            {
                TitleSource = "Widgets_MDI_CameraManagement",
                Content     = new Grid()
            };

            mdi.RefreshTitle();

            DeviceConfigurationViewRouter.SetEntry(mdi.Content as Grid);

            return(mdi);
        }
Beispiel #14
0
        internal static ResponsiveMDIChild MakePublishMediaView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
            {
                TitleSource = "Widgets_MDI_PublishMedia",
                Content     = new Grid()
            };

            mdi.RefreshTitle();

            PublishMediaViewRouter.SetEntry(mdi.Content as Grid);

            return(mdi);
        }
Beispiel #15
0
        internal static ResponsiveMDIChild MakeLiveVideoView(Camera camera)
        {
            if (camera == null)
            throw new ArgumentNullException("camera");

              ResponsiveMDIChild mdi = new ResponsiveMDIChild()
              {
            Title = camera.Name,
            Content = new Grid()
              };

              LiveVideoViewRouter.SetEntry(mdi.Content as Grid, camera);

              return mdi;
        }
Beispiel #16
0
 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);
     }
 }
        public static void DeployView(ResponsiveMDIChild child)
        {
            if (child == null)
            {
                throw new ArgumentNullException("child");
            }
            if (Container == null)
            {
                throw new ArgumentNullException("Container", "The container must be set before deploy child view.");
            }

            if (!Container.Children.Contains(child))
            {
                Container.Children.Add(child);
            }
        }
Beispiel #18
0
        internal static ResponsiveMDIChild MakeLiveVideoView(Camera camera)
        {
            if (camera == null)
            {
                throw new ArgumentNullException("camera");
            }

            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
            {
                Title   = camera.Name,
                Content = new Grid()
            };

            LiveVideoViewRouter.SetEntry(mdi.Content as Grid, camera);

            return(mdi);
        }
Beispiel #19
0
        internal static ResponsiveMDIChild MakeSkinConfigurationView()
        {
            ResponsiveMDIChild mdi = new ResponsiveMDIChild()
              {
            TitleSource = "Widgets_MDI_ChangeSkin",
            Content = new Grid()
              };
              mdi.RefreshTitle();

              SkinConfigurationViewRouter.SetEntry(mdi.Content as Grid);

              return mdi;
        }