Exemplo n.º 1
0
 public MainPage()
 {
     this.InitializeComponent();
     this.navigationHelper = new NavigationHelper(this);
     this.navigationHelper.LoadState += navigationHelper_LoadState;
     this.navigationHelper.SaveState += navigationHelper_SaveState;
     Window.Current.SizeChanged += Window_SizeChanged;
     SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
 }
Exemplo n.º 2
0
        public ClassicPage()
        {
            this.InitializeComponent();

            // Setup the navigation helper
            this.navigationHelper = new NavigationHelper(this);
            this.navigationHelper.LoadState += navigationHelper_LoadState;
            this.navigationHelper.SaveState += navigationHelper_SaveState;

            // listen for the user activating settings
            SettingsPane.GetForCurrentView().CommandsRequested += OnSettingsPaneCommandsRequested;
           
            // Setup the logical page navigation components that allow
            // the page to only show one pane at a time.
            this.navigationHelper.GoBackCommand = new RelayCommand(() => this.GoBack(), () => this.CanGoBack());
            this.itemListView.SelectionChanged += itemListView_SelectionChanged;

            // Start listening for progress report changes
            this.progress = new LoadingToken();
            LoadingToken.ReportProgress += LoadingToken_ReportProgress;

            // Initialize Wrapper
            this.viewModelWrapper = new ClassicPageViewModel(this, this.defaultViewModel, this.progress);

            // Initialize the webview
            this.domReady = new TaskCompletionSource<bool>();
            this.itemDetailPanel.IsHitTestVisible = false;
            this.itemDetail.DOMContentLoaded += webView_DOMContentLoaded;
            this.itemDetail.ScriptNotify += itemDetail_ScriptNotify;
            this.itemDetail.NavigationStarting += itemDetail_NavigationStarting;
            this.itemDetail.Navigate(new Uri("ms-appx-web:///webview/webview.html", UriKind.Absolute));

            // Start listening for Window size changes 
            // to change from showing two panes to showing a single pane
            Window.Current.SizeChanged += Window_SizeChanged;
            this.InvalidateVisualState();
        }