Пример #1
0
        private void ChildWindow_Load(object sender, EventArgs e)
        {
            if (uri.StartsWith("@"))
            {
                HostWebBrowser.DocumentText = uri.Substring(1);
            }
            else
            {
                string baseUrl = parent.ResolveExoUrlPath(this.Settings.WebBrowserBaseUrl);

                Uri baseUri = new Uri(baseUrl);
                HostWebBrowser.Url = new Uri(baseUri, uri);
            }
        }
Пример #2
0
        public ChildWindow(IPrimaryHostWindow parent, ILogWindow logger, Settings settings,
                           string caption, string uri, int?width, int?height, string mode)
        {
            this.parent   = parent;
            this.Settings = settings;
            this.uri      = uri;
            this.Title    = caption;

            this.ImageListDictionary = new Dictionary <string, ImageList>();

            Logger = logger;
            Logger.AttachHost(this, caption, null);

            if (!String.IsNullOrEmpty(settings.WindowIconPath))
            {
                string resolvedIconPath = parent.ResolveExoUrlPath(settings.WindowIconPath);
                this.Icon = new Icon(resolvedIconPath);
            }

            InitializeComponent();

            scriptInterface = new ScriptInterface(this, Logger);

            // The default mode that the form is compiled with is web ui mode.
            // This can be overriden in settings to native ui
            // You can override either at run time with 'mode' param
            // API should pass either 'native' or 'web'
            if (!String.IsNullOrEmpty(mode))
            {
                if (mode == "native")
                {
                    SwitchToNativeUi();
                }
            }
            else if (settings.DefaultToNativeUi)
            {
                SwitchToNativeUi();
            }

            HostMenuStrip.Visible   = settings.ScriptingMenuEnabled;
            HostToolStrip.Visible   = settings.ScriptingToolStripEnabled;
            HostStatusStrip.Visible = settings.ScriptingStatusStripEnabled;

            if (caption != null)
            {
                this.Text = caption;
            }
            if (width.HasValue)
            {
                this.Width = width.Value;
            }
            if (height.HasValue)
            {
                this.Height = height.Value;
            }

            HostWebBrowser.ScriptErrorsSuppressed     = settings.WebBrowserScriptErrorsSuppressed;
            HostWebBrowser.WebBrowserShortcutsEnabled = settings.WebBrowserShortcutsEnabled;

            HostWebBrowser.ObjectForScripting             = scriptInterface;
            HostWebBrowser.IsWebBrowserContextMenuEnabled = settings.WebBrowserContextMenu;
        }