//Play the file
        private void TogglePlayback(AudioPlayer player,bool status)
        {
            if (player == null)
                return;

            //if (!player.IsPlaying && (status))
            if(status)
            {
                player.Stop();
                player.Play();
            }
        }
        //end
        #endregion

        #region Contructors

        public LiveViewUsercontrol()
        {
            InitializeComponent();
            Loaded += LiveViewUsercontrol_Loaded;

            XmlConfigurator.Configure();
            ManageVideoScreen();
            centreshowScreen.Content = new UserControl();
            _viewModel = new HighCameraGroupViewModel();
            for (int i = 0; i < 25; i++)
            {
                VideoScreenUserControl video = new VideoScreenUserControl();
                video.MouseLeftButtonUp += Video_MouseLeftButtonUp;
                video.MouseLeftButtonDown += video_MouseLeftButtonDown;
                video.MouseWheel += video_MouseWheel;
                video.MouseDoubleClick += video_MouseDoubleClick;
                video.Stop += video_Stop;
                video.add += Video_add;
                ResourceUtil.Listvideo.Add(video);
            }

            DataContext = _viewModel;
            GetCameraData();
            InitComboboxChooseScreen();
            SetVideo(5);//Default set video is 5x5
            currentScreenType = 5;
            m_oWorker = new BackgroundWorker();
            m_oWorker.DoWork += new DoWorkEventHandler(m_oWorker_DoWork);
            //m_oWorker.ProgressChanged += new ProgressChangedEventHandler
            //        (m_oWorker_ProgressChanged);
            m_oWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler
                    (m_oWorker_RunWorkerCompleted);
            //m_oWorker.WorkerReportsProgress = true;
            m_oWorker.WorkerSupportsCancellation = true;

            m_MousePTcontrolWorker = new BackgroundWorker();
            m_MousePTcontrolWorker.DoWork += m_MousePTcontrolWorker_DoWork;
            m_MousePTcontrolWorker.RunWorkerCompleted += m_MousePTcontrolWorker_RunWorkerCompleted;
            m_MousePTcontrolWorker.WorkerSupportsCancellation = true;
            //manNotification = new ManNotificationButton();

            m_HomePresetcontrolWorker = new BackgroundWorker();
            m_HomePresetcontrolWorker.DoWork += m_HomePresetcontrolWorker_DoWork;
            m_HomePresetcontrolWorker.RunWorkerCompleted += m_HomePresetcontrolWorker_RunWorkerCompleted;
            m_HomePresetcontrolWorker.WorkerSupportsCancellation = true;
            //Audio alarm
            m_alertaudio = m_tamperaudio = m_motionaudio = null;
            if (File.Exists(_alertfile))
            {
                m_alertaudio = new AudioPlayer(_alertfile);
                m_alertaudio.PlaybackEnded += m_alertaudio_PlaybackEnded;
                //m_alertaudio = new MediaPlayer();
                //m_alertaudio.Open(new Uri(_alertfile));
                //m_alertaudio.MediaEnded += m_alertaudio_MediaEnded;
            }
            if (File.Exists(_motionfile))
            {
                m_motionaudio = new AudioPlayer(_motionfile);
                //m_motionaudio = new MediaPlayer();
                //m_motionaudio.Open(new Uri(_motionfile));
                //m_motionaudio.MediaEnded += m_motionaudio_MediaEnded;
            }
            if (File.Exists(_tamperfile))
            {
                m_tamperaudio = new AudioPlayer(_tamperfile);
                m_tamperaudio.PlaybackEnded += m_tamperaudio_PlaybackEnded;
                //m_tamperaudio = new MediaPlayer();
                //m_tamperaudio.Open(new Uri(_tamperfile));
                //m_tamperaudio.MediaEnded += MediaEnded;
            }
            //end
        }