Beispiel #1
0
        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            foreach (var item in RecordingDetailMethods.AsStringArray())
            {
                recordingDetail.Items.Add(item);
            }

            presentMon     = new PresentMonWrapper();
            overlayTracker = new OverlayTracker();

            IntPtr hwnd = GetHWND();

            enableRecordings = presentMon.Init(hwnd);

            bool enableOverlay = overlayTracker.Init(hwnd);

            if (!enableOverlay)
            {
                SetInjectionMode(InjectionMode.Disabled);
                tabControl.Visibility          = Visibility.Collapsed;
                overlayStateTextBox.Visibility = Visibility.Visible;
            }

            delayTimer = new DelayTimer(UpdateDelayTimer, StartRecordingDelayed);
            toggleRecordingKeyboardHook.HotkeyDownEvent  += new KeyboardHook.KeyboardDownEvent(ToggleRecordingKeyDownEvent);
            toggleVisibilityKeyboardHook.HotkeyDownEvent += new KeyboardHook.KeyboardDownEvent(overlayTracker.ToggleOverlayVisibility);
            LoadConfiguration();

            // set the event listener after loading the configuration to avoid sending the first property change event.
            userInterfaceState.PropertyChanged += OnUserInterfacePropertyChanged;

            HwndSource source = PresentationSource.FromVisual(this) as HwndSource;

            source.AddHook(WndProc);

            if (recordingOptions.injectOnStart)
            {
                StartCapture(InjectionMode.All);
            }
        }
Beispiel #2
0
        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            presentMon     = new PresentMonWrapper();
            overlayTracker = new OverlayTracker();

            IntPtr hwnd = GetHWND();

            enableRecordings = presentMon.Init(hwnd, System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString());

            bool enableOverlay = overlayTracker.Init(hwnd);

            if (!enableOverlay)
            {
                SetInjectionMode(InjectionMode.Disabled);
                tabControl.Visibility          = Visibility.Collapsed;
                overlayStateTextBox.Visibility = Visibility.Visible;
            }

            delayTimer = new DelayTimer(UpdateDelayTimer, StartRecordingDelayed);
            toggleRecordingKeyboardHook.HotkeyDownEvent              += new KeyboardHook.KeyboardDownEvent(ToggleRecordingKeyDownEvent);
            toggleVisibilityKeyboardHook.HotkeyDownEvent             += new KeyboardHook.KeyboardDownEvent(overlayTracker.ToggleOverlayVisibility);
            toggleGraphVisibilityKeyboardHook.HotkeyDownEvent        += new KeyboardHook.KeyboardDownEvent(overlayTracker.ToggleGraphOverlayVisibility);
            toggleBarVisibilityKeyboardHook.HotkeyDownEvent          += new KeyboardHook.KeyboardDownEvent(overlayTracker.ToggleBarOverlayVisibility);
            toggleLagIndicatorVisibilityKeyboardHook.HotkeyDownEvent += new KeyboardHook.KeyboardDownEvent(overlayTracker.ToggleLagIndicatorOverlayVisibility);
            LoadConfiguration();

            // set the event listener after loading the configuration to avoid sending the first property change event.
            userInterfaceState.PropertyChanged += OnUserInterfacePropertyChanged;

            HwndSource source = PresentationSource.FromVisual(this) as HwndSource;

            source.AddHook(WndProc);

            if (recordingOptions.injectOnStart)
            {
                StartCapture(InjectionMode.All);
            }
        }