public VideoWindow(VideoWindowViewModel vm, bool isEmbedded)
 {
     DataContext = vm;
     InitializeComponent();
     vc.MoviePath = vm.FlexPath;
     vc.FlashCallback += vc_FlashCallback;
     Loaded += VideoWindow_Loaded;
     embeded = isEmbedded;
 }
Exemplo n.º 2
0
        public override void Initialize()
        {
            base.Initialize();
            giftGroupVMs.SetValue(new System.Collections.ObjectModel.ObservableCollection<GiftGroupViewModel>(ApplicationVM.LocalCache.AllGiftGroupVMs));
            motionImageVMs.SetValue(new System.Collections.ObjectModel.ObservableCollection<Common.Wpf.ViewModel.ImageViewModel>(
                ApplicationVM.LocalCache.AllImages[BuiltIns.SmileImageType.Id].Values));
            stampImageVMs.SetValue(new System.Collections.ObjectModel.ObservableCollection<ImageViewModel>(
                ApplicationVM.LocalCache.AllImages[BuiltIns.StampImageType.Id].Values));

            FirstVideoWindowVM = new VideoWindowViewModel();
            SecondVideoWindowVM = new VideoWindowViewModel();
            ThirdVideoWindowVM = new VideoWindowViewModel();
        }
Exemplo n.º 3
0
        public VideoWindow(VideoWindowViewModel vm, bool isEmbedded, VideoControl vControl)
        {
            DataContext = vm;
            videoWindowVM = vm;
            InitializeComponent();
            vc.MoviePath = vm.FlexPath;
            vc.FlashCallback += vc_FlashCallback;
            Loaded += VideoWindow_Loaded;
            embeded = isEmbedded;

            vc.BottomTemplate = FindResource("VideoControlBottomTemplate") as ControlTemplate;
            vc.VideoBorderStyle = FindResource("VideoControlBorderStyle") as Style;
            vc.ApplyTemplate();
            videoControl = vControl;

            if (!isEmbedded)
            {
                vc.IsZoom = true;
            }
        }
        private Window CreateVideoWindow(ContentControl videoBorder, VideoWindowViewModel vm)
        {
            Point p = videoBorder.TransformToAncestor(this).Transform(new Point(0, 0));
            double x = p.X;
            double y = p.Y;
            VideoWindow videoWnd = new VideoWindow(vm, true);
            videoWnd.OffsetX = x;
            videoWnd.OffsetY = y;
            videoWnd.ReplicatedControl = videoBorder;
            videoWnd.Top = Top + videoWnd.OffsetY;
            videoWnd.Left = Left + videoWnd.OffsetX;
            videoWnd.Owner = this;
            videoWnd.Show();
            return videoWnd;

            //Point p = videoBorder.TransformToAncestor(this).Transform(new Point(0, 0));
            //double x = p.X;
            //double y = p.Y;
            //return CreateWindowInSeparateThread<VideoWindowAction>(() =>
            //{
            //    return new VideoWindow(vm, true);
            //},
            //    x, y, false, true, videoBorder);
        }
Exemplo n.º 5
0
 public VideoWindow(VideoWindowViewModel vm, bool isEmbedded)
     :this(vm,isEmbedded,null)
 {
 }
        private void flex_FlashCallback(FlexCallbackCommand cmd, List<string> args)
        {
            UserViewModel uvm = DataContext as UserViewModel;
            if (uvm != null && uvm.RoomWindowVM != null)
                switch (cmd)
                {
                    case FlexCallbackCommand.ReportStatus:
                        IsEnabled = true;
                        if (args != null && args.Count == 1)
                        {
                            if (args[0] == FlexStatusStrings.ConnectSucceed)
                            {
                                RtmpConnectSuccessful();
                            }
                            else
                            {
                                //TODO Connect Red5 failed.
                            }
                        }
                        break;
                    case FlexCallbackCommand.LoadComplete:
                        IsEnabled = true;
                        break;
                    case FlexCallbackCommand.VideoStateChanged:
                        int vState = 0;
                        if (uvm.IsMe() && args.Count > 0)
                        {
                            if (int.TryParse(args[0], out vState))
                            {
                                uvm.RoomWindowVM.RoomClient.VideoStateChanged(uvm.RoomWindowVM.RoomVM.Id, vState);
                            }
                        }
                        break;
                    case FlexCallbackCommand.AudioStateChanged:
                        int aState = 0;
                        if (args.Count > 0)
                        {
                            if (int.TryParse(args[0], out aState))
                            {
                                uvm.RoomWindowVM.RoomClient.AudioStateChanged(uvm.RoomWindowVM.RoomVM.Id,aState);
                                switch (aState)
                                {
                                    case FlexCallbackCommandNames.AV_State_Normal:
                                        if (uvm.IsMe())
                                        {
                                            uvm.RoomWindowVM.StartAudioRecording();
                                        }
                                        else
                                        {
                                            uvm.RoomWindowVM.StartAudioPlaying(uvm.Id);
                                        }
                                        break;
                                    case FlexCallbackCommandNames.AV_State_Paused:
                                        if (uvm.IsMe())
                                        {
                                            uvm.RoomWindowVM.PauseAudioRecording();
                                        }
                                        else
                                        {
                                            uvm.RoomWindowVM.StopAudioPlaying(uvm.Id);
                                        }
                                        break;
                                    case FlexCallbackCommandNames.AV_State_Resumed:
                                        if (uvm.IsMe())
                                        {
                                            uvm.RoomWindowVM.StartAudioRecording();
                                        }
                                        else
                                        {
                                            uvm.RoomWindowVM.StartAudioPlaying(uvm.Id);
                                        }
                                        break;
                                    default:
                                        break;
                                }
                            }
                        }

                        break;
                    case FlexCallbackCommand.TakePicture:                        
                        break;
                    case FlexCallbackCommand.ExtendVideo:
						VideoWindowViewModel vm = new VideoWindowViewModel(uvm);
						vm.Initialize();
						VideoWindow window = new VideoWindow(vm,false);
                        window.Topmost = true;
                        window.Show();
                        break;
                }
            if (FlashCallback != null)
            {
                FlashCallback(cmd, args);
            }
        }
Exemplo n.º 7
0
        private Window CreateVideoWindow(ContentControl videoBorder,VideoWindowViewModel vm)
        {
            Point p = videoBorder.TransformToAncestor(this).Transform(new Point(0, 0));
            double x = p.X;
            double y = p.Y;
            YoYoStudio.Controls.CustomWindow.ChildWindow<VideoWindowAction> videoWnd = new VideoWindow(vm, true);
            //VideoWindow videoWnd = new VideoWindow(vm, true);
            videoWnd.SetParent<RoomWindowAction>(this, true);
            videoWnd.OffsetX = x;
            videoWnd.OffsetY = y;
            videoWnd.ReplicatedControl = videoBorder;
            videoWnd.Top = Top + videoWnd.OffsetY;
            videoWnd.Left = Left + videoWnd.OffsetX;
            
            videoWnd.Owner = this;
            videoWnd.Show();
            return videoWnd;

            //Point p = videoBorder.TransformToAncestor(this).Transform(new Point(0, 0));
            //double x = p.X;
            //double y = p.Y;
            //VideoWindow wnd = CreateWindowInSeparateThread<VideoWindowAction>(() =>
            //{
            //    return new VideoWindow(vm, true);
            //},
            //    x, y, false, true, videoBorder) as VideoWindow;

            //wnd.MouseLeftButtonUp += wnd_MouseLeftButtonUp;
            //return wnd;
        }
 private Window CreateVideoWindow(ContentControl videoBorder,VideoWindowViewModel vm)
 {
     Point p = videoBorder.TransformToAncestor(this).Transform(new Point(0, 0));
     double x = p.X;
     double y = p.Y;
     return CreateWindowInSeparateThread<VideoWindowAction>(() =>
     {
         return new VideoWindow(vm,true);
     },
         x, y, false, true, videoBorder);
 }