Exemplo n.º 1
0
        private void cbPreset_SelectedIndexChanged(object sender, EventArgs e)
        {
            var preset = (IOverlayPreset)cbPreset.SelectedItem;

            if (preset.Url == "special:custom")
            {
                lblType.Visible              = true;
                cbType.Visible               = true;
                lblTypeDesc.Visible          = true;
                lblPresetDescription.Visible = false;

                if (preview != null)
                {
                    preview.Visible = false;
                }
            }
            else
            {
                lblType.Visible              = false;
                cbType.Visible               = false;
                lblTypeDesc.Visible          = false;
                lblPresetDescription.Visible = true;

                if (preview != null)
                {
                    preview.Dispose();
                }

                switch (preset.Type)
                {
                case "MiniParse":
#if DEBUG
                    var resourcesPath = "file:///" + PluginMain.PluginDirectory.Replace('\\', '/') + "/libs/resources";
#else
                    var resourcesPath = "file:///" + PluginMain.PluginDirectory.Replace('\\', '/') + "/resources";
#endif
                    var config = new Overlays.MiniParseOverlayConfig(Resources.OverlayPreviewName)
                    {
                        ActwsCompatibility = preset.Supports.Count == 1 && preset.Supports.Contains("actws"),
                        Size     = new Size(preset.Size[0], preset.Size[1]),
                        IsLocked = preset.Locked,
                    };

                    var overlay = new Overlays.MiniParseOverlay(config, config.Name);
                    overlay.Preview = true;
                    overlay.Navigate(preset.Url.Replace("%%", resourcesPath));

                    preview = overlay;
                    break;

                default:
                    Registry.Resolve <ILogger>().Log(LogLevel.Error, string.Format(Resources.PresetUsesUnsupportedType, preset.Name, preset.Type));
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public MiniParseConfigPanel(MiniParseOverlay overlay)
        {
            InitializeComponent();

            this.overlay = overlay;
            this.config  = overlay.Config;

            SetupControlProperties();
            SetupConfigEventHandlers();
        }
Exemplo n.º 3
0
        public MiniParseConfigPanel(TinyIoCContainer container, MiniParseOverlay overlay)
        {
            InitializeComponent();

            this.keyboardHook = container.Resolve <KeyboardHook>();
            this.overlay      = overlay;
            this.config       = overlay.Config;

            SetupControlProperties();
            SetupConfigEventHandlers();
        }
Exemplo n.º 4
0
        private void cbPreset_SelectedIndexChanged(object sender, EventArgs e)
        {
            var preset = (IOverlayPreset)cbPreset.SelectedItem;

            if (preset == null)
            {
                return;
            }

            if (preset.Url == "special:custom")
            {
                lblType.Visible              = true;
                cbType.Visible               = true;
                lblTypeDesc.Visible          = true;
                lblPresetDescription.Visible = false;

                if (preview != null)
                {
                    preview.Visible = false;
                }
            }
            else
            {
                lblType.Visible              = false;
                cbType.Visible               = false;
                lblTypeDesc.Visible          = false;
                lblPresetDescription.Visible = true;

                if (preview != null)
                {
                    preview.Dispose();
                }

                switch (preset.Type)
                {
                case "MiniParse":
#if DEBUG
                    var resourcesPath = "file:///" + pluginMain.PluginDirectory.Replace('\\', '/') + "/libs/resources";
#else
                    var resourcesPath = "file:///" + pluginMain.PluginDirectory.Replace('\\', '/') + "/resources";
#endif
                    var config = new Overlays.MiniParseOverlayConfig(Resources.OverlayPreviewName)
                    {
                        ActwsCompatibility = preset.Supports.Count == 1 && preset.Supports.Contains("actws"),
                        Size     = new Size(preset.Size[0], preset.Size[1]),
                        IsLocked = preset.Locked,
                    };

                    var presetUrl = preset.Url.Replace("%%", resourcesPath);
                    var overlay   = new Overlays.MiniParseOverlay(config, config.Name, container);
                    overlay.Preview = true;

                    var first = true;
                    overlay.Overlay.Renderer.BrowserLoad += (o, ev) =>
                    {
                        // Once the placeholder is ready, we load the actual overlay.
                        if (first)
                        {
                            first = false;
                            overlay.Navigate(presetUrl);
                        }
                    };
                    // Show a placeholder while the actual overlay is loading.
                    overlay.Navigate(resourcesPath + "/loading.html");

                    preview = overlay;
                    break;

                default:
                    logger.Log(LogLevel.Error, string.Format(Resources.PresetUsesUnsupportedType, preset.Name, preset.Type));
                    break;
                }
            }
        }