private void ChangedState(CamContectingState cs) { _cameraInfo.state = cs; Uri uri; Uri buri; ImageBrush ib; ImageBrush bib; switch (_cameraInfo.state) { case CamContectingState.OFFLINE: uri = new Uri(@"/image/camera_close.png", UriKind.Relative); ib = new ImageBrush(); ib.ImageSource = new BitmapImage(uri); image.Source = ib.ImageSource; connectLabel.Text = Application.Current.FindResource("conCamera").ToString(); buri = new Uri(@"/image/lian.png", UriKind.Relative); bib = new ImageBrush(); bib.ImageSource = new BitmapImage(buri); imageButton.Source = bib.ImageSource; break; case CamContectingState.ONLINE: uri = new Uri(@"/image/camera.png", UriKind.Relative); ib = new ImageBrush(); ib.ImageSource = new BitmapImage(uri); image.Source = ib.ImageSource; connectLabel.Text = Application.Current.FindResource("disCamera").ToString(); buri = new Uri(@"/image/duan.png", UriKind.Relative); bib = new ImageBrush(); bib.ImageSource = new BitmapImage(buri); imageButton.Source = bib.ImageSource; break; default: break; } }
private void ViewButtonStateChanged(CamContectingState ccs) { switch (ccs) { case CamContectingState.ONLINE: this.vclLeftBtn.IsEnabled = true; this.vclRightBtn.IsEnabled = true; this.vclBoth.IsEnabled = true; this.blackCellBtn.IsEnabled = true; break; case CamContectingState.OFFLINE: case CamContectingState.ERROR: this.vclLeftBtn.IsEnabled = false; this.vclRightBtn.IsEnabled = false; this.vclBoth.IsEnabled = false; this.blackCellBtn.IsEnabled = false; break; default: break; } }