With this code I am creating new view:
CoreApplicationView newView = CoreApplication.CreateNewView();
int newViewId = 0;
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
Frame frame = new Frame();
frame.Navigate(typeof(SecondaryPage), null);
Window.Current.Content = frame;
// You have to activate the window in order to show it later.
Window.Current.Activate();
newViewId = ApplicationView.GetForCurrentView().Id;
});
bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
When I close that new window, and run code again, and again I close that new one and again I open another window, memory usage in windows is getting larger and larger...so, I think all the windows are not closed, but just hidden actually...
So, there are 2 ways I am trying:
- Try to actually "kill" the closed window
- Try to re-show hidden window and make it's content different...
I just want there to be only 2 windows, main and this newly created... Any suggestion on how to do this?
Edit:
This is what it looks like when I use this example https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/MultipleViews
These are 3 screenshots with this app.
This is memory consumption when app is started:
This is after I add 4 views:
And this is when I open and close each one of them:
So, even in their example memory usage is rising...