Exemplo n.º 1
0
        private OverlayForm ShowOverlay()
        {
            OverlayForm overlay = new OverlayForm();

            overlay.Show(this);
            overlay.Location = new Point(this.Location.X + 8, this.Location.Y + 30);
            return(overlay);
        }
Exemplo n.º 2
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (overlay == null)
     {
         overlay = new OverlayForm(button2.Handle);     // <-- pass in an hWnd to some external window
         overlay.Show();
     }
 }
 protected SharedFormsSingleton()
 {
     //Setting up the forms that need to always be available to the program
     overlayForm  = new OverlayForm();
     ToastOverlay = new Toast();
     overlayForm.RegisterOverlay(ToastOverlay);
     zoomForm = new ZoomForm();
     overlayForm.Show();
     fixationDot = new FixationDot();
 }
 private void CallForm(Action <IBasicData, bool> restoration = null, IBasicData restorationData = null, bool v = false)
 {
     if (form.InvokeRequired)
     {
         var d = new Action <Action <IBasicData, bool>, IBasicData, bool>(CallForm);
         form.Invoke(restoration, restorationData, v);
     }
     else
     {
         form.Show();
         form.FormClosed += (s, e) =>
         {
             core.SetUIVisible = true;
             if (restoration != null)
             {
                 restoration.Invoke(restorationData, v);
             }
         };
     }
 }
Exemplo n.º 5
0
        private void menuOverlay_Click(object sender, EventArgs e)
        {
            OverlayForm over = new OverlayForm(this.axMapControl1);

            over.Show();
        }
Exemplo n.º 6
0
        protected virtual void InitializeOverlay()
        {
            try
            {
                // FIXME: is this *really* correct way to get version of current assembly?
                Overlay = new OverlayForm(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(), Name, "about:blank", Config.MaxFrameRate);

                // グローバルホットキーを設定
                if (Config.GlobalHotkeyEnabled)
                {
                    var modifierKeys = GetModifierKey(Config.GlobalHotkeyModifiers);
                    var key          = Config.GlobalHotkey;
                    var hotkeyType   = Config.GlobalHotkeyType;
                    if (key != Keys.None)
                    {
                        switch (hotkeyType)
                        {
                        case GlobalHotkeyType.ToggleVisible:
                            hook.KeyPressed += (o, e) => Config.IsVisible = !Config.IsVisible;
                            break;

                        case GlobalHotkeyType.ToggleClickthru:
                            hook.KeyPressed += (o, e) => Config.IsClickThru = !Config.IsClickThru;
                            break;

                        case GlobalHotkeyType.ToggleLock:
                            hook.KeyPressed += (o, e) => Config.IsLocked = !Config.IsLocked;
                            break;

                        default:
                            hook.KeyPressed += (o, e) => Config.IsVisible = !Config.IsVisible;
                            break;
                        }

                        hook.RegisterHotKey(modifierKeys, key);
                    }
                }

                // 画面外にウィンドウがある場合は、初期表示位置をシステムに設定させる
                if (!Util.IsOnScreen(Overlay))
                {
                    Overlay.StartPosition = FormStartPosition.WindowsDefaultLocation;
                }
                else
                {
                    Overlay.Location = Config.Position;
                }

                Overlay.Text        = Name;
                Overlay.Size        = Config.Size;
                Overlay.IsClickThru = Config.IsClickThru;

                // イベントハンドラを設定
                Overlay.Browser.LoadError += (o, e) =>
                {
                    Log(LogLevel.Error, "BrowserError: {0}, {1}, {2}", e.ErrorCode, e.ErrorText, e.FailedUrl);
                };
                Overlay.Browser.FrameLoadEnd += (o, e) =>
                {
                    Log(LogLevel.Debug, "BrowserLoad: {0}: {1}", e.HttpStatusCode, e.Url);
                    NotifyOverlayState();
                };
                Overlay.Browser.ConsoleMessage += (o, e) =>
                {
                    Log(LogLevel.Info, "BrowserConsole: {0} (Source: {1}, Line: {2})", e.Message, e.Source, e.Line);
                };
                Config.UrlChanged += (o, e) =>
                {
                    Navigate(e.NewUrl);
                };

                if (CheckUrl(Config.Url))
                {
                    Navigate(Config.Url);
                }
                else
                {
                    Navigate("about:blank");
                }

                Overlay.Show();
                Overlay.Visible = Config.IsVisible;
                Overlay.Locked  = Config.IsLocked;
            }
            catch (Exception ex)
            {
                Log(LogLevel.Error, "InitializeOverlay: {0}", Name, ex);
            }
        }
Exemplo n.º 7
0
        private void toolStripButton2_Click(object sender, System.EventArgs e)
        {
            OverlayForm over = new OverlayForm(this.axMapControl1);

            over.Show();
        }