private async void Pierwszy_Click_Button(object sender, RoutedEventArgs e) { Frame appWindowFrame = new Frame(); AppWindow appWindow; appWindow = await AppWindow.TryCreateAsync(); //tworze okenko appWindowFrame.Navigate(typeof(SecendWindow)); // nawiguje do okna ktore chce wyswietlic ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowFrame); // podpinam xamla await appWindow.TryShowAsync(); //uruchamiam okienko }
private async void ShowWindowBtn_Click(object sender, RoutedEventArgs e) { // Clear any previous message. MainPage.Current.NotifyUser(string.Empty, NotifyType.StatusMessage); if (!Double.TryParse(windowOffsetXTxt.Text, out var horizontalOffset) || !Double.TryParse(windowOffsetYTxt.Text, out var verticalOffset)) { MainPage.Current.NotifyUser($"Please specify valid numeric offsets.", NotifyType.ErrorMessage); return; } showWindowBtn.IsEnabled = false; // Only ever create and show one window. if (appWindow == null) { // Create a new window appWindow = await AppWindow.TryCreateAsync(); // Make sure we release the reference to this window, and release XAML resources, when it's closed appWindow.Closed += delegate { appWindow = null; appWindowFrame.Content = null; }; // Request the size of our window appWindow.RequestSize(new Size(500, 320)); // Navigate the frame to the page we want to show in the new window appWindowFrame.Navigate(typeof(SecondaryAppWindowPage)); // Attach the XAML content to our window ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowFrame); } // Make a point for our offset. Point offset = new Point(horizontalOffset, verticalOffset); // Check if we should be setting our position relative to ApplicationView or DisplayRegion if (positionOffsetDisplayRegionRB.IsChecked.Value) { // Request an offset relative to the DisplayRegion we're on appWindow.RequestMoveRelativeToDisplayRegion(ApplicationView.GetForCurrentView().GetDisplayRegions()[0], offset); } else { // Relative to our ApplicationView appWindow.RequestMoveRelativeToCurrentViewContent(offset); } // If the window is not visible, show it and/or bring it to foreground if (!appWindow.IsVisible) { await appWindow.TryShowAsync(); } showWindowBtn.IsEnabled = true; }
private async void OpenEditDialog() { AppWindow appWindow = await AppWindow.TryCreateAsync(); Frame appWindowContentFrame = new Frame(); appWindow.Title = "Marker Infocard Window"; appWindow.RequestSize(new Size(200, 250)); appWindowContentFrame.Navigate(typeof(EditPage), SelectedLocation); ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowContentFrame); await appWindow.TryShowAsync(); }
private async void Recent_Click(object sender, RoutedEventArgs e) { List <StorageFile> files = new List <StorageFile>(); var mru = Windows.Storage.AccessCache.StorageApplicationPermissions.MostRecentlyUsedList; //StorageFile retrievedFile = await mru.GetFileAsync(token); foreach (Windows.Storage.AccessCache.AccessListEntry entry in mru.Entries) { string mruToken = entry.Token; string mruMetadata = entry.Metadata; try { Windows.Storage.IStorageItem item = await mru.GetItemAsync(mruToken); if (item is StorageFile) { //StorageFile item = await mru.GetFileAsync(mruToken); files.Add((StorageFile)item); } } catch (FileNotFoundException) {} } appWindow = await AppWindow.TryCreateAsync(); Frame appWindowContentFrame = new Frame(); appWindowContentFrame.Navigate(typeof(RecentList), RecognizerViewModel); ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowContentFrame); appWindow.RequestSize(new Size(500, 900)); await appWindow.TryShowAsync(); this.mainPage.IsEnabled = false; appWindow.Closed += delegate { // //Task.Delay(1000); // dictationTextBox.Text = ""; // appWindowContentFrame.Content = null; // appWindow = null; this.mainPage.IsEnabled = true; // recentFile = RecentList.openFile; // RecentList.openFile = null; // OpenFileDialog_Click(null, null); // }; }
// Create a new Window once the Tab is dragged outside. private async void Tabs_TabDroppedOutside(TabView sender, TabViewTabDroppedOutsideEventArgs args) { AppWindow newWindow = await AppWindow.TryCreateAsync(); var newPage = new TabViewWindowingSamplePage(); newPage.SetupWindow(newWindow); ElementCompositionPreview.SetAppWindowContent(newWindow, newPage); Tabs.TabItems.Remove(args.Tab); newPage.AddTabToTabs(args.Tab); await newWindow.TryShowAsync(); }
public override async Task <WindowHandle> OpenChannelWindowAsync(DiscordChannel channel, WindowHandle currentWindow = null) { if (!Supported) { return(null); } if (await ActivateOtherWindowAsync(channel, currentWindow)) { return(null); } Analytics.TrackEvent("AppWindowWindowingService_OpenChannelWindowAsync"); var window = await AppWindow.TryCreateAsync(); window.RequestMoveRelativeToCurrentViewContent(new Point(276, 0)); window.RequestSize(new Size(Window.Current.Bounds.Width - 276, Window.Current.Bounds.Height)); window.Title = NotificationUtils.GetChannelHeaderName(channel); var frame = new Frame(); frame.Navigate(typeof(MainPage), new MainPageArgs() { ChannelId = channel.Id, FullFrame = true }); ElementCompositionPreview.SetAppWindowContent(window, frame); var frame2 = ElementCompositionPreview.GetAppWindowContent(window); await window.TryShowAsync(); var handle = (AppWindowHandle)CreateOrUpdateHandle(frame, window); window.Closed += (o, e) => { _uiContextDictionary.TryRemove(handle.Context, out _); _windowChannelDictionary.TryRemove(handle, out _); handle = null; frame.Content = null; window = null; }; HandleTitleBarForWindow(null, frame); return(handle); }
private async void Compact_Click(object sender, RoutedEventArgs e) { if (_window == null) { OnBackRequestedOverride(this, new HandledRoutedEventArgs()); // Create a new AppWindow _window = await AppWindow.TryCreateAsync(); // Make sure we release the reference to this window, and release XAML resources, when it's closed _window.Closed += delegate { _window = null; _surface.NavigateToString(string.Empty); }; // Is CompactOverlay supported for this AppWindow? If not, then stop. if (_window.Presenter.IsPresentationSupported(AppWindowPresentationKind.CompactOverlay)) { // Create a new frame for the window // Navigate the frame to the CompactOverlay page inside it. //appWindowFrame.Navigate(typeof(SecondaryAppWindowPage)); // Attach the frame to the window Presenter.Child = new Border(); var w = Math.Max(_webPage.EmbedWidth, 340); var h = Math.Max(_webPage.EmbedHeight, 200); double ratioX = (double)340 / w; double ratioY = (double)340 / h; double ratio = Math.Min(ratioX, ratioY); ElementCompositionPreview.SetAppWindowContent(_window, _surface); // Let's set the title so that we can tell the windows apart _window.Title = _webPage.Title; _window.TitleBar.ExtendsContentIntoTitleBar = true; _window.RequestSize(new Size(w * ratio, h * ratio)); // Request the Presentation of the window to CompactOverlay var switched = _window.Presenter.RequestPresentation(AppWindowPresentationKind.CompactOverlay); if (switched) { // If the request was satisfied, show the window await _window.TryShowAsync(); } } } else { await _window.TryShowAsync(); } }
private async void OpenNewWindow(Type pageToOpen) { AppWindow window = await AppWindow.TryCreateAsync(); Frame frame = new Frame(); frame.Navigate(pageToOpen); ElementCompositionPreview.SetAppWindowContent(window, frame); await window.TryShowAsync(); window.Closed += delegate { frame.Content = null; window = null; }; }
private async void createTestSampleWindow() { if (TestSampleWindow == null) { // ※補足 playerDataFrame.Navigate() -> PlayerDataのコンテンツを持ってくるメソッド // ElementCompositionPreview.SetAppWindowContent() -> Windowにコンテンツを設置するメソッド // playerDataWindow.Closed += delegate -> ウィンドウが閉まった時にウィンドウにあるコンテンツインスタンスを消すメソッド TestSampleWindow = await AppWindow.TryCreateAsync(); Frame TestSampleFrame = new Frame(); TestSampleFrame.Navigate(typeof(testsample)); ElementCompositionPreview.SetAppWindowContent(TestSampleWindow, TestSampleFrame); await TestSampleWindow.TryShowAsync(); TestSampleWindow.Closed += delegate { TestSampleFrame.Content = null; TestSampleWindow = null; }; } else { Frame TestSampleFrame = new Frame(); TestSampleFrame.Navigate(typeof(testsample)); ElementCompositionPreview.SetAppWindowContent(TestSampleWindow, TestSampleFrame); await TestSampleWindow.TryShowAsync(); TestSampleWindow.Closed += delegate { TestSampleFrame.Content = null; TestSampleWindow = null; }; } }
private async void ShowWindowBtn_Click(object sender, RoutedEventArgs e) { // Clear any previous message. MainPage.Current.NotifyUser(string.Empty, NotifyType.StatusMessage); Double.TryParse(windowWidthTxt.Text, out var windowWidth); Double.TryParse(windowHeightTxt.Text, out var windowHeight); if (windowWidth < MinWindowWidth || windowHeight < MinWindowHeight) { MainPage.Current.NotifyUser($"Please specify a width of at least {MinWindowWidth} and a height of at least {MinWindowHeight}.", NotifyType.ErrorMessage); return; } showWindowBtn.IsEnabled = false; // Only ever create and show one window. If the AppWindow exists use it if (appWindow == null) { // Create a new window appWindow = await AppWindow.TryCreateAsync(); // Make sure we release the reference to this window, and release XAML resources, when it's closed appWindow.Closed += delegate { appWindow = null; appWindowFrame.Content = null; }; // Navigate the frame to the page we want to show in the new window appWindowFrame.Navigate(typeof(SecondaryAppWindowPage)); } // If specified size is smaller than the default min size for a window we need to set a new preferred min size first. // Let's set it to the smallest allowed and leave it at that. if (windowWidth < 500 || windowHeight < 320) { WindowManagementPreview.SetPreferredMinSize(appWindow, new Size(MinWindowWidth, MinWindowHeight)); } // Request the size of our window appWindow.RequestSize(new Size(windowWidth, windowHeight)); // Attach the XAML content to our window ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowFrame); // If the window is not visible, show it and/or bring it to foreground if (!appWindow.IsVisible) { await appWindow.TryShowAsync(); } showWindowBtn.IsEnabled = true; }
/* -- Method Header Comment * Name : ViewLeaderboard * Purpose : Displays the Leaderboard on a new window * Inputs : None * Outputs : The Leaderboard in a new window * Returns : None */ private static async void ViewLeaderboard() { var leaderboardWindow = await AppWindow.TryCreateAsync(); var appWindowContentFrame = new Frame(); appWindowContentFrame.Navigate(typeof(Leaderboard)); ElementCompositionPreview.SetAppWindowContent(leaderboardWindow, appWindowContentFrame); await leaderboardWindow.TryShowAsync(); leaderboardWindow.Closed += delegate { appWindowContentFrame.Content = null; leaderboardWindow = null; }; }
private async void ShowNewWindow(object sender, RoutedEventArgs e, Człowiek osoba) { // Create a new window appWindow = await AppWindow.TryCreateAsync(); // Navigate our frame to the page we want to show in the new window appWindowFrame.Navigate(typeof(Sczegoly), osoba); // Attach the XAML content to our window ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowFrame); // Show the window appWindow.Closed += delegate { appWindowFrame.Content = null; appWindow = null; }; await appWindow.TryShowAsync(); }
private async void ShowWindowBtn_Click(object sender, RoutedEventArgs e) { // Is CompactOverlay supported for our main window? // If so, it will be supported for a new window as well. // If it isn't, it will not be supported for new windows either so we cannot proceed. if (!ApplicationView.GetForCurrentView().IsViewModeSupported(ApplicationViewMode.CompactOverlay)) { return; } showWindowBtn.IsEnabled = false; if (appWindow == null) { // Create a new AppWindow appWindow = await AppWindow.TryCreateAsync(); // Make sure we release the reference to this window, and release XAML resources, when it's closed appWindow.Closed += delegate { appWindow = null; appWindowFrame.Content = null; }; // Is CompactOverlay supported for this AppWindow? If not, then stop. if (appWindow.Presenter.IsPresentationSupported(AppWindowPresentationKind.CompactOverlay)) { // Create a new frame for the window // Navigate the frame to the CompactOverlay page inside it. appWindowFrame.Navigate(typeof(SecondaryAppWindowPage)); // Attach the frame to the window ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowFrame); // Let's set the title so that we can tell the windows apart appWindow.Title = "CompactOverlay Window"; // Request the Presentation of the window to CompactOverlay bool switched = appWindow.Presenter.RequestPresentation(AppWindowPresentationKind.CompactOverlay); if (switched) { // If the request was satisfied, show the window await appWindow.TryShowAsync(); } } } else { await appWindow.TryShowAsync(); } showWindowBtn.IsEnabled = true; }
private async void OnWonderbarClick(object sender, RoutedEventArgs e) { // 1. Create a new Window. var appWindow = await AppWindow.TryCreateAsync(); // 2. Create the page and set the new window's content.. ElementCompositionPreview.SetAppWindowContent(appWindow, new WonderbarPage(appWindow)); // 3. Check if you can leverage the compact overlay APIs. if (appWindow.Presenter.IsPresentationSupported(AppWindowPresentationKind.CompactOverlay)) { // 4. Show the window. await appWindow.TryShowAsync(); // 5. If so, change that window to be inside the compact overlay region. appWindow.Presenter.RequestPresentation(AppWindowPresentationKind.CompactOverlay); } }
// Create a new Window once the Tab is dragged outside. private async void Tabs_TabDroppedOutside(TabView sender, TabViewTabDroppedOutsideEventArgs args) { AppWindow newWindow = await AppWindow.TryCreateAsync(); var newPage = new MainPage(); newPage.SetupWindow(newWindow); ElementCompositionPreview.SetAppWindowContent(newWindow, newPage); Tabs.TabItems.Remove(args.Tab); newPage.AddTabToTabs(args.Tab); // TODO: Remove when TabView.TabItems.VectorChagned is exposed. sender.Tag = newWindow; await newWindow.TryShowAsync(); }
async void showNewWindow() { // Create a new window var appWindow = await AppWindow.TryCreateAsync(); // Navigate our frame to the page we want to show in the new window //var appWindowFrame = new Frame(); //appWindowFrame.Navigate(typeof(AppWindowMainPage)); Button saveBtn = new Button(); saveBtn.Content = "Save screenshot"; saveBtn.Click += SaveBtn_Click; // Attach the XAML content to our window ElementCompositionPreview.SetAppWindowContent(appWindow, saveBtn); // Show the window await appWindow.TryShowAsync(); }
private async void _MenuItem_ReferencePicture_Click(object sender, RoutedEventArgs e) { FileOpenPicker fileOpenPicker1 = new FileOpenPicker(); fileOpenPicker1.FileTypeFilter.Add(".bmp"); fileOpenPicker1.FileTypeFilter.Add(".jpg"); fileOpenPicker1.FileTypeFilter.Add(".jpeg"); fileOpenPicker1.FileTypeFilter.Add(".png"); fileOpenPicker1.FileTypeFilter.Add(".gif"); fileOpenPicker1.FileTypeFilter.Add(".tif"); StorageFile file = await fileOpenPicker1.PickSingleFileAsync(); if (file == null) { return; } AppWindow referencePicture = await AppWindow.TryCreateAsync(); Image imageControl = new Image(); var img1 = new BitmapImage(); try { await img1.SetSourceAsync(await file.OpenReadAsync()); imageControl.Source = img1; ElementCompositionPreview.SetAppWindowContent(referencePicture, imageControl); if (referencePicture.Presenter.IsPresentationSupported(AppWindowPresentationKind.CompactOverlay)) { referencePicture.Title = "参考图片"; if (referencePicture.Presenter.RequestPresentation(AppWindowPresentationKind.CompactOverlay)) { referencePicture.RequestSize(new Size(img1.PixelWidth, img1.PixelHeight)); await referencePicture.TryShowAsync(); img1.Play(); } } } catch { } }
private async void HyperlinkButton_Click(object sender, RoutedEventArgs e) { AppWindow appWindow = await AppWindow.TryCreateAsync(); Frame appWindowContentFrame = new Frame(); appWindowContentFrame.Navigate(typeof(AddConversationPage)); ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowContentFrame); await appWindow.TryShowAsync(); appWindow.Closed += delegate { appWindowContentFrame.Content = null; appWindow = null; ViewModel.AppWindow = null; }; ViewModel.AppWindow = appWindow; }
/// <summary> /// Open Store DevTools in a separate window. /// </summary> /// <typeparam name="TState">Type of the state.</typeparam> /// <param name="store">Store to display information about.</param> /// <returns>True if the Store DevTools has been shown.</returns> public static async Task <bool> OpenDevToolsAsync <TState>(this ReduxStore <TState> store) where TState : class, new() { if (store == null || !store.TimeTravelEnabled) { return(false); } var appWindow = await AppWindow.TryCreateAsync(); var appWindowContentFrame = new Frame(); appWindowContentFrame.Navigate(typeof(DevToolsComponent)); var devToolsComponent = appWindowContentFrame.Content as DevToolsComponent; devToolsComponent.Initialize(store); // TODO : Set as options // Extend view into title bar appWindow.TitleBar.ExtendsContentIntoTitleBar = true; // TODO : Set as options // Set TitleBar properties (colors) appWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; appWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; appWindow.TitleBar.ButtonHoverBackgroundColor = Color.FromArgb(255, 72, 42, 203); appWindow.TitleBar.ButtonPressedBackgroundColor = Color.FromArgb(200, 72, 42, 203); appWindow.TitleBar.ButtonForegroundColor = Colors.Black; ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowContentFrame); bool result = await appWindow.TryShowAsync(); appWindow.Closed += delegate { appWindowContentFrame.Content = null; appWindow = null; }; return(result); }
private async void Attribute_Click(object sender, RoutedEventArgs e) { if (SearchResultList.SelectedItem is FileSystemStorageItemBase Item) { AppWindow NewWindow = await AppWindow.TryCreateAsync(); NewWindow.RequestSize(new Size(420, 600)); NewWindow.RequestMoveRelativeToCurrentViewContent(new Point(Window.Current.Bounds.Width / 2 - 200, Window.Current.Bounds.Height / 2 - 300)); NewWindow.PersistedStateId = "Properties"; NewWindow.Title = Globalization.GetString("Properties_Window_Title"); NewWindow.TitleBar.ExtendsContentIntoTitleBar = true; NewWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; NewWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; ElementCompositionPreview.SetAppWindowContent(NewWindow, new PropertyBase(NewWindow, Item)); WindowManagementPreview.SetPreferredMinSize(NewWindow, new Size(420, 600)); await NewWindow.TryShowAsync(); } }
public async Task ShowWebView(int width, int height) { appWindow = await AppWindow.TryCreateAsync(); webView.Width = width; webView.Height = height; appWindow.RequestSize(new Windows.Foundation.Size(width, height)); ElementCompositionPreview.SetAppWindowContent(appWindow, webView); httpRequestMessage.Method = HttpMethod.Get; httpRequestMessage.RequestUri = new Uri(loginUri); appWindow.Closed += delegate { appWindow = null; httpRequestMessage.Dispose(); filter.Dispose(); webView.Stop(); }; webView.NavigateWithHttpRequestMessage(httpRequestMessage); await appWindow.TryShowAsync(); }
private async void AppWindow_Launch(object sender, RoutedEventArgs e) { AppWin = await AppWindow.TryCreateAsync(); Frame appWindowContentFrame = new Frame(); appWindowContentFrame.Navigate(typeof(BlankPage2)); ElementCompositionPreview.SetAppWindowContent(AppWin, appWindowContentFrame); AppWindows.Add(appWindowContentFrame.UIContext, AppWin); AppWin.Title = "App Window " + AppWindows.Count.ToString(); AppWin.Closed += delegate { MainPage.AppWindows.Remove(appWindowContentFrame.UIContext); appWindowContentFrame.Content = null; AppWin = null; }; await AppWin.TryShowAsync(); }
private async void LibraryProperties_Click(object sender, RoutedEventArgs e) { if (LibraryGrid.SelectedItem is LibraryFolder Library) { FileSystemStorageFolder Folder = new FileSystemStorageFolder(Library.Folder, await Library.Folder.GetThumbnailBitmapAsync(), await Library.Folder.GetModifiedTimeAsync()); AppWindow NewWindow = await AppWindow.TryCreateAsync(); NewWindow.RequestSize(new Size(420, 600)); NewWindow.RequestMoveRelativeToCurrentViewContent(new Point(Window.Current.Bounds.Width / 2 - 200, Window.Current.Bounds.Height / 2 - 300)); NewWindow.PersistedStateId = "Properties"; NewWindow.Title = Globalization.GetString("Properties_Window_Title"); NewWindow.TitleBar.ExtendsContentIntoTitleBar = true; NewWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; NewWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; ElementCompositionPreview.SetAppWindowContent(NewWindow, new PropertyBase(NewWindow, Folder)); WindowManagementPreview.SetPreferredMinSize(NewWindow, new Size(420, 600)); await NewWindow.TryShowAsync(); } }
//public Reports Reports { get; set; } = new Reports(); private async void ShowNewWindowButton_Click(object sender, RoutedEventArgs e) { // Create a new window. // Only ever create one window. If the AppWindow already exists call TryShow on it to bring it to foreground. if (AppWindow == null) { // Create a new window AppWindow = await AppWindow.TryCreateAsync(); // Make sure we release the reference to this window, and release XAML resources, when it's closed AppWindow.Closed += delegate { AppWindow = null; appWindowFrame.Content = null; }; // Navigate the frame to the page we want to show in the new window appWindowFrame.Navigate(typeof(report)); // Attach the XAML content to our window ElementCompositionPreview.SetAppWindowContent(AppWindow, appWindowFrame); } // Now show the window await AppWindow.TryShowAsync(); // ... }
// Obtain from MS docs // https://docs.microsoft.com/en-us/windows/uwp/design/layout/app-window private async void NewWindow(String Title, Type Page) { appWindow = await AppWindow.TryCreateAsync(); appWindow.Title = Title; Frame appWindowContentFrame = new Frame(); appWindowContentFrame.Navigate(Page); ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowContentFrame); AppWindows.Add(appWindowContentFrame.UIContext, appWindow); appWindow.Closed += delegate { MainPage.AppWindows.Remove(appWindowContentFrame.UIContext); appWindowContentFrame.Content = null; appWindow = null; }; await appWindow.TryShowAsync(); }
public async Task<bool> TryCreateNewWindowAsync(TabViewViewModel tabView, Size size) { AppWindow appWindow = await AppWindow.TryCreateAsync(); Frame frame = new Frame(); frame.Navigate(typeof(AppWindowPage), new TabViewNavigationParameters(tabView, appWindow)); ElementCompositionPreview.SetAppWindowContent(appWindow, frame); WindowManagementPreview.SetPreferredMinSize(appWindow, new Size(MinWindowWidth, MinWindowHeight)); appWindow.RequestSize(size); appWindow.TitleBar.ExtendsContentIntoTitleBar = true; appWindow.TitleBar.ButtonBackgroundColor = Colors.Transparent; appWindow.TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent; appWindow.RequestMoveAdjacentToCurrentView(); bool success = await appWindow.TryShowAsync(); return success; }
private async void AppBarButton_Click_3(object sender, RoutedEventArgs e) { try { blankPagePlot = new BlankPagePlot(); appWindow = await AppWindow.TryCreateAsync(); ElementCompositionPreview.SetAppWindowContent(appWindow, blankPagePlot); v = await appWindow.TryShowAsync(); if (v) { blankPagePlot.iniPlot(bluetoothConnectionHandler.naame); blankPagePlot.PlotModel.addSeries(); Size size = new Size() { Height = 100, Width = 100 }; appWindow.RequestSize(size); appWindow.Closed += delegate { v = false; blankPagePlot = null; appWindow = null; bluetoothConnectionHandler.blankPagePlot = null; bluetoothConnectionHandler.v = false; bluetoothConnectionHandler.appWindow = null; }; bluetoothConnectionHandler.blankPagePlot = blankPagePlot; bluetoothConnectionHandler.v = v; bluetoothConnectionHandler.appWindow = appWindow; } } catch (Exception) { } }
// Create a new Window once the Tab is dragged outside. private async void Tabs_TabDroppedOutside(TabView sender, TabViewTabDroppedOutsideEventArgs args) { // AppWindow was introduced in Windows 10 version 18362 (ApiContract version 8). // If the app is running on a version earlier than 18362, simply no-op. // If your app needs to support multiple windows on earlier versions of Win10, you can use CoreWindow/ApplicationView. // More information about showing multiple views can be found here: https://docs.microsoft.com/windows/uwp/design/layout/show-multiple-views if (!ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) { return; } AppWindow newWindow = await AppWindow.TryCreateAsync(); var newPage = new TabViewWindowingSamplePage(); newPage.SetupWindow(newWindow); ElementCompositionPreview.SetAppWindowContent(newWindow, newPage); Tabs.TabItems.Remove(args.Tab); newPage.AddTabToTabs(args.Tab); await newWindow.TryShowAsync(); }
private async void Listview_SelectionChanged(object sender, SelectionChangedEventArgs e) { var memoid = Listview.SelectedItem; memoframe.Navigate(typeof(MemoDetailsForReport), memoid); if (AppWindow == null) { // Create a new window AppWindow = await AppWindow.TryCreateAsync(); // Make sure we release the reference to this window, and release XAML resources, when it's closed AppWindow.Closed += delegate { AppWindow = null; appWindowFrame.Content = null; }; // Navigate the frame to the page we want to show in the new window appWindowFrame.Navigate(typeof(report), memoid); // Attach the XAML content to our window ElementCompositionPreview.SetAppWindowContent(AppWindow, appWindowFrame); } // Now show the window await AppWindow.TryShowAsync(); //memoframe.Navigate(typeof(report), memoid); }
public static async Task <CompactModeArgs> OpenCompactMode(ContentPage contentPage) { if (!ApiInformation.IsTypePresent("global::Windows.UI.WindowManagement.AppWindow")) { return(new CompactModeArgs(null, false)); } // 1. Create a new Window AppWindow appWindow = await AppWindow.TryCreateAsync(); var frameworkElement = contentPage.CreateFrameworkElement(); global::Windows.UI.Xaml.Controls.Frame frame = new global::Windows.UI.Xaml.Controls.Frame() { Content = frameworkElement }; // 2. Create the pageand set the new window's content ElementCompositionPreview.SetAppWindowContent(appWindow, frame); CompactModeArgs args = null; // 3. Check if you can leverage the compact overlay APIs if (appWindow.Presenter.IsPresentationSupported(AppWindowPresentationKind.CompactOverlay)) { // 4. Show the window bool result = await appWindow.TryShowAsync(); if (result) { bool windowClosed = false; appWindow.Presenter.RequestPresentation(AppWindowPresentationKind.CompactOverlay); frame.SizeChanged += OnFrameSizeChanged; appWindow.Closed += AppWindow_Closed; args = new CompactModeArgs(async() => { if (windowClosed) { return; } frame.SizeChanged -= OnFrameSizeChanged; await appWindow.CloseAsync(); }, true); void OnFrameSizeChanged(object sender, global::Windows.UI.Xaml.SizeChangedEventArgs e) { if (windowClosed) { return; } contentPage.HeightRequest = frame.ActualWidth; contentPage.WidthRequest = frame.ActualHeight; Layout.LayoutChildIntoBoundingRegion(contentPage, new Rectangle(0, 0, frame.ActualWidth, frame.ActualHeight)); } void AppWindow_Closed(AppWindow sender, AppWindowClosedEventArgs a) { frame.SizeChanged -= OnFrameSizeChanged; windowClosed = true; } } } if (args == null) { args = new CompactModeArgs(null, false); } return(args); }