private void ScreenCapture() { while (!_done) { if (_isflowthings) { var luminance = _flowthingsService.GetSensorLuminance(_sensorId); _brightness = HarmanManager.GetBrightnesForLuminosity(luminance); } using (Bitmap image = CaptureScreen.GetDesktopImage()) { //using (var gaussed = image.ImageBlurFilter(ExtBitmap.BlurType.GaussianBlur3x3)) //{ if (!_issplit) { ProcessUnifiedImage(image); } else { ProcessSplitImage(image); } //} } Thread.Sleep(1); } }
public ApplicationContext() { _pulseImpl1 = new PulseHandlerImpl("JBL Pulse Left"); _pulseImpl2 = new PulseHandlerImpl("JBL Pulse Right"); if (_pulseImpl1.ConnectMasterDevice() == false || _pulseImpl2.ConnectMasterDevice() == false) { Application.Exit(); } ; _harmanManager = new HarmanManager(_pulseImpl1); _harmanManager2 = new HarmanManager(_pulseImpl2); MenuItem configMenuItem = new MenuItem("Configuration", new EventHandler(ShowConfig)); MenuItem splitModeMenuItem = new MenuItem("Split mode", new EventHandler(SetSplitMode)); MenuItem unifiedModeMenuItem = new MenuItem("Unified mode", new EventHandler(SetUnifiedMode)); MenuItem exitMenuItem = new MenuItem("Exit", new EventHandler(Exit)); NotifyIcon notifyIcon = new NotifyIcon(); notifyIcon.Icon = Resource.MainIcon; notifyIcon.ContextMenu = new ContextMenu(new MenuItem[] { configMenuItem, splitModeMenuItem, unifiedModeMenuItem, exitMenuItem }); notifyIcon.Visible = true; MainForm = harmanForm; harmanForm.SingleModeEnabled += SetUnifiedMode; harmanForm.SplitModeEnabled += SetSplitMode; harmanForm.BrightnessDecreased += HarmanFormOnBrightnessDecreased; harmanForm.BrightnessIncreased += HarmanFormOnBrightnessIncreased; harmanForm.FlowthingsEnabled += HarmanForm_FlowthingsEnabled; harmanForm.FlowthingsSensorChanged += HarmanForm_FlowthingsSensorChanged; harmanForm.ManualBrightnessMode += HarmanFormOnManualBrightnessMode; harmanForm.AutomaticBrightnessMode += HarmanFormOnAutomaticBrightnessMode; HotKeys.RegisterHotKey(harmanForm.Handle, HotKeys.SingleMode, 3 /* ctrl+alt */, (int)Keys.D1); HotKeys.RegisterHotKey(harmanForm.Handle, HotKeys.SplitMode, 3 /* ctrl+alt */, (int)Keys.D2); HotKeys.RegisterHotKey(harmanForm.Handle, HotKeys.DecreaseBrightness, 3 /* ctrl+alt */, (int)Keys.OemMinus); HotKeys.RegisterHotKey(harmanForm.Handle, HotKeys.IncreaseBrightness, 3 /* ctrl+alt */, (int)Keys.Oemplus); HotKeys.RegisterHotKey(harmanForm.Handle, HotKeys.ManualBrightnessMode, 3 /* ctrl+alt */, (int)Keys.D9); HotKeys.RegisterHotKey(harmanForm.Handle, HotKeys.AutomaticBrightnessMode, 3 /* ctrl+alt */, (int)Keys.D0); captureThread = new Thread(ScreenCapture); captureThread.Start(); }