private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 1 && e.AddedItems[0] != SelectedItem) { return; } if ((this.SelectedItem != null) && ((this.SelectedItem as C1USDDockTabItem).Tag is IHostedApplication)) { if (DesktopApplicationUIBase.AppWithFocus == (this.SelectedItem as C1USDDockTabItem).Tag as IHostedApplication) { return; } DesktopApplicationUIBase.AppWithFocus = (this.SelectedItem as C1USDDockTabItem).Tag as IHostedApplication; try { if (HaltSelectionLogic == false) { CRMGlobalManager.SetAppWithFocus((this.SelectedItem as C1USDDockTabItem).Tag as IHostedApplication, this, this._panelName); } } catch { } } WpfDesktopApplicationUI.ActivePanel = this.Parent as WpfPanel; if (this.SelectedAppChangedEvent != null) { this.SelectedAppChangedEvent(sender, e); } }
public void SetActiveApplication(IHostedApplication app) { IHostedApplication tabApp; foreach (C1USDDockTabItem item in Items) { tabApp = item.Tag as IHostedApplication; if ((tabApp != null) && (tabApp.ApplicationID == app.ApplicationID)) { SelectedItem = item; try { CRMGlobalManager.SetAppWithFocus((this.SelectedItem as C1USDDockTabItem).Tag as IHostedApplication, this, this._panelName); } catch { } WpfDesktopApplicationUI.ActivePanel = this.Parent as WpfPanel; if (this.SelectedAppChangedEvent != null) { this.SelectedAppChangedEvent(null, null); } return; } } }
void USDTabBasePanel_GotFocus(object sender, RoutedEventArgs e) { if ((this.SelectedItem != null) && ((this.SelectedItem as C1USDDockTabItem).Tag is IHostedApplication)) { if (DesktopApplicationUIBase.AppWithFocus == (this.SelectedItem as C1USDDockTabItem).Tag as IHostedApplication) { return; } DesktopApplicationUIBase.AppWithFocus = (this.SelectedItem as C1USDDockTabItem).Tag as IHostedApplication; try { if (HaltSelectionLogic == false) { CRMGlobalManager.SetAppWithFocus((this.SelectedItem as C1USDDockTabItem).Tag as IHostedApplication, this, this._panelName); } } catch { } } WpfDesktopApplicationUI.ActivePanel = this.Parent as WpfPanel; if (this.SelectedAppChangedEvent != null) { this.SelectedAppChangedEvent(sender, e); } }