Example #1
0
        /// <summary>
        /// Default constructor
        /// </summary>
        public BrowserView(BrowserViewModel viewModel)
        {
            this.ViewModel = viewModel;
            this.ViewModel.PropertyChanged += ViewModel_PropertyChanged;
            InitializeComponent();

            this.Loaded += (o, e) => this.MinHeight = this.TitleBar.ActualHeight;

            webControl.ShowCreatedWebView += webControl_ShowCreatedWebView;
            this.Closed += BrowserView_Closed;

            this.webControl.Source = this.ViewModel.Source;
            this.beforeCollapseHeight = this.Height;
        }
Example #2
0
        /// <summary>
        /// Constructor with an input native view
        /// </summary>
        /// <param name="nativeView"></param>
        public BrowserView(BrowserViewModel viewModel, IntPtr nativeView)
        {
            this.ViewModel = viewModel;
            InitializeComponent();

            // Always handle ShowCreatedWebView. This is fired for
            // links and forms with |target="_blank"| or for JavaScript
            // 'window.open' calls.
            webControl.ShowCreatedWebView += webControl_ShowCreatedWebView;
            // For popups, you usually want to handle WindowClose,
            // fired when the page calls 'window.close'.
            webControl.WindowClose += webControl_WindowClose;
            // Tell the WebControl that it should wrap a created child view.
            this.NativeView = nativeView;
            // This window will host a WebControl that is the result of
            // JavaScript 'window.open'. Hide the address and status bar.
            this.IsRegularWindow = false;

            this.Loaded += (o, e) => this.MinHeight = this.TitleBar.ActualHeight;

            this.beforeCollapseHeight = this.Height;
        }
Example #3
0
        /// <summary>
        /// Constructor with an input url
        /// </summary>
        /// <param name="url"></param>
        public BrowserView(BrowserViewModel viewModel, Uri url)
        {
            this.ViewModel = viewModel;
            InitializeComponent();

            // Always handle ShowCreatedWebView. This is fired for
            // links and forms with |target="_blank"| or for JavaScript
            // 'window.open' calls.
            webControl.ShowCreatedWebView += webControl_ShowCreatedWebView;
            // For popups, you usually want to handle WindowClose,
            // fired when the page calls 'window.close'.
            webControl.WindowClose += webControl_WindowClose;
            // Tell the WebControl to load a specified target URL.
            this.webControl.Source = url;

            this.Loaded += (o, e) => this.MinHeight = this.TitleBar.ActualHeight;

            this.beforeCollapseHeight = this.Height;
        }