private bool HandleCapturePanelFocusRequest(ScreenCapturePanel panel) { lock (visibilitySync) { if (this.currentCapturePanel != null && this.currentCapturePanel != panel) { return(false); } var match = this.screenCapturePanels.Items .Cast <TabItem>() .Select((t, i) => new { Index = i, Tab = t }) .FirstOrDefault(t => t.Tab.Content == panel); if (match == null) { this.featureLogger.Warn("Unexpected state! Not able to find panel {0}, panel was possibly recycled.", panel.Config.PrettyName); return(false); } this.currentCapturePanel = panel; this.screenCapturePanels.SelectedIndex = match.Index; return(true); } }
private void HandleCapturePanelReleaseFocusRequest(ScreenCapturePanel panel) { lock (visibilitySync) { if (this.currentCapturePanel == panel) { this.currentCapturePanel = null; } } }
private void AddNewUserCreatedCapturePanel(ScreenCapturePanelConfig config) { var panel = new ScreenCapturePanel( this.config, config, this.featureLogger, this.timedCaptureService, this.capturePublisher, this.HandleCapturePanelFocusRequest, this.HandleCapturePanelReleaseFocusRequest); var tab = new TabItem() { Content = panel, Header = panel.Config.Name }; this.screenCapturePanels.Items.Insert(0, tab); this.screenCapturePanels.SelectedIndex = 0; this.featureLogger.Info("Added new Capture Panel named {0}", panel.Config.PrettyName); this.UpdateCaptureServiceWithPanels(); }