private void OnEvent(EventParameters <EventAggregator> obj) { switch (obj.Topic) { case EventTopicNames.ActivateMenuView: if (IsPortrait) { Grid2.SelectedIndex = 1; } break; case EventTopicNames.ActivatePosView: if (IsPortrait) { Grid2.SelectedIndex = 0; } LayoutTabControl.BackgroundFocus(); break; case EventTopicNames.DisableLandscape: DisableLandscapeMode(); break; case EventTopicNames.EnableLandscape: EnableLandscapeMode(); break; } }
public IEnumerable <MetadataView> GetMetadataViews(Window window) { DebugHelper.AssertUIThread(); if (window == null) { throw new ArgumentNullException("window"); } while (window.Owner != null) { window = window.Owner; } IEnumerable <MetadataView> value = null; ToolsUIWindow toolsWindow = window as ToolsUIWindow; if (toolsWindow != null) { LayoutTabControl tabControl = toolsWindow.LayoutTabControl; if (tabControl != null) { int layoutIndex = tabControl.SelectedIndex; List <MetadataView> activeTab = new List <MetadataView>(); List <MetadataView> otherTabs = new List <MetadataView>(); List <MetadataView> temp = new List <MetadataView>(); for (int i = 0; i < tabControl.Items.Count; ++i) { List <MetadataView> list = (i == layoutIndex) ? activeTab : temp; LayoutInstance layout = tabControl.Items[i] as LayoutInstance; if (layout != null) { foreach (View v in layout.FindViews("MetadataView")) { MetadataView mv = v as MetadataView; if (mv != null) { list.Add(mv); } } } if ((i != layoutIndex) && (list.Count > 0)) { if (otherTabs.Count > 0) { otherTabs.Add(null); } otherTabs.AddRange(list.OrderBy(mv => mv.Title)); list.Clear(); } } List <MetadataView> metadataViews = new List <MetadataView>(); if (activeTab.Count > 0) { metadataViews.AddRange(activeTab.OrderBy(mv => mv.Title)); if (otherTabs.Count > 0) { metadataViews.Add(null); } } metadataViews.AddRange(otherTabs); value = metadataViews; } } return(value); }