public bool OnDebugToolsRequest() { if (_DebugWindowHandle != IntPtr.Zero) { NativeWindowHelper.BringToFront(_DebugWindowHandle); return(true); } var windowInfo = new CfxWindowInfo { Style = Chromium.WindowStyle.WS_OVERLAPPEDWINDOW | Chromium.WindowStyle.WS_CLIPCHILDREN | Chromium.WindowStyle.WS_CLIPSIBLINGS | Chromium.WindowStyle.WS_VISIBLE, ParentWindow = IntPtr.Zero, WindowName = "Neutronium Chromium Dev Tools", X = 200, Y = 200, Width = 800, Height = 600 }; _DebugCfxClient = new CfxClient(); _DebugCfxClient.GetLifeSpanHandler += DebugClient_GetLifeSpanHandler; _ChromiumWebBrowser.BrowserHost.ShowDevTools(windowInfo, _DebugCfxClient, new CfxBrowserSettings(), null); DebugToolOpened?.Invoke(this, new DebugEventArgs(true)); return(true); }
public virtual bool OnNotify(NotifyMessageHeader hdr) { switch ((NotifyMessageCode)hdr.code) { case NotifyMessageCode.Apply: NativeWindowHelper.SetWindowLong(this.Handle, NativeWindowHelper.DWLP_MSGRESULT, NativeWindowHelper.PSNRET_NOERROR); OnApply(); return(true); case NotifyMessageCode.Reset: OnCancel(); return(false); case NotifyMessageCode.QueryCancel: return(false); case NotifyMessageCode.SetActive: OnSetActive(); return(true); case NotifyMessageCode.KillActive: if (ValidateOptions()) { OnKillActive(); NativeWindowHelper.SetWindowLong(this.Handle, NativeWindowHelper.DWLP_MSGRESULT, 0); } else { NativeWindowHelper.SetWindowLong(this.Handle, NativeWindowHelper.DWLP_MSGRESULT, 1); } return(true); } return(true); }
public virtual void OnItemChosen(int combo, int entry) { SourceContext c = new SourceContext(null, 1, 1); if (combo == TypeAndMemberDropdownBars.DropClasses) { if (this.sortedDropDownTypes != null && entry >= 0 && entry < this.sortedDropDownTypes.Length) { c = this.sortedDropDownTypes[entry].SourceContext; } } else { if (this.sortedDropDownMembers != null && entry >= 0 && entry < this.sortedDropDownMembers.Length) { c = this.sortedDropDownMembers[entry].SourceContext; } } if (c.Document != null && this.textView != null) { int line = c.StartLine - 1; int col = c.StartColumn - 1; try{ textView.CenterLines(line, 16); }catch {} this.textView.SetCaretPos(line, col); NativeWindowHelper.SetFocus(this.textView.GetWindowHandle()); this.SynchronizeDropdowns(this.textView, line, col); } }
public bool OnDebugToolsRequest() { if (_DebugWindowHandle != IntPtr.Zero) { NativeWindowHelper.BringToFront(_DebugWindowHandle); return(true); } DisplayDebug(); DebugToolOpened?.Invoke(this, new DebugEventArgs(true)); return(true); }
public override void CreatePaneWindow(IntPtr hwndParent, int x, int y, int cx, int cy, out IntPtr hwnd) { control.SuspendLayout(); control.Left = x; control.Top = y; control.Width = cx; control.Height = cy; control.ResumeLayout(); control.CreateControl(); NativeWindowHelper.SetParent(control.Handle, hwndParent); hwnd = control.Handle; }
public void GetPropertyPage(ref Guid guidPage, Microsoft.VisualStudio.Shell.Interop.VSPROPSHEETPAGE[] ppage) { PropertySheet sheet = GetPropertySheet(guidPage); if (sheet != null && ppage != null) { ppage[0] = new VSPROPSHEETPAGE(); ppage[0].dwSize = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE)); ppage[0].hwndDlg = sheet.Handle; ppage[0].pfnDlgProc = NativeWindowHelper.GetNativeWndProc(sheet); return; } throw new NotImplementedException(); }
public int GetPropertyPage(ref Guid guidPage, Microsoft.VisualStudio.Shell.Interop.VSPROPSHEETPAGE[] ppage) { PropertySheet sheet = GetPropertySheet(guidPage); if (sheet != null && ppage != null) { ppage[0] = new VSPROPSHEETPAGE(); ppage[0].dwSize = (uint)Marshal.SizeOf(typeof(VSPROPSHEETPAGE)); ppage[0].hwndDlg = sheet.Handle; ppage[0].pfnDlgProc = NativeWindowHelper.GetNativeWndProc(sheet); return(0); } return((int)HResult.E_NOTIMPL); }
protected override int ExecCommand(ref Guid guidCmdGroup, uint nCmdId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { // todo: we really need to pass all of IOleCommandTarget through to the control // so it can decide what to implement. In fact, we should do all of // IOleInPlaceUIWindow so the control can even add menu items. if (guidCmdGroup == VsConstants.guidStandardCommandSet97) { VsCommands cmd = (VsCommands)nCmdId; int msg = 0; IntPtr wParam = IntPtr.Zero; switch (cmd) { case VsCommands.Cut: msg = NativeWindowHelper.WM_CUT; break; case VsCommands.Copy: msg = NativeWindowHelper.WM_COPY; break; case VsCommands.Paste: msg = NativeWindowHelper.WM_PASTE; break; case VsCommands.Undo: msg = NativeWindowHelper.WM_UNDO; break; case VsCommands.Delete: msg = NativeWindowHelper.WM_KEYDOWN; wParam = (IntPtr)(int)Keys.Delete; break; } if (msg != 0) { Control target = Control.FromHandle(NativeWindowHelper.GetFocus()); if (target != null) { IntPtr rc = NativeWindowHelper.SendMessage(target.Handle, msg, wParam, IntPtr.Zero); if ((int)rc == 0) { return(0); } } } } return(base.ExecCommand(ref guidCmdGroup, nCmdId, nCmdexecopt, pvaIn, pvaOut)); }
/// <summary> /// The view model on property changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="propertyChangedEventArgs"> /// The property changed event args. /// </param> private void ViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs) { if (propertyChangedEventArgs.PropertyName == "IsRecording") { this.Locked = this.ViewModel.IsRecording; if (this.ViewModel.IsRecording) { var hwnd = new WindowInteropHelper(this).Handle; NativeWindowHelper.SetWindowExTransparent(hwnd); } } if (propertyChangedEventArgs.PropertyName == "IsFullScreen") { this.IsFullScreen = this.ViewModel.IsFullScreen; } }
public bool OnDebugToolsRequest() { if (_DebugWindowHandle != IntPtr.Zero) { NativeWindowHelper.BringToFront(_DebugWindowHandle); return(true); } //https://bitbucket.org/chromiumembedded/cef/issues/2115/devtools-ignoring-inspected-point-if //temporary by-pass to be removed when migrating to next CEF version InitDebugTool().ContinueWith(t => { DisplayDebug(); DebugToolOpened?.Invoke(this, new DebugEventArgs(true)); }, TaskScheduler.FromCurrentSynchronizationContext()).DoNotWait(); return(true); }
public void EditDiagramShape(ShapeHolder shape) { Trace.WriteLine($"EditDiagramShape: AnchorID: {shape.AnchorID}"); if (shape.AnchorID == 0) { return; } if (!_editMap.TryGetBySecond(shape.AnchorID, out var editFileId)) { editFileId = Guid.NewGuid(); _editMap.AddOrUpdate(editFileId, shape.AnchorID); } var wnd = NativeWindowHelper.FindWindow($"{editFileId}.png - draw.io"); if (wnd != IntPtr.Zero) { NativeWindowHelper.RestoreFromMinimized(wnd); NativeWindowHelper.SetForegroundWindow(wnd); return; } var editFilePath = Path.Combine(_userTmpFilesDir, $"{editFileId}.png"); try { var pngBytes = Util.DecodePngFile(shape.Title); File.WriteAllBytes(editFilePath, pngBytes); var process = new Process(); process.StartInfo.FileName = _settings.DrawIoExePath; process.StartInfo.Arguments = editFilePath; process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized; process.Start(); } catch (Exception m) { var msg = $"Failed to start Draw.io Desktop application for file {editFilePath}. Error: {m}."; MessageBox.Show(msg, Application.ActiveWindow.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public virtual int OnItemChosen(int combo, int entry) { int line = 0; int col = 0; if (combo == 0) { if (this.dropDownTypeNames != null && entry >= 0 && entry < this.dropDownTypeNames.Length) { line = this.dropDownTypeStartLines[entry]; col = this.dropDownTypeStartColumns[entry]; } } else { if (this.dropDownMemberSignatures != null && entry >= 0 && entry < this.dropDownMemberSignatures.Length) { line = this.dropDownMemberStartLines[entry]; col = this.dropDownMemberStartColumns[entry]; } } if (this.textView != null) { try{ textView.CenterLines(line, 16); }catch {} this.textView.SetCaretPos(line, col); NativeWindowHelper.SetFocus(this.textView.GetWindowHandle()); this.SynchronizeDropdowns(this.textView, line, col); if (combo == 0) { this.dropDownBar.RefreshCombo(1, this.selectedMember); } else { this.dropDownBar.RefreshCombo(0, this.selectedType); } this.dropDownBar.RefreshCombo(combo, entry); } return(0); }