void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.vc = ((YoYoStudio.Client.Chat.Controls.VideoControl)(target)); return; } this._contentLoaded = true; }
public void Windows_Loaded(object sender, RoutedEventArgs arg) { if (videoControl == null) { videoControl = CameraContentControl.Template.FindName("PART_CameraControl", CameraContentControl) as VideoControl; if (videoControl != null) { videoControl.FlashCallback += videoControl_FlashCallback; } } if (cameraComboBox == null) { cameraComboBox = CameraContentControl.Template.FindName("PART_CameraComboBox", CameraContentControl) as ComboBox; if (cameraComboBox != null) { cameraComboBox.SelectionChanged += cameraComboBox_SelectionChanged; } } }
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; } }
protected override void ProcessMessage(Common.Notification.EnumNotificationMessage<object, ViewModel.ConfigurationWindowAction> message) { switch (message.Action) { case ConfigurationWindowAction.ConfigurationStateChanged: ConfigurationItemViewModel vm = message.Content as ConfigurationItemViewModel; if (vm != null) { var cvm = DataContext as ConfigurationWindowViewModel; cvm.CurrentConfigurationItemVM = vm; VisualStateManager.GoToState(Configurations, vm.ConfigurationVM.Name, false); if (vm.ConfigurationVM.Name == vm.ApplicationVM.ProfileVM.VideoConfigurationVM.Name) { if (videoControl == null) { var pv = Configurations.Template.FindName("PART_Video", Configurations) as ContentControl; if (pv != null) { pv.ApplyTemplate(); videoControl = pv.Template.FindName("videoControl", pv) as VideoControl; if (videoControl != null) { videoControl.FlashCallback += videoControl_FlashCallback; } } } } } break; case ConfigurationWindowAction.CameraIndexChanged: if (videoControl != null) { int index = (int)message.Content; if (index > 0) { videoControl.CallFlash(YoYoStudio.Controls.Winform.FlexCommand.StartCamera, new string[] { (index - 1).ToString() }); videoControl.IsEnabled = true; } else { videoControl.CallFlash(YoYoStudio.Controls.Winform.FlexCommand.CloseCamera); videoControl.IsEnabled = false; } } break; case ConfigurationWindowAction.LocalPhotoSelect: OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = Text.PhotoType; if (dialog.ShowDialog() == true) { var currentVm = ((ConfigurationWindowViewModel)DataContext).CurrentConfigurationItemVM.ConfigurationVM as PhotoSelectorViewModel; if (currentVm != null) { currentVm.PhotoSource = Utility.CreateBitmapSourceFromFile(dialog.FileName); } } break; case ConfigurationWindowAction.CameraPhotoSelect: CameraWindowViewModel cameraVM = new CameraWindowViewModel(); cameraVM.Initialize(); CameraWindow cameraWindow = new CameraWindow(cameraVM); cameraWindow.Show(); break; case ConfigurationWindowAction.StartScreenCapture: screenCapture.StartCaputre(30,new Size(Owner.ActualWidth,Owner.ActualHeight)); break; case ConfigurationWindowAction.PasswordInvalid: MessageBox.Show(Text.PasswordInvalid,Text.Error,MessageBoxButton.OK); break; case ConfigurationWindowAction.VideoRefresh: string[] cams = videoControl.CallFlash(YoYoStudio.Controls.Winform.FlexCommand.GetCameras); if (cams != null && cams.Length > 0) { VideoConfigurationViewModel cvm = videoControl.DataContext as VideoConfigurationViewModel; if (cvm != null) { cvm.Cameras.Clear(); cams.Foreach(c => cvm.Cameras.Add(c)); } } break; default: break; } }