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;
            }            
		}
        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;
            }
        }