Beispiel #1
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.WebBrowser = ((Samba.Presentation.Controls.Browser.BrowserControl)(target));
         return;
     }
     this._contentLoaded = true;
 }
 private static void UpdateToolbars(BrowserControl browser, bool isVisible)
 {
     if (isVisible)
     {
         browser.MainToolbar.Visibility = Visibility.Visible;
         browser.tbMain.ItemContainerStyle = new Style(typeof(TabItem));
         browser.tbMain.Items.Cast<TabItem>().ToList().ForEach(x => x.Visibility = Visibility.Visible);
     }
     else
     {
         browser.MainToolbar.Visibility = Visibility.Collapsed;
         browser.tbMain.ItemContainerStyle = new Style(typeof(TabItem));
         browser.tbMain.Items.Cast<TabItem>().ToList().ForEach(x => x.Visibility = Visibility.Collapsed);
     }
 }
 private static void UpdateToolbars(BrowserControl browser, bool isVisible)
 {
     if (isVisible)
     {
         browser.MainToolbar.Visibility    = Visibility.Visible;
         browser.tbMain.ItemContainerStyle = new Style(typeof(TabItem));
         browser.tbMain.Items.Cast <TabItem>().ToList().ForEach(x => x.Visibility = Visibility.Visible);
     }
     else
     {
         browser.MainToolbar.Visibility    = Visibility.Collapsed;
         browser.tbMain.ItemContainerStyle = new Style(typeof(TabItem));
         browser.tbMain.Items.Cast <TabItem>().ToList().ForEach(x => x.Visibility = Visibility.Collapsed);
     }
 }
        public FrameworkElement CreateWidgetControl(IDiagram widgetViewModel, ContextMenu contextMenu)
        {
            var htmlViewer = widgetViewModel as HtmlViewerWidgetViewModel;

            var ret = new BrowserControl { DataContext = htmlViewer, ContextMenu = contextMenu };

            var heightBinding = new Binding("Height") { Source = htmlViewer, Mode = BindingMode.TwoWay };
            var widthBinding = new Binding("Width") { Source = htmlViewer, Mode = BindingMode.TwoWay };
            var xBinding = new Binding("X") { Source = htmlViewer, Mode = BindingMode.TwoWay };
            var yBinding = new Binding("Y") { Source = htmlViewer, Mode = BindingMode.TwoWay };
            var transformBinding = new Binding("RenderTransform") { Source = htmlViewer, Mode = BindingMode.OneWay };
            var urlBinding = new Binding("Url") { Source = htmlViewer, Mode = BindingMode.TwoWay };
            var toolbarVisibleBinding = new Binding("Settings.IsToolbarVisible") {Source = htmlViewer, Mode = BindingMode.TwoWay};

            ret.SetBinding(InkCanvas.LeftProperty, xBinding);
            ret.SetBinding(InkCanvas.TopProperty, yBinding);
            ret.SetBinding(FrameworkElement.HeightProperty, heightBinding);
            ret.SetBinding(FrameworkElement.WidthProperty, widthBinding);
            ret.SetBinding(UIElement.RenderTransformProperty, transformBinding);
            ret.SetBinding(BrowserControl.ActiveUrlProperty, urlBinding);
            ret.SetBinding(BrowserControl.IsToolbarVisibleProperty, toolbarVisibleBinding);

            return ret;
        }