private void HandleConnectedToPipe()
 {
     LogHandlerSingleton.Instance().LogLine("Connected to the DLL's named pipe", "System", true, true);
     AppStateSingleton.Instance().SendSettings();
     AppStateSingleton.Instance().SendKeyBindings();
     LogHandlerSingleton.Instance().LogLine("Initial settings sent", "System", true, true);
     _clientToDllConnectedSBLabel.Text = "Camera dll->client active";
 }
예제 #2
0
        private void PerformHotSampling()
        {
            if (_newWidthBox.Value < 100 || _newHeightBox.Value < 100)
            {
                return;
            }
            if ((Win32Wrapper.IsIconic(_gameWindowHwnd) || Win32Wrapper.IsZoomed(_gameWindowHwnd)))
            {
                Win32Wrapper.ShowWindow(_gameWindowHwnd, Win32Wrapper.SW_SHOWNOACTIVATE);
            }

            int newHorizontalResolution = (int)_newWidthBox.Value;
            int newVerticalResolution   = (int)_newHeightBox.Value;
            // always set the window at (0,0), if width is >= screen width.
            var  screenBounds = Screen.FromHandle(_gameWindowHwnd).Bounds;
            uint uFlags       = Win32Wrapper.SWP_NOZORDER | Win32Wrapper.SWP_NOACTIVATE | Win32Wrapper.SWP_NOOWNERZORDER | Win32Wrapper.SWP_NOSENDCHANGING;

            if (newHorizontalResolution < screenBounds.Width)
            {
                // let the window be where it is.
                uFlags |= Win32Wrapper.SWP_NOMOVE;
            }

            Win32Wrapper.SetWindowPos(_gameWindowHwnd, 0, 0, 0, newHorizontalResolution, newVerticalResolution, uFlags);
            if (GameSpecificConstants.HotsamplingRequiresEXITSIZEMOVE)
            {
                // A warning of unreachable code will be raised here, that's ok. this code is only used when the constant is true
                Win32Wrapper.SendMessage(_gameWindowHwnd, Win32Wrapper.WM_EXITSIZEMOVE, 0, 0);
            }

            LogHandlerSingleton.Instance().LogLine("Switching resolution on window with hwnd 0x{0} to resolution {1}x{2}", "Hotsampler", _gameWindowHwnd.ToString("x"),
                                                   newHorizontalResolution, newVerticalResolution);

            // remove / add borders
            uint nStyle = (uint)Win32Wrapper.GetWindowLong(_gameWindowHwnd, Win32Wrapper.GWL_STYLE);

            nStyle = (nStyle | (Win32Wrapper.WS_THICKFRAME + Win32Wrapper.WS_DLGFRAME + Win32Wrapper.WS_BORDER + Win32Wrapper.WS_MAXIMIZEBOX + Win32Wrapper.WS_MINIMIZEBOX));
            if (_useWindowBordersCheckBox.IsChecked == false)
            {
                nStyle ^= (Win32Wrapper.WS_THICKFRAME + Win32Wrapper.WS_DLGFRAME + Win32Wrapper.WS_BORDER + Win32Wrapper.WS_MAXIMIZEBOX + Win32Wrapper.WS_MINIMIZEBOX);
            }
            Win32Wrapper.SetWindowLong(_gameWindowHwnd, Win32Wrapper.GWL_STYLE, nStyle);
            uFlags = Win32Wrapper.SWP_NOSIZE | Win32Wrapper.SWP_NOMOVE | Win32Wrapper.SWP_NOZORDER | Win32Wrapper.SWP_NOACTIVATE | Win32Wrapper.SWP_NOOWNERZORDER | Win32Wrapper.SWP_NOSENDCHANGING | Win32Wrapper.SWP_FRAMECHANGED;
            Win32Wrapper.SetWindowPos(_gameWindowHwnd, 0, 0, 0, 0, 0, uFlags);

            // Send the resize viewport message to the dll so it can resize the viewport based on the new resolution. The game itself won't resize the viewport on its own.
            MessageHandlerSingleton.Instance().SendResizeViewportAction(newHorizontalResolution, newVerticalResolution);

            AddResolutionToRecentlyUsedList(newHorizontalResolution, newVerticalResolution);

            if (_switchAfterResizingCheckBox.IsChecked == true)
            {
                // focus the attached application's window
                Win32Wrapper.SetForegroundWindow(_gameWindowHwnd);
            }
        }
예제 #3
0
 private void HandleConnectedToPipe()
 {
     LogHandlerSingleton.Instance().LogLine("Connected to the DLL's named pipe", "System", true);
     if (this.CheckAccess())
     {
         AppStateSingleton.Instance().SendInitialData();
     }
     else
     {
         this.Dispatcher?.Invoke(() => AppStateSingleton.Instance().SendInitialData());
     }
     LogHandlerSingleton.Instance().LogLine("Initial settings sent", "System", true);
     SetTextOnTextBlock(_dllToClientConnectedSBLabel, "Camera dll->client active");
 }
예제 #4
0
 public MainWindow()
 {
     InitializeComponent();
     LogHandlerSingleton.Instance().Setup(_logControl);
     TabItemHelper.SetIcon(_generalTab, new SymbolIcon(Symbol.Repair));
     TabItemHelper.SetIcon(_hotSamplingTab, new SymbolIcon(Symbol.FullScreen));
     TabItemHelper.SetIcon(_configurationTab, new SymbolIcon(Symbol.Setting));
     TabItemHelper.SetIcon(_themeTab, new SymbolIcon(Symbol.Highlight));
     TabItemHelper.SetIcon(_keybindingsTab, new SymbolIcon(Symbol.Keyboard));
     TabItemHelper.SetIcon(_logTab, new SymbolIcon(Symbol.OpenFile));
     TabItemHelper.SetIcon(_aboutTab, new SymbolIcon(Symbol.People));
     this.MinHeight = this.Height;
     this.MinWidth  = this.Width;
 }
 public MainForm()
 {
     InitializeComponent();
     LogHandlerSingleton.Instance().Setup(_logControl);
     this.MinimumSize = this.Size;
 }
        private void HandleConnectionReceived()
        {
            LogHandlerSingleton.Instance().LogLine("DLL Connected to our named pipe.", "System", true, true);

            _dllToClientConnectedSBLabel.Text = "Client->Camera dll active";
        }
예제 #7
0
 private void HandleConnectionReceived()
 {
     LogHandlerSingleton.Instance().LogLine("DLL Connected to our named pipe.", "System", true);
     SetTextOnTextBlock(_clientToDllConnectedSBLabel, "Client->Camera dll active");
 }