コード例 #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            thisViewControl = (ViewLifeTimeControl)e.Parameter;
            mainViewId      = ((App)App.Current).MainViewId;
            mainDispatcher  = ((App)App.Current).MainDispatcher;

            // When this view is finally release, clean up state
            thisViewControl.Released += ViewLifetimeControl_Released;
        }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: shakir820/UWP-Apps-Sample
 private bool TryFindViewLifetimeControlForViewId(int ViewId, out ViewLifeTimeControl foundData)
 {
     foreach (var viewLifeTimeControl in SecondaryViews)
     {
         if (viewLifeTimeControl.Id == ViewId)
         {
             foundData = viewLifeTimeControl;
             return(true);
         }
     }
     foundData = null;
     return(false);
 }
コード例 #3
0
        private async void CreateView_Click(object sender, RoutedEventArgs e)
        {
            ViewLifeTimeControl viewControl = null;
            await CoreApplication.CreateNewView().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                viewControl       = ViewLifeTimeControl.CreateForCurrentView();
                viewControl.Title = DEFAULT_TITLE;
                viewControl.StartViewInUse();
                Frame frame = new Frame();
                frame.Navigate(typeof(SecondaryViewPage), viewControl);
                Window.Current.Content = frame;
                Window.Current.Activate();
                ApplicationView.GetForCurrentView().Title = viewControl.Title;
            });

            ((App)App.Current).SecondaryViews.Add(viewControl);
        }