void _closeWindowButton_Click(object sender, RoutedEventArgs e) { List <CoreWindow> windowList = DXInteropApp.WindowList; if (windowList.Count == 1) { this.WindowIndex.Text = "This is the only window, and it can't be closed"; return; } int index = windowList.FindIndex((cw) => { return(cw.GetHashCode() == Window.Current.CoreWindow.GetHashCode()); }); if (index > 0) { DXInteropApp.ActivateWindow(index - 1); this.WindowIndex.Text = (index - 1).ToString(); } else { DXInteropApp.ActivateWindow(index + 1); this.WindowIndex.Text = (index + 1).ToString(); } DXInteropApp.CloseWindow(index); lock (DXInteropApp.WindowList) { DXInteropApp.WindowList.Remove(windowList[index]); } }
void _createWindowButton_Click(object sender, RoutedEventArgs e) { CoreApplicationView cav = CoreApplication.CreateNewView("", "content"); var nowait = cav.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { Window.Current.Content = new MainPage(); List <CoreWindow> windowList = DXInteropApp.WindowList; int index = windowList.FindIndex((cw) => { return(cw.GetHashCode() == Window.Current.CoreWindow.GetHashCode()); }); DXInteropApp.ActivateWindow(index); }); }
void _previousWindowButton_Click(object sender, RoutedEventArgs e) { List <CoreWindow> windowList = DXInteropApp.WindowList; int index = windowList.IndexOf(Window.Current.CoreWindow); if (index == 0) { this.WindowIndex.Text = "No previous window"; } else { DXInteropApp.ActivateWindow(index - 1); this.WindowIndex.Text = (index - 1).ToString(); } }
public void InitializeComponent() { Application.LoadComponent(this, new System.Uri("ms-resource:Files/MainPage.xaml")); App = (DXInteropApp)Application.Current; SwapChainBackgroundPanel customSCBP = this.SetupSCBPTree(); this.Content = customSCBP; // On SurfaceContentsLost we create a new device, set a new SC, and recover SIS/VSIS contents, but apperentlly the device will not be ready for the next CompositionTarget_Rendering. CompositionTarget.SurfaceContentsLost += new System.EventHandler <object>(CompositionTarget_SurfaceContentsLost); CompositionTarget.Rendering += new System.EventHandler <object>(CompositionTarget_Rendering); DXInteropApp.WindowList.Add(Window.Current.CoreWindow); Window.Current.Activated += new WindowActivatedEventHandler(Current_Window_Activated); }
void _nextWindowButton_Click(object sender, RoutedEventArgs e) { List <CoreWindow> windowList = DXInteropApp.WindowList; int index = windowList.FindIndex((cw) => { return(cw.GetHashCode() == Window.Current.CoreWindow.GetHashCode()); }); if (index == windowList.Count - 1) { this.WindowIndex.Text = "No next window"; } else { DXInteropApp.ActivateWindow(index + 1); this.WindowIndex.Text = (index + 1).ToString(); } }