Show() 공개 정적인 메소드

public static Show ( string text ) : void
text string
리턴 void
예제 #1
0
파일: App.cs 프로젝트: rol2728/Dev.D3
        protected override void OnStartup(StartupEventArgs e)
        {
            MainWindow = Shell.Instance;
            MainWindow.Show();
            ShutdownMode = ShutdownMode.OnMainWindowClose;

            Task.Factory.StartNew(() =>
            {
                while (true)
                {
                    using (var engine = CreateEngine())
                        using (var watcher = new WatcherThread(engine))
                        {
                            Shell.Instance.IsAttached = true;
                            Minimap minimap           = null;
                            OverlayWindow overlay     = null;
                            Execute.OnUIThread(() =>
                            {
                                Canvas canvas = new Canvas();
                                overlay       = OverlayWindow.Create(engine.Process, canvas);
                                overlay.Show();
                                minimap = new Minimap(canvas);
                            });
                            watcher.AddTask(minimap.Update);
                            watcher.Start();
                            engine.Process.WaitForExit();
                            Execute.OnUIThread(() => overlay.Close());
                        }
                    Shell.Instance.IsAttached = false;
                    //Execute.OnUIThread(() => MainWindow.Close());
                }
            }, TaskCreationOptions.LongRunning);
        }
예제 #2
0
        public RadioOverlay()
        {
            new Thread(() =>
            {
                var window = new OverlayWindow(20, 10, 800, 800)
                {
                    IsTopmost = true,
                    IsVisible = true
                };
                window.CreateWindow();
                var graphics = new Graphics(window.Handle)
                {
                    MeasureFPS = true,
                    Height     = window.Height,
                    PerPrimitiveAntiAliasing  = true,
                    TextAntiAliasing          = true,
                    UseMultiThreadedFactories = false,
                    VSync = true,
                    Width = window.Width
                };

                graphics.Setup();
                var font  = graphics.CreateFont("Arial", 24);
                var brush = graphics.CreateSolidBrush(255, 255, 255);
                window.Show();
                while (true)
                {
                    graphics.BeginScene();
                    graphics.ClearScene();
                    graphics.DrawText(font, 24, brush, 15, (float)SystemParameters.PrimaryScreenHeight / 2.5f,
                                      CurrentMenu?.ToString() == null ? "" : CurrentMenu?.ToString());
                    graphics.EndScene();
                }
            }).Start();
        }
예제 #3
0
            private void ShowOverlayWindow()
            {
                _overlayWindow = OverlayWindow.Show(DockControl);
                SetStartMousePosition(_overlayWindow, _overlayWindow.PointFromScreen(_startMousePoint));
                foreach (FloatingWindow floatingWindow in DockControl.FloatingWindows)
                {
                    if (!floatingWindow.IsVisible)
                    {
                        continue;
                    }

                    NativeFloatingWindow nativeWindow = NativeFloatingWindow.GetNativeFloatingWindow(floatingWindow);
                    if (nativeWindow == null)
                    {
                        continue;
                    }

                    Point pointFromScreen = _startMousePoint;
                    try
                    {
                        pointFromScreen = nativeWindow.PointFromScreen(_startMousePoint);
                    }
                    catch (Exception e)
                    {
                        Debug.WriteLine(@"pointFromScreen: " + pointFromScreen);
                        Debug.WriteLine(e);
                    }
                    SetStartMousePosition(nativeWindow, pointFromScreen);
                }
            }
예제 #4
0
 internal void Show()
 {
     if (_window != null)
     {
         _window.Show();
     }
 }
                public static OverlayWindow Show(DockControl dockControl)
                {
                    OverlayWindow window = new OverlayWindow(dockControl);

                    window.Show();
                    return(window);
                }
예제 #6
0
        void OnPreTick(object sender, EventArgs eventArgs)
        {
            // Only want to set them up once.
            if (!_isSetup)
            {
                SetUp();
                _isSetup = true;
            }

            var activated = TargetWindow.IsActivated;
            var visible   = OverlayWindow.IsVisible;

            // Ensure window is shown or hidden correctly prior to updating
            //if (!activated && visible)
            //{
            //    OverlayWindow.Hide();
            //}
            //else
            if (activated && !visible)
            {
                Application.Current.Dispatcher.Invoke((Action) delegate
                {
                    if (OverlayWindow != null)
                    {
                        OverlayWindow.Show();
                    }
                });
            }
        }
예제 #7
0
        /*--- Method: private -----------------------------------------------------------------------------------------------------------------------------------------*/

        /// <summary> 標準型タイムラインビューを開きます。
        /// </summary>
        /// <param name="pTimelineC"> タイムラインコンポーネント </param>
        /// <param name="pOverlayViewC"> オーバーレイ表示コンポーネント </param>
        private void openStandardTimelineView(CommonDataModel pCommonDM, TimelineComponent pTimelineC, OverlayViewComponent pOverlayViewC)
        {
            OverlayWindow window = new OverlayWindow();

            window.Topmost = true;
            var vm = window.DataContext as OverlayWindowViewModel;

            if (vm != null)
            {
                vm.TimelineComponent    = pTimelineC;
                vm.OverlayViewComponent = pOverlayViewC;
            }

            if (pOverlayViewC.CommonDataModel.AppStatusData.AppMode != AppMode.Desing)
            {
                window.Show();
            }

            // ViewのIntPtrを採取
            IntPtr intPtr = new WindowInteropHelper(window).Handle;

            pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowIntPtr = intPtr;
            if (!pCommonDM.AppCommonData.ViewIntPtrList.Contains(intPtr))
            {
                pCommonDM.AppCommonData.ViewIntPtrList.Add(intPtr);
            }

            if (pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowLock)
            {
                WindowsServices.SetWindowExTransparent(pOverlayViewC.OverlayDataModel.OverlayWindowData.WindowIntPtr);
            }
        }
예제 #8
0
 private void Show()
 {
     if (FormSet)
     {
         if (mMasterForm.InvokeRequired)
         {
             mMasterForm.Invoke(new Action(() => mOverlayWindow.Show(mMasterForm)));
         }
         else
         {
             mOverlayWindow.Show(mMasterForm);
         }
     }
     else
     {
         mOverlayWindow.Show();
     }
 }
예제 #9
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var w = new OverlayWindow(Window.GetWindow(this));

            w.AllowsTransparency = true;
            w.Opacity            = .5;
            w.Background         = Brushes.Black;
            w.Show();
        }
예제 #10
0
 private void ShowOverlayWindow()
 {
     _overlayWindow = OverlayWindow.Show(DockControl);
     SetStartMousePosition(_overlayWindow, _overlayWindow.PointFromScreen(_startMousePoint));
     foreach (FloatingWindow floatingWindow in DockControl.FloatingWindows)
     {
         NativeFloatingWindow nativeWindow = NativeFloatingWindow.GetNativeFloatingWindow(floatingWindow);
         SetStartMousePosition(nativeWindow, nativeWindow.PointFromScreen(_startMousePoint));
     }
 }
예제 #11
0
        public void Show()
        {
            var window = new OverlayWindow();

            window.SourceInitialized += (s, e) =>
            {
                window.Close();
            };

            window.Show();
        }
예제 #12
0
        public void Show()
        {
            OverlayWindow.WindowStartupLocation = WindowStartupLocation.Manual;

            OverlayWindow.Left   = CurrentScreen.Bounds.Left;
            OverlayWindow.Top    = CurrentScreen.Bounds.Top;
            OverlayWindow.Width  = CurrentScreen.Bounds.Width;
            OverlayWindow.Height = CurrentScreen.Bounds.Height;

            //OverlayWindow.SourceInitialized += (snd, arg) =>
            //    OverlayWindow.WindowState = WindowState.Maximized;
            OverlayWindow.Show();
            PowerButtonImageSource = "Content/on.png";
        }
예제 #13
0
        /// <summary>
        /// shows the overlay window if the target window is visible and activated(the current window the user is interacting with)
        /// and hides the overlay window if the is not visible or not activated
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnPreTick(object sender, EventArgs e)
        {
            var targetWindowIsActivated = TargetWindow.IsActivated;

            if (!targetWindowIsActivated && OverlayWindow.IsVisible)
            {
                ClearScreen();
                OverlayWindow.Hide();
            }
            else if (targetWindowIsActivated && !OverlayWindow.IsVisible)
            {
                OverlayWindow.Show();
            }
        }
예제 #14
0
        private void OnPreTick(object sender, EventArgs eventArgs)
        {
            // Only want to set them up once.
            if (!_isSetup)
            {
                SetUp();
                _isSetup = true;
                return;
            }

            var isActive  = TargetWindow.IsActivated;
            var isVisible = !OverlayWindow.IsVisible;

            //if (visible)
            //{
            //OverlayWindow.Show();
            //Ex.Log($"activ={isActive}; visible={isVisible};");
            if (isActive) //needToShow
            {
                if (true) //isActive
                {
                    OverlayWindow.Show();
                    //OverlayWindow.ActivateParent();
                    needToShow = false;
                }
            }
            if (!isActive)
            {
                OverlayWindow.Hide();
                needToShow = true;
            }
            //if (_firstShow) { OverlayWindow.ActivateParent(); _firstShow = false; }
            //}
            //else { OverlayWindow.Hide(); }


            //Ensure window is shown or hidden correctly prior to updating
            //if (activated && visible)
            //{
            //    OverlayWindow.Show();
            //    if (!_isSetup) { OverlayWindow.SetFocus(); }
            //}

            //else if (!activated && !visible)
            //{
            //    OverlayWindow.Hide();
            //}
        }
예제 #15
0
        void OnPreTick(object sender, EventArgs e)
        {
            var activated = TargetWindow.IsActivated;
            var visible   = OverlayWindow.IsVisible;

            // Ensure window is shown or hidden correctly prior to updating
            if (!activated && visible)
            {
                OverlayWindow.Hide();
            }

            else if (activated && !visible)
            {
                OverlayWindow.Show();
            }
        }
예제 #16
0
 public void AddOverlayWindow(OverlayWindow overlayWindow)
 {
     if (OverlayStack.Count <= 0)
     {
         LastTimeScale = Time.timeScale;
         TimeController.timeController.SetTimeScale(0);
         CameraControl.MainCamera.enabled = false;
         MainUIRaycaster.enabled          = false;
         OverlayBG.enabled = true;
         LastMode          = CurrentMode;
         CurrentMode       = ControlMode.OverlayWindow;
     }
     OverlayStack.Push(overlayWindow);
     OverlayBG.transform.SetSiblingIndex(Canvas.childCount - 1);
     overlayWindow.transform.SetSiblingIndex(Canvas.childCount - 1);
     overlayWindow.Show();
 }
예제 #17
0
        private void OnPreTick(object?_, EventArgs e)
        {
            var targetWindowIsActivated = TargetWindow.IsActivated;

            switch (targetWindowIsActivated)
            {
            case false when OverlayWindow.IsVisible:
                ClearScreen();
                OverlayWindow.Hide();

                break;

            case true when !OverlayWindow.IsVisible:
                OverlayWindow.Show();

                break;
            }
        }
예제 #18
0
 public CommandCenter(MainWindowModel mainModel)
 {
     commandList    = new List <string>();
     this.mainModel = mainModel;
     commands.Add("config", args => AppConfig.ConfigToString());
     commands.Add("set-config", args =>
     {
         AppConfig.SetConfig(args[1], args[2]);
         return($"New config sets");
     });
     commands.Add("log-error", args =>
     {
         Logger.Log(LogLevel.Error, args[1]);
         return($"log");
     });
     commands.Add("log-warn", args =>
     {
         Logger.Log(LogLevel.Warn, args[1]);
         return($"log");
     });
     commands.Add("log-info", args =>
     {
         Logger.Log(LogLevel.Info, args[1]);
         return($"log");
     });
     commands.Add("logboth", args =>
     {
         AppConfig.SetConfig("LogType", "Both");
         return("Log to both console and file");
     });
     commands.Add("show", args => {
         var overlay = new OverlayWindow(mainModel);
         overlay.Show();
         overlay.DataContext = mainModel;
         WindowHelper.SetTopMostTransparent(overlay);
         return("Overlay on");
     });
     commands.Add("test", args => {
         TestData();
         return("testing");
     });
 }
예제 #19
0
        public void ClickThrough()
        {
            var window = new OverlayWindow();

            window.ClickThrough = true;
            window.ClickThrough = false;
            window.ClickThrough = true;
            window.ClickThrough = false;

            window.SourceInitialized += (s, e) =>
            {
                window.ClickThrough = true;
                window.ClickThrough = false;
                window.ClickThrough = true;
                window.ClickThrough = false;

                window.Close();
            };

            window.Show();
        }
예제 #20
0
 protected void AdjustVisibility()
 {
     if (_window == null)
     {
         return;
     }
     if (_window.IsVisible == true)
     {
         if (InvalidSize == true || Owner.RenderingActive == false)
         {
             _window.Hide();
         }
     }
     else
     {
         if (InvalidSize == false && Owner.RenderingActive == true)
         {
             _window.Show();
         }
     }
 }
예제 #21
0
        public void AltF4Cancel()
        {
            var window = new OverlayWindow();

            window.AltF4Cancel = true;
            window.AltF4Cancel = false;
            window.AltF4Cancel = true;
            window.AltF4Cancel = false;

            window.SourceInitialized += (s, e) =>
            {
                window.AltF4Cancel = true;
                window.AltF4Cancel = false;
                window.AltF4Cancel = true;
                window.AltF4Cancel = false;

                window.Close();
            };

            window.Show();
        }
예제 #22
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     _overlay.DataContext = _vm;
     _overlay.Show();
 }
예제 #23
0
        public static void Run()
        {
            OverlayWindow Overlay = new OverlayWindow(G.GlobalOffensive.MainWindowHandle, false);

            Overlay.Show();

            var consolasFont = Overlay.Graphics.CreateFont("Consolas", 15);
            var csgoFont     = Overlay.Graphics.CreateFont("csgo_icons", 15);

            var brushWhite  = Overlay.Graphics.CreateBrush(SharpDX.Color.White);
            var brushOrange = Overlay.Graphics.CreateBrush(SharpDX.Color.Orange);
            var brushRed    = Overlay.Graphics.CreateBrush(SharpDX.Color.Red);
            var brushGrey   = Overlay.Graphics.CreateBrush(SharpDX.Color.LightGray);

            while (true)
            {
                Thread.Sleep(1);

                if (!G.GlobalOffensive.Active())
                {
                    Overlay.Graphics.BeginScene();
                    Overlay.Graphics.ClearScene();
                    Overlay.Graphics.EndScene();
                    continue;
                }

                if (Visuals._InfoEnabled || Visuals._BoxEnabled || Visuals._HealthEnabled)
                {
                    G.ViewMatrix = M.ReadMatrix(G.ClientBase + Offsets.m_dwViewMatrix, 4, 4);
                }

                Overlay.Graphics.BeginScene();
                Overlay.Graphics.ClearScene();

                foreach (CSPlayer Player in new List <CSPlayer>(G.TargetList))
                {
                    if (Player == null || Player.Dead)
                    {
                        continue;
                    }

                    if (_RadarEnabled)
                    {
                        Player.Spotted = true;
                    }

                    if (_GlowEnabled)
                    {
                        Player.Glow(_GlowColor, _GlowType, _GlowIntensity);
                    }

                    if (_InfoEnabled || _BoxEnabled || _HealthEnabled)
                    {
                        Vector2 playerPosScreen, playerTopScreen = new Vector2();

                        Vector3 playerPos = Player.Position;
                        Vector3 playerTop = playerPos + new Vector3(0, 0, Player.VecMax.Z);

                        if (playerPos.ToScreen(out playerPosScreen) && playerTop.ToScreen(out playerTopScreen))
                        {
                            float height   = playerPosScreen.Y - playerTopScreen.Y;
                            float width    = height / 2;
                            float barWidth = height / 15;

                            if (_InfoEnabled)
                            {
                                int weaponId = Player.Weapon.Id;

                                if (weaponId > 500)
                                {
                                    continue;
                                }

                                string weaponIcon = Convert.ToChar(0xE000 + weaponId).ToString();
                                Overlay.Graphics.DrawText(weaponIcon, csgoFont, brushWhite, playerTopScreen.X - 15, playerTopScreen.Y - 20);
                            }

                            if (_HealthEnabled)
                            {
                                Overlay.Graphics.DrawBarHorizontal(
                                    (int)(playerPosScreen.X - width / 2),   // X
                                    (int)playerPosScreen.Y + 5,             // Y
                                    (int)width,                             // Width
                                    (int)height / 20,                       // Height
                                    Player.Health,                          // Value
                                    1,                                      // Stroke
                                    brushGrey,                              // Brush
                                    brushRed);                              // Interior Brush
                            }

                            if (_BoxEnabled)
                            {
                                switch (_BoxMode)
                                {
                                case BoxMode.Outline:
                                    Overlay.Graphics.DrawRectangle(playerTopScreen.X - width / 2, playerTopScreen.Y, width, height, 1, brushWhite);
                                    break;

                                case BoxMode.Edge:
                                    Overlay.Graphics.DrawEdge(playerTopScreen.X - width / 2, playerTopScreen.Y, width, height, 5, 1, brushWhite);
                                    break;
                                }
                            }
                        }
                    }
                }

                Overlay.Graphics.EndScene();
            }
        }
예제 #24
0
        /// <summary>
        /// Your own user code starts here.
        /// If this is your first time, do consider reading the notice above.
        /// It contains some very useful information.
        /// </summary>
        public static void Init()
        {
            /*
             *  Reloaded Mod Loader Sample: Windows Presentation Foundation
             *  Architectures supported: X86, X64
             *
             *  Creates an interactive Windows Presentation Foundation semi-transparent window inside
             *  the running process, demonstrating or giving an idea on how perhaps utility tools
             *  could be developed with libReloaded or how WPF may be used as an alternative to Direct2D
             *  HUDs/Overlays.
             *
             *  Note: In order to allow the use of WPF over the Reloaded Template, you need to add
             *  <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
             *  to the first PropertyGroup in the Project's .csproj and reference PresentationFramework + System.Xaml.
             */

            /*
             *  We create our own thread and run it in the background because Reloaded-Loader explicitly waits
             *  for the mod's thread to return before continuing to load other mods and ultimately the game.
             *
             *  Inside the thread, we initiate a regular WPF window to use for drawing.
             */

            /*
             * Generates a random sleep value ontop of the existing sleep value.
             * We want to reduce the amount of possible collisions of WPF overlays launching
             * at the same identical time, as Application.Current is not updated in real-time (seemingly).
             */
            Random randomNumberGenerator = new Random();
            int    randomSleepValue      = randomNumberGenerator.Next(0, 3000);

            Thread.Sleep(32); // Ensures different tick value for seeding, offsets overlay launch time to prevent collisions.

            Thread launchWpfThread = new Thread
                                     (
                () =>
            {
                // Loop infinitely until a window handle is found.
                while (GameProcess.Process.MainWindowHandle == IntPtr.Zero)
                {
                    // Sleep the thread for a sensible amount of time.
                    Thread.Sleep(1000);
                }

                // Wait a fixed amount of time + random extra (to not try to launch different copies at once, minimize collisions).
                Thread.Sleep(randomSleepValue);

                // Run the WPF window.

                // Note that our OverlayWindow comes from WPF-Demo-Overlay project (it's added in as a reference).
                // To use WPF windows, you want to create another project which is a WPF UserControl library, remove the
                // usercontrol and create a window, use that library as a reference in your Reloaded WPF overlays.

                // While this isn't strictly necessary to use another library/project, it will save you a lot of hassle when it
                // comes to interoperating with different overlays, this will also make your life easier in other ways, believe me.

                // Another overlay already active.
                if (Application.Current != null)
                {
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        WPFWindow = new OverlayWindow();
                        WPFWindow.Show();
                    });
                }
                // This is the first overlay.
                else
                {
                    try
                    {
                        // Create new Application Context.
                        Application WPFApp = new System.Windows.Application();

                        // Create our window
                        WPFWindow = new OverlayWindow();

                        // Instance the overlay.
                        WPFApp.Run(WPFWindow);
                    }
                    catch
                    {
                        // If it fails, fall back to second overlay anyway.
                        Application.Current?.Dispatcher.Invoke(() =>
                        {
                            WPFWindow = new OverlayWindow();
                            WPFWindow.Show();
                        });
                    }
                }
            }
                                     );

            launchWpfThread.SetApartmentState(ApartmentState.STA);
            launchWpfThread.Start();
        }