Exemplo n.º 1
0
        /// <summary>
        /// 登録されているオーバーレイを削除します。
        /// </summary>
        /// <param name="overlay">削除するオーバーレイ。</param>
        internal void RemoveOverlay(IOverlay overlay)
        {
            this.Overlays.Remove(overlay);
            overlay.Dispose();

            OverlaysChanged?.Invoke(this, null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Frees all resources used by this object.
        /// </summary>
        public void Dispose()
        {
            _hook?.Dispose();

            _mouseClickOverlay?.Dispose();
            _scrollOverlay?.Dispose();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Frees all resources used by this object.
        /// </summary>
        public void Dispose()
        {
            _hook?.Dispose();

            _mouseClickOverlay?.Dispose();
            _keyOverlay?.Dispose();

            _textWriter?.Dispose();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }

            preview?.Dispose();
            base.Dispose(disposing);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 登録されているオーバーレイを削除します。
 /// </summary>
 /// <param name="overlay">削除するオーバーレイ。</param>
 internal void RemoveOverlay(IOverlay overlay)
 {
     this.Overlays.Remove(overlay);
     overlay.Dispose();
 }
Exemplo n.º 6
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 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;
                }
            }
        }