private void OpenBluetoothWindow() { if (Constants.BluetoothWindowIsOpen) { return; } bluetoothWindow = new BluetoothWindow(this); bluetoothWindow.Show(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Menu_Mouse_Down(object sender, RoutedEventArgs e) { FrameworkElement feSource = e.Source as FrameworkElement; switch (feSource.Name) { case "Connect": if (!init) { Init_Connect_Window(); } else { portWindow.Visibility = Visibility.Visible; } break; case "Bluetooth": BluetoothWindow b_w = new BluetoothWindow(this); b_w.Show(); break; case "Draw": if (tetris != null) { tetris.Stop_Tetris(); } if (video != null) { video.RunVideo = false; } if (webcam != null) { webcam.closeWebcam(); } runningTask = RunningTask.Draw; drawAccept = true; draw = new Draw(drawlayer, monitorImg, monitor); ex_eff = draw.Draw_execute; draw.setColor = Color.FromArgb(255, 0, 0, 255); draw.setDrawtype = Drawtype.rectangle; Binding ColorBinding = new Binding("setColor"); ColorBinding.Source = draw; ColorBinding.Mode = BindingMode.TwoWay; DrawingColorPicker.SetBinding(Xceed.Wpf.Toolkit.ColorCanvas.SelectedColorProperty, ColorBinding); break; case "Effects": if (tetris != null) { tetris.Stop_Tetris(); } if (video != null) { video.RunVideo = false; } if (webcam != null) { webcam.closeWebcam(); } runningTask = RunningTask.Effect; drawAccept = false; ex_eff = plasma.Plasma_execute; monitorTimer.IsEnabled = true; break; case "Images": if (tetris != null) { tetris.Stop_Tetris(); monitor = BitmapFactory.New(68, 42); monitorImg.Source = monitor; } if (webcam != null) { webcam.closeWebcam(); } if (video != null) { video.RunVideo = false; } drawAccept = false; monitorImg.Source = monitor; runningTask = RunningTask.Image; ip = new ImagePixelate(monitor); ex_eff = ip.execute; break; case "Video": if (tetris != null) { tetris.Stop_Tetris(); monitorImg.Source = monitor; } if (webcam != null) { webcam.closeWebcam(); } runningTask = RunningTask.Video; CentralMonitor.IsEnabled = false; drawAccept = false; video = new Video(monitor); ex_eff = video.video_execute; video.RunVideo = true; break; case "Tetris": if (webcam != null) { webcam.closeWebcam(); } if (video != null) { video.RunVideo = false; } runningTask = RunningTask.Tetris; drawAccept = false; if (tetris == null) { tetris = new TetrisExecute(monitor, monitorTimer, AuroraWindow); ex_eff = tetris.tetris_exe; } else { tetris.Stop_Tetris(); tetris = new TetrisExecute(monitor, monitorTimer, AuroraWindow); ex_eff = tetris.tetris_exe; } break; case "Webcam": runningTask = RunningTask.Webcam; CentralMonitor.IsEnabled = false; drawAccept = false; if (tetris != null) { tetris.Stop_Tetris(); } if (webcam == null) { webcam = new Webcam(monitor); } if (video != null) { video.RunVideo = false; } webcam.resumeWebcam(monitor); ex_eff = webcam.Webcam_execute; break; } SetUserControls(); }