public static void ActiveUrlPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            BrowserControl browser = o as BrowserControl;

            if (browser != null)
            {
                string uri = e.NewValue as string;
                browser.ActiveUrl = uri;
            }
        }
Example #2
0
        public static void ActiveUrlPropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            BrowserControl browser = o as BrowserControl;

            if (browser != null && browser.AutoRefresh)
            {
                string uri = e.NewValue as string;
                if (!string.IsNullOrEmpty(uri))
                {
                    browser.ActiveUrl = uri;
                }
            }
        }
Example #3
0
 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);
     }
 }
Example #4
0
 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);
     }
 }
Example #5
0
        private static void CreateHtmlViewer(IDiagram buttonHolder, InkCanvas parentControl)
        {
            if (!BrowserCache.ContainsKey(buttonHolder.Caption + buttonHolder.HtmlContent))
            {
                var brws = new BrowserControl
                               {
                                   DataContext = buttonHolder,
                                   ContextMenu = ButtonContextMenu,
                                   MinHeight = 10,
                                   MinWidth = 10
                               };

                BrowserCache.Add(buttonHolder.Caption + buttonHolder.HtmlContent, brws);
            }

            var ret = BrowserCache[buttonHolder.Caption + buttonHolder.HtmlContent];

            ret.DataContext = buttonHolder;
            ret.ContextMenu = ButtonContextMenu;
            ret.IsToolbarVisible = false;
            parentControl.Children.Add(ret);
            ret.AutoRefresh = buttonHolder.AutoRefresh;

            BindingOperations.ClearAllBindings(ret);

            var heightBinding = new Binding("Height") { Source = buttonHolder, Mode = BindingMode.TwoWay };
            var widthBinding = new Binding("Width") { Source = buttonHolder, Mode = BindingMode.TwoWay };
            var xBinding = new Binding("X") { Source = buttonHolder, Mode = BindingMode.TwoWay };
            var yBinding = new Binding("Y") { Source = buttonHolder, Mode = BindingMode.TwoWay };
            var enabledBinding = new Binding("IsEnabled") { Source = buttonHolder, Mode = BindingMode.OneWay };
            var transformBinding = new Binding("RenderTransform") { Source = buttonHolder, Mode = BindingMode.OneWay };
            var urlBinding = new Binding("HtmlContent") { Source = buttonHolder, Mode = BindingMode.OneWay };
            var detailsVisibilityBinding = new Binding("IsDetailsVisible") { Source = buttonHolder, Mode = BindingMode.TwoWay };

            ret.SetBinding(LeftProperty, xBinding);
            ret.SetBinding(TopProperty, yBinding);
            ret.SetBinding(HeightProperty, heightBinding);
            ret.SetBinding(WidthProperty, widthBinding);
            ret.SetBinding(RenderTransformProperty, transformBinding);
            ret.SetBinding(IsEnabledProperty, enabledBinding);
            ret.SetBinding(BrowserControl.IsToolbarVisibleProperty, detailsVisibilityBinding);
            ret.SetBinding(BrowserControl.ActiveUrlProperty, urlBinding);
        }