예제 #1
0
        public HistorySelectorForm(IPrimaryHostWindow primaryHost, GlobalSettings globalSettings)
        {
            InitializeComponent();

            this.primaryHost = primaryHost;

            IconImageList.Images.Clear();

            foreach (ExoAppLaunchInfo ali in globalSettings.AppHistory.OrderByDescending(ah => ah.LastRun))
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = ali.ShortName;

                if (ali.IconPath != "" && File.Exists(ali.IconPath))
                {
                    Icon appIcon = new Icon(ali.IconPath);
                    IconImageList.Images.Add(appIcon);
                    lvi.ImageIndex = IconImageList.Images.Count - 1;
                    lvi.Tag        = ali.SettingsPath;
                }
                else
                {
                    IconImageList.Images.Add(this.Icon);
                    lvi.ImageIndex = IconImageList.Images.Count - 1;
                    lvi.Tag        = ali.SettingsPath;
                }

                AppHistoryListView.Items.Add(lvi);
            }
        }
예제 #2
0
 /// <summary>
 /// Construct server with given port.
 /// </summary>
 /// <param name="path">Directory path to serve.</param>
 /// <param name="port">Port of the server.</param>
 public SimpleHTTPServer(IPrimaryHostWindow primaryHost, Settings settings,
                         string path, int port, MimeTypeMappings mappings)
 {
     _primaryHost = primaryHost;
     _settings    = settings;
     _mappings    = mappings;
     this.Initialize(path, port);
 }
예제 #3
0
        /// <summary>
        /// Construct server with suitable port.
        /// </summary>
        /// <param name="path">Directory path to serve.</param>
        public SimpleHTTPServer(IPrimaryHostWindow primaryHost, Settings settings,
                                string path, MimeTypeMappings mappings)
        {
            _mappings = mappings;

            //get an empty port
            TcpListener l = new TcpListener(IPAddress.Loopback, 0);

            l.Start();
            int port = ((IPEndPoint)l.LocalEndpoint).Port;

            l.Stop();
            this.Initialize(path, port);
        }
예제 #4
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;
        }