/// <summary> /// Constructor. /// </summary> /// <param name="args">Object used to specify how the <see cref="Shelf"/> should be created.</param> /// <param name="desktopWindow">The owner window of the <see cref="Shelf"/>.</param> protected internal Shelf(ShelfCreationArgs args, DesktopWindow desktopWindow) :base(args) { _desktopWindow = desktopWindow; _displayHint = args.DisplayHint; _host = new Host(this, args.Component); }
public void Insert(DesktopWindow window, Int32Point dropPoint) { var activeScreen = ScreenHelper.GetScreen(dropPoint).WorkingArea.ToInt32Rect(); // For borders between screens, allow a greater margin var leftActivationWidth = 2; var rightActivationWidth = 2; if (ScreenHelper.AllScreens.Any(s => s.WorkingArea.X < activeScreen.X)) leftActivationWidth = 50; if (ScreenHelper.AllScreens.Any(s => s.WorkingArea.X > activeScreen.X)) rightActivationWidth = 50; TwoColumns layout; if (!screens.TryGetValue(activeScreen, out layout)) { layout = new TwoColumns(activeScreen); screens.Add(activeScreen, layout); } if (dropPoint.X < activeScreen.X + leftActivationWidth) { layout.LeftColumn.Insert(window, dropPoint.Y); } if (dropPoint.X > activeScreen.X + activeScreen.Width - rightActivationWidth) { layout.RightColumn.Insert(window, dropPoint.Y); } }
/// <summary> /// Constructor /// </summary> /// <param name="window"></param> protected internal DesktopWindowView(DesktopWindow window) { _desktopWindow = window; _form = CreateDesktopForm(); _workspaceActivationOrder = new OrderedSet<WorkspaceView>(); // listen to some events on the form _form.VisibleChanged += FormVisibleChangedEventHandler; _form.Activated += FormActivatedEventHandler; _form.Deactivate += FormDeactivateEventHandler; _form.FormClosing += FormFormClosingEventHandler; _form.TabbedGroups.PageCloseRequest += TabbedGroupPageClosePressedEventHandler; _form.TabbedGroups.PageChanged += TabbedGroupPageChangedEventHandler; // NY: We subscribe to ContentHiding instead of ContentHidden because ContentHidden // is fired when the user double clicks the caption bar of a docking window, which // results in a crash. (Ticket #144) _form.DockingManager.ContentHiding += DockingManagerContentHidingEventHandler; _form.DockingManager.ContentShown += DockingManagerContentShownEventHandler; _form.DockingManager.ContentAutoHideOpening += DockingManagerContentAutoHideOpeningEventHandler; _form.DockingManager.ContentAutoHideClosed += DockingManagerContentAutoHideClosedEventHandler; _form.DockingManager.WindowActivated += DockingManagerWindowActivatedEventHandler; _form.DockingManager.WindowDeactivated += FormDockingManagerWindowDeactivatedEventHandler; // init notification dialogs _infoNotificationDialog = new AlertNotificationForm(_form, Application.Name) {AutoDismiss = true}; _infoNotificationDialog.OpenLogClicked += AlertDialogOpenLogClicked; _errorNotificationDialog = new AlertNotificationForm(_form, Application.Name); _errorNotificationDialog.OpenLogClicked += AlertDialogOpenLogClicked; _errorNotificationDialog.Dismissed += ErrorDialogDismissed; }
internal void Minimize(DesktopWindow window) { int index = windows.IndexOf(window); if (index >= 0) { UpdateSizesAfterRemoval(); } }
public WindowSizingEventArgs(DesktopWindow window, SizingCorner corner, Int32Rect initialPosition, Int32Rect lastPosition, Int32Rect currentPosition) : base(window) { this.Corner = corner; this.InitialPosition = initialPosition; this.LastPosition = lastPosition; this.CurrentPosition = currentPosition; }
internal void Insert(DesktopWindow window, int y) { if (!windows.Any()) { window.Position = Area; windows.Add(window); return; } int insertIndex = GetInsertIndex(y); windows.Insert(insertIndex, window); CalculateNewHeightsAfterInsert(insertIndex); }
public static IntPtr GetDesktopWindow(DesktopWindow desktopWindow) { IntPtr _ProgMan = GetShellWindow(); IntPtr _SHELLDLL_DefViewParent = _ProgMan; IntPtr _SHELLDLL_DefView = FindWindowEx(_ProgMan, IntPtr.Zero, "SHELLDLL_DefView", null); IntPtr _SysListView32 = FindWindowEx(_SHELLDLL_DefView, IntPtr.Zero, "SysListView32", "FolderView"); if (_SHELLDLL_DefView == IntPtr.Zero) { EnumWindows((hwnd, lParam) => { var sb = new StringBuilder(256); GetClassName(hwnd, sb, sb.Capacity); if (sb.ToString() == "WorkerW") { IntPtr child = FindWindowEx(hwnd, IntPtr.Zero, "SHELLDLL_DefView", null); if (child != IntPtr.Zero) { _SHELLDLL_DefViewParent = hwnd; _SHELLDLL_DefView = child; _SysListView32 = FindWindowEx(child, IntPtr.Zero, "SysListView32", "FolderView");; return(false); } } return(true); }, IntPtr.Zero); } switch (desktopWindow) { case DesktopWindow.ProgMan: return(_ProgMan); case DesktopWindow.SHELLDLL_DefViewParent: return(_SHELLDLL_DefViewParent); case DesktopWindow.SHELLDLL_DefView: return(_SHELLDLL_DefView); case DesktopWindow.SysListView32: return(_SysListView32); default: return(IntPtr.Zero); } }
public static IntPtr GetDesktopWindow(DesktopWindow desktopWindow) { IntPtr progMan = Native.GetShellWindow(); IntPtr shelldllDefViewParent = progMan; IntPtr shelldllDefView = Native.FindWindowEx(progMan, IntPtr.Zero, "SHELLDLL_DefView", null); IntPtr sysListView32 = Native.FindWindowEx(shelldllDefView, IntPtr.Zero, "SysListView32", "FolderView"); if (shelldllDefView == IntPtr.Zero) { Native.EnumWindows((hwnd, lParam) => { const int maxChars = 256; StringBuilder className = new StringBuilder(maxChars); if (Native.GetClassName(hwnd, className, maxChars) > 0 && className.ToString() == "WorkerW") { IntPtr child = Native.FindWindowEx(hwnd, IntPtr.Zero, "SHELLDLL_DefView", null); if (child != IntPtr.Zero) { shelldllDefViewParent = hwnd; shelldllDefView = child; sysListView32 = Native.FindWindowEx(child, IntPtr.Zero, "SysListView32", "FolderView"); return(false); } } return(true); }, IntPtr.Zero); } switch (desktopWindow) { case DesktopWindow.ProgMan: return(progMan); case DesktopWindow.SHELLDLL_DefViewParent: return(shelldllDefViewParent); case DesktopWindow.SHELLDLL_DefView: return(shelldllDefView); case DesktopWindow.SysListView32: return(sysListView32); default: return(IntPtr.Zero); } }
private void destroyDesktopWindow() { if (DesktopWindow != null) { if (DesktopToolbar != null) { DesktopToolbar.Owner = null; } DesktopWindow.grid.Children.Clear(); DesktopWindow.AllowClose = true; DesktopWindow.Close(); DesktopWindow = null; } }
public void ResetPosition(bool displayChanged) { setShellWindowSize(); DesktopOverlayWindow?.ResetPosition(); if (displayChanged && DesktopWindow != null) { destroyDesktopWindow(); createDesktopWindow(); } else { DesktopWindow?.ResetPosition(); } }
public void SaveDesktopWindowState(string desktopWindowName, Rectangle restoreBounds, FormWindowState restoreState) { Initialize(); DesktopWindow window = _currentDesktop.GetDesktopWindow(desktopWindowName); if (window == null) { window = new DesktopWindow(desktopWindowName); window.Bounds = restoreBounds; window.State = restoreState; _currentDesktop.AddDesktopWindow(window); } window.Bounds = restoreBounds; window.State = restoreState; }
public override void Initialize() { base.Initialize(); // automatically launch home page on startup, only if current user is a Staff if (LoginSession.Current != null && LoginSession.Current.IsStaff && Thread.CurrentPrincipal.IsInRole(ClearCanvas.Ris.Application.Common.AuthorityTokens.Workflow.HomePage.View) && HomePageSettings.Default.ShowHomepageOnStartUp && _risWindow == null) { Launch(); // bug 3087: remember which window is the RIS window, so that we don't launch this // in the viewer window _risWindow = this.Context.DesktopWindow; } }
private static IntPtr GetDesktopWindow(DesktopWindow desktopWindow) { IntPtr _ProgMan = User32.GetShellWindow(); IntPtr _SHELLDLL_DefViewParent = _ProgMan; IntPtr _SHELLDLL_DefView = User32.FindWindowEx(_ProgMan, IntPtr.Zero, "SHELLDLL_DefView", null); IntPtr _SysListView32 = User32.FindWindowEx(_SHELLDLL_DefView, IntPtr.Zero, "SysListView32", "FolderView"); if (_SHELLDLL_DefView == IntPtr.Zero) { User32.EnumWindows((hwnd, lParam) => { if (User32.GetClassName(hwnd) == "WorkerW") { IntPtr child = User32.FindWindowEx(hwnd, IntPtr.Zero, "SHELLDLL_DefView", null); if (child != IntPtr.Zero) { _SHELLDLL_DefViewParent = hwnd; _SHELLDLL_DefView = child; _SysListView32 = User32.FindWindowEx(child, IntPtr.Zero, "SysListView32", "FolderView");; return(false); } } return(true); }, IntPtr.Zero); } switch (desktopWindow) { case DesktopWindow.ProgMan: return(_ProgMan); case DesktopWindow.SHELLDLL_DefViewParent: return(_SHELLDLL_DefViewParent); case DesktopWindow.SHELLDLL_DefView: return(_SHELLDLL_DefView); case DesktopWindow.SysListView32: return(_SysListView32); default: return(IntPtr.Zero); } }
public void Accept(IDisplaySet displaySet, TileCollection tiles, bool isAllPage, bool printedDeleteImage) { if (_dicomPrinter == null) { DesktopWindow.ShowMessageBox("请选择打印机", MessageBoxActions.Ok); return; } if (displaySet != null && displaySet.PresentationImages.Count != 0) { List <ISelectPresentationsInformation> selectPresentations = new List <ISelectPresentationsInformation>(); if (isAllPage) { for (int i = 0; i < displaySet.PresentationImages.Count; i++) { var image = ClonePresentationImage(displaySet.PresentationImages[i]); int index = i % tiles.Count; Rectangle clientRectangle = tiles[index].ClientRectangle; var select = new SelectPresentionInformation(image, clientRectangle); select.NormalizedRectangle = tiles[index].NormalizedRectangle; selectPresentations.Add(select); } } else { foreach (PrintViewTile tile in tiles) { if (tile.PresentationImage == null) { continue; } var image = ClonePresentationImage(tile.PresentationImage); Rectangle clientRectangle = tile.ClientRectangle; var select = new SelectPresentionInformation(image, clientRectangle); select.NormalizedRectangle = tile.NormalizedRectangle; selectPresentations.Add(select); } } InitDicomPrint(DesktopWindow, selectPresentations, tiles.Count, isAllPage, printedDeleteImage); } }
void UpdateForeground() { // if we got the EVENT_SYSTEM_FOREGROUND, and the hwnd is the putty terminal hwnd (m_AppWin) // then bring the supperputty window to the foreground Log.DebugFormat("[{0}] HandlingForegroundEvent: settingFG={1}", m_AppWin, settingForeground); if (settingForeground) { settingForeground = false; return; } // This is the easiest way I found to get the superputty window to be brought to the top // if you leave TopMost = true; then the window will always be on top. if (this.TopLevelControl != null) { Form form = SuperPuTTY.MainForm; if (form.WindowState == FormWindowState.Minimized) { return; } DesktopWindow window = DesktopWindow.GetFirstDesktopWindow(); this.m_windowActivator.ActivateForm(form, window, m_AppWin); // focus back to putty via setting active dock panel ctlPuttyPanel parent = (ctlPuttyPanel)this.Parent; if (parent != null && parent.DockPanel != null) { if (parent.DockPanel.ActiveDocument != parent && parent.DockState == DockState.Document) { string activeDoc = parent.DockPanel.ActiveDocument != null ? ((ToolWindow)parent.DockPanel.ActiveDocument).Text : "?"; Log.InfoFormat("[{0}] Setting Active Document: {1} -> {2}", m_AppWin, activeDoc, parent.Text); parent.Show(); } else { // give focus back this.ReFocusPuTTY("WinEventProc-FG, AltTab=" + isSwitchingViaAltTab); } } } }
// Add this method for those situation where we need longer timeout to wait for window! public static SUIWindow WaitingForWindow(string caption, int timeout) { SUIWindow waitingForwin = null; try { while (waitingForwin == null && timeout-- > 0) { SUISleeper.Sleep(1000); waitingForwin = DesktopWindow.FindChildWindowByText(caption); } } catch (Exception e) { throw new SUIGetWindowException(e); } return(waitingForwin); }
public void Open() { SelectFolderDialogCreationArgs args = new SelectFolderDialogCreationArgs(); args.AllowCreateNewFolder = false; args.Path = _lastFolder; args.Prompt = SR.MessageSelectFolderToFilter; FileDialogResult result = base.Context.DesktopWindow.ShowSelectFolderDialogBox(args); if (result.Action == DialogBoxAction.Ok) { _lastFolder = result.FileName; string[] file = Directory.GetFiles(_lastFolder, "*.*", SearchOption.AllDirectories); fileName = file; ClearCanvas.ImageViewer.ImageViewerComponent viewer = null; DesktopWindow desktopWindow = null; List <string> _filenames = new List <string>(); foreach (DesktopWindow window in Application.DesktopWindows) { foreach (Workspace space in window.Workspaces) { if (space.Title == "imageview") { desktopWindow = window; viewer = space.Component as ClearCanvas.ImageViewer.ImageViewerComponent; } } } if (viewer != null) { viewer.PhysicalWorkspace.Clear(); viewer.LogicalWorkspace.Clear(); viewer.ReAllocateStudyTree(); viewer.Layout(); viewer.LoadImages(file, ""); viewer.Layout(); } } }
public static async Task Launch(string productName, string configFilePath) { Configuration config = ConfigurationReader.Read(configFilePath); config.ProductName = productName; var window = new DesktopWindow(config.WindowTitle, (uint)config.WindowWidth, (uint)config.WindowHeight); GameContext ctx = GameContext.Create(window, config).Result; { try { await ctx.Run(); } catch (Exception e) { Console.WriteLine(e.Message); Console.WriteLine(e.StackTrace); } } }
private void btnDownImage_Click(object sender, EventArgs e) { List <string> l_list = new List <string> (); if (listView1.Items.Count > 0) { foreach (ListViewItem li in listView1.Items) { if (li.Selected) { string PatientID = string.Format("{0}", li.SubItems[0].Text); string Modality = string.Format("{0}", li.SubItems[5].Text); string StudyDate = string.Format("{0}", li.SubItems[4].Text); //string strAccessnum = li.SubItems[8].Text; string strAccessnum = li.SubItems[6].Text; StudyDate = Convert.ToDateTime(StudyDate).ToShortDateString(); l_list.Add(strAccessnum); } } GlobalData.RunParams.listAccessionNumber = l_list.ToArray(); ClearCanvas.ImageViewer.ImageViewerComponent viewer = null; DesktopWindow desktopWindow = null; List <string> _filenames = new List <string>(); foreach (DesktopWindow window in ClearCanvas.Desktop.Application.DesktopWindows) { foreach (Workspace space in window.Workspaces) { if (space.Title == "imageview") { desktopWindow = window; viewer = space.Component as ClearCanvas.ImageViewer.ImageViewerComponent; } } } if (viewer != null) { DesktopWindowView windowview = (DesktopWindowView)desktopWindow.DesktopWindowView; viewer.LoadHistoryStudyFromFtp(windowview.DesktopForm); } } }
public void MoveWindowPreviousScreen(DesktopWindow window) { List <Pair <VirtualDesktop, HMONITOR> > desktopMonitors = Windows.Keys.Where(dM => dM.Item1.ToString() == VirtualDesktop.Current.ToString()).ToList(); int currentMonitorIndex = desktopMonitors.IndexOf(window.GetDesktopMonitor()); int maxIndex = desktopMonitors.Count - 1; if (currentMonitorIndex == 0) { RemoveWindow(window); window.MonitorHandle = desktopMonitors[maxIndex].Item2; AddWindow(window); } else { RemoveWindow(window); window.MonitorHandle = desktopMonitors[--currentMonitorIndex].Item2; AddWindow(window); } }
public bool GetDesktopWindowState(string windowName, out Rectangle restoreBounds, out FormWindowState restoreState) { Initialize(); restoreBounds = Rectangle.Empty; restoreState = FormWindowState.Maximized; DesktopWindow window = _currentDesktop.GetDesktopWindow(windowName); if (window == null || window.Bounds.IsEmpty) { return(false); } restoreBounds = window.Bounds; restoreState = window.State; return(true); }
private void Add() { DicomPrinterAddValidation nih = new DicomPrinterAddValidation { dicomPrinterSummaryComponent = this }; nih.dicomPringer = new DicomPrinter(); DicomPrinterEditorComponent component = new DicomPrinterEditorComponent(nih.dicomPringer); component.Validation.Add(new ValidationRule("Name", new ValidationRule.ValidationDelegate(nih.Validation))); DesktopWindow desktopWindow = base.Host.DesktopWindow; if (ApplicationComponentExitCode.Accepted == ApplicationComponent.LaunchAsDialog(desktopWindow, component, "EditorDicomPrinter")) { this._dicomPrinterTable.Items.Add(new Checkable <DicomPrinter>(nih.dicomPringer)); this.Modified = true; } }
public override void Run() { DesktopWindow window = desktop.GetWindowByHandle(handle); if (window != null) { window.Focus(); Task <AtsElement[]> task = Task.Run(() => { return(window.GetElementsTree(desktop)); }); task.Wait(TimeSpan.FromSeconds(40)); response.Elements = task.Result; } else { response.Elements = new AtsElement[0]; } }
public static Desktop FromXmlElement(XmlElement element) { Platform.CheckTrue(element.Name == "desktop", "The settings xml is invalid."); TypeConverter converter = TypeDescriptor.GetConverter(typeof(Rectangle)); Rectangle virtualScreen = (Rectangle)converter.ConvertFromInvariantString(element.GetAttribute("virtual-screen")); Desktop desktop = new Desktop(virtualScreen); foreach (XmlElement screen in element["screens"].ChildNodes) { desktop._screens.Add(Screen.FromXmlElement(screen)); } foreach (XmlElement window in element["desktop-windows"].ChildNodes) { desktop._desktopWindows.Add(DesktopWindow.FromXmlElement(window)); } return(desktop); }
public void Run() { var platform = new DesktopPlatform(); WindowCreateInfo wci = new WindowCreateInfo { X = 100, Y = 100, WindowWidth = 1280, WindowHeight = 720, WindowTitle = "Tortuga Demo" }; GraphicsDeviceOptions options = new GraphicsDeviceOptions( debug: false, swapchainDepthFormat: PixelFormat.R16_UNorm, syncToVerticalBlank: true, resourceBindingModel: ResourceBindingModel.Improved, preferDepthRangeZeroToOne: true, preferStandardClipSpaceYDirection: true); #if DEBUG options.Debug = true; #endif _window = platform.CreateWindow(wci, options, GraphicsBackend.Vulkan) as DesktopWindow; _window.GraphicsDeviceCreated += LoadResources; _window.Tick += Update; _window.Resized += _window_Resized; _viewport = new ViewportManager(1280, 720); _cameraSpaceInputTracker = new TransformedInputTracker(_window.InputTracker); _cameraSpaceGameInputTracker = new ActiveInputTracker(_cameraSpaceInputTracker); _client.Start(); _client.Connect(new IPEndPoint(IPAddress.Loopback, 5674)); _window.Run(); }
private void MyPrint() { ClearCanvas.ImageViewer.ImageViewerComponent viewer = null; DesktopWindow desktopWindow = null; List <string> _filenames = new List <string>(); foreach (DesktopWindow window in Application.DesktopWindows) { foreach (Workspace space in window.Workspaces) { if (space.Title == "imageview") { desktopWindow = window; viewer = space.Component as ClearCanvas.ImageViewer.ImageViewerComponent; } } } if (viewer != null) { viewer.PrintFilm(); } }
static IntPtr GetDesktopWindow(DesktopWindow desktopWindow) { IntPtr hProgMan = Win32APIImports.GetShellWindow(); IntPtr hSHELLDLL_DefViewParent = hProgMan; IntPtr hSHELLDLL_DefView = Win32APIImports.FindWindowEx(hProgMan, IntPtr.Zero, "SHELLDLL_DefView", null); IntPtr hSysListView32 = Win32APIImports.FindWindowEx(hSHELLDLL_DefView, IntPtr.Zero, "SysListView32", "FolderView"); if (hSHELLDLL_DefView == IntPtr.Zero) { Win32APIImports.EnumWindows((hWnd, lParam) => { if (Win32APIImports.GetClassName(hWnd) == "WorkerW") { IntPtr child = Win32APIImports.FindWindowEx(hWnd, IntPtr.Zero, "SHELLDLL_DefView", null); if (child != IntPtr.Zero) { hSHELLDLL_DefViewParent = hWnd; hSHELLDLL_DefView = child; hSysListView32 = Win32APIImports.FindWindowEx(child, IntPtr.Zero, "SysListView32", "FolderView"); ; return false; } } return true; }, IntPtr.Zero); } if (desktopWindow == DesktopWindow.ProgMan) return hProgMan; else if (desktopWindow == DesktopWindow.SHELLDLL_DefViewParent) return hSHELLDLL_DefViewParent; else if (desktopWindow == DesktopWindow.SHELLDLL_DefView) return hSHELLDLL_DefView; else if (desktopWindow == DesktopWindow.SysListView32) return hSysListView32; else return IntPtr.Zero; }
private void Mytest() { ClearCanvas.ImageViewer.ImageViewerComponent viewer = null; DesktopWindow desktopWindow = null; List <string> _filenames = new List <string>(); foreach (DesktopWindow window in Application.DesktopWindows) { foreach (Workspace space in window.Workspaces) { if (space.Title == "imageview") { desktopWindow = window; viewer = space.Component as ClearCanvas.ImageViewer.ImageViewerComponent; } } } if (viewer != null) { viewer.PhysicalWorkspace.Clear(); viewer.LogicalWorkspace.Clear(); viewer.ReAllocateStudyTree(); viewer.Layout(); viewer.LoadStudyFromFtp(this); } else { try { string[] files = { "e:\\26885681.dcm", "e:\\26885683.dcm" }; //new OpenFilesHelper(files) { WindowBehaviour = ViewerLaunchSettings.WindowBehaviour }.OpenFiles(); } catch (Exception e) { //ExceptionHandler.Report(e, SR.MessageUnableToOpenImages, Context.DesktopWindow); } } }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); // Запуск перехватчика ошибок App.Current.DispatcherUnhandledException += (new ExceptionDispatcher()).Handler; // Регистрация библиотек GemBox GemBox.Document.ComponentInfo.SetLicense("DH5L-PTFV-SL2S-5PCN"); GemBox.Spreadsheet.SpreadsheetInfo.SetLicense("E43Y-75J1-FTBX-2T9U"); // Авторизация var authWindow = new AuthWindow(); if (authWindow.ShowDialog() ?? false) { var desktop = new DesktopWindow(); MainWindow = desktop; desktop.ShowDialog(); } App.Current.Shutdown(); }
public void Accept() { if (this._dicomPrinter == null) { base.Host.DesktopWindow.ShowMessageBox("请选择打印机", MessageBoxActions.Ok); } else { if (this.HasValidationErrors || this._dicomPrinterConfigurationEditorComponent.HasValidationErrors) { this.ShowValidation(true); this._dicomPrinterConfigurationEditorComponent.ShowValidation(true); } else { IApplicationComponentHost host = base.Host; DesktopWindow desktopWindow = host.DesktopWindow; _dicomPrintSession = new DicomPrintSession(_dicomPrinter.Item, _selectPresentations); // Platform.Log(LogLevel.Info, _dicomPrinter.Item.Config.ToString()); base.Exit(ApplicationComponentExitCode.Accepted); } } }
public DesktopWindow GetWindowByProcess(Process proc) { int maxTry = 20; DesktopWindow window = null; int mainWindowHandle = proc.MainWindowHandle.ToInt32(); if (mainWindowHandle > 0) { while (window == null && maxTry > 0) { System.Threading.Thread.Sleep(500); window = GetWindowByHandle(mainWindowHandle); maxTry--; } } else { window = GetWindowByTitle(proc.ProcessName); } window.UpdateApplicationData(proc, proc.ProcessName); return(window); }
public static DesktopWindow FromXmlElement(XmlElement element) { Platform.CheckTrue(element.Name == "desktop-window", "The settings xml is invalid."); string name = element.GetAttribute("name"); TypeConverter converter = TypeDescriptor.GetConverter(typeof(Rectangle)); Rectangle restoreBounds = (Rectangle)converter.ConvertFromInvariantString(element.GetAttribute("bounds")); converter = TypeDescriptor.GetConverter(typeof(FormWindowState)); FormWindowState restoreState = (FormWindowState)converter.ConvertFromInvariantString(element.GetAttribute("state")); DesktopWindow window = new DesktopWindow(name); window.Bounds = restoreBounds; window.State = restoreState; foreach (XmlElement shelf in element["shelves"].ChildNodes) { window._shelves.Add(Shelf.FromXmlElement(shelf)); } return(window); }
public void GetWindows() { User32.EnumWindowsProc filterDesktopWindows = delegate(HWND windowHandle, IntPtr lparam) { DesktopWindow desktopWindow = new DesktopWindow(windowHandle); if (desktopWindow.IsRuntimePresent()) { User32.ShowWindow(windowHandle, ShowWindowCommand.SW_RESTORE); desktopWindow.GetInfo(); if (Windows.ContainsKey(desktopWindow.GetDesktopMonitor())) { if (!Windows[desktopWindow.GetDesktopMonitor()].Contains(desktopWindow)) { AddWindow(desktopWindow); } } else { Windows.Add( desktopWindow.GetDesktopMonitor(), new ObservableCollection <DesktopWindow>(new DesktopWindow[] { }) ); AddWindow(desktopWindow); } } return(true); }; User32.EnumWindows(filterDesktopWindows, IntPtr.Zero); foreach (var desktopMonitor in Windows) { Windows[desktopMonitor.Key].CollectionChanged += Windows_CollectionChanged; } }
public ActionModelConfigurationComponent(string @namespace, string site, IActionSet actionSet, IDesktopWindow desktopWindow, bool flatActionModel) { _namespace = @namespace; _site = site; _desktopWindow = desktopWindow; if (_desktopWindow is DesktopWindow) { DesktopWindow concreteDesktopWindow = (DesktopWindow)_desktopWindow; if (_site == DesktopWindow.GlobalMenus || _site == DesktopWindow.GlobalToolbars) { actionSet = actionSet.Union(concreteDesktopWindow.DesktopTools.Actions); } } _actionModel = ActionModelSettings.DefaultInstance.BuildAbstractActionModel(_namespace, _site, actionSet.Select(a => a.Path.Site == site)); _actionModelTreeRoot = new AbstractActionModelTreeRoot(_site); _enforceFlatActionModel = flatActionModel; if (flatActionModel) { BuildFlatActionModelTree(_actionModel, _actionModelTreeRoot); } else { BuildActionModelTree(_actionModel, _actionModelTreeRoot); } _actionNodeMapDictionary = new ActionNodeMapDictionary(); foreach (AbstractActionModelTreeNode node in _actionModelTreeRoot.EnumerateDescendants()) { if (node is AbstractActionModelTreeLeafAction) { _actionNodeMapDictionary.AddToMap((AbstractActionModelTreeLeafAction)node); } } }
public static SUIWindow WaitingForWindow(string matchCaption, bool isRegularExpression, int timeout) { if (!isRegularExpression) { return(WaitingForWindow(matchCaption, timeout)); } SUIWindow waitingForwin = null; Regex reg = new Regex(matchCaption); while (waitingForwin == null && timeout-- > 0) { SUISleeper.Sleep(1000); if (matchCaption.Equals(string.Empty)) { waitingForwin = DesktopWindow.FindChildWindowByText(matchCaption); SUIWindow temp = SUIWindow.GetForegroundWindow(); if (!waitingForwin.WindowHandle.Equals(temp.WindowHandle)) { waitingForwin = temp; } } else { foreach (SUIWindow win in DesktopWindow.Items) { if (SUIWinAPIs.IsWindowVisible(win.WindowHandle) && reg.IsMatch(win.WindowText)) { waitingForwin = win; break; } } } } return(waitingForwin); }
/// <summary> /// Constructor /// </summary> /// <param name="window"></param> protected internal DesktopWindowView(DesktopWindow window) { _desktopWindow = window; _form = CreateDesktopForm(); //luojiang //_form.FormBorderStyle = FormBorderStyle.None; _workspaceActivationOrder = new OrderedSet <WorkspaceView>(); // listen to some events on the form _form.VisibleChanged += FormVisibleChangedEventHandler; _form.Activated += FormActivatedEventHandler; _form.Deactivate += FormDeactivateEventHandler; _form.FormClosing += FormFormClosingEventHandler; _form.TabbedGroups.PageCloseRequest += TabbedGroupPageClosePressedEventHandler; _form.TabbedGroups.PageChanged += TabbedGroupPageChangedEventHandler; // NY: We subscribe to ContentHiding instead of ContentHidden because ContentHidden // is fired when the user double clicks the caption bar of a docking window, which // results in a crash. (Ticket #144) _form.DockingManager.ContentHiding += DockingManagerContentHidingEventHandler; _form.DockingManager.ContentShown += DockingManagerContentShownEventHandler; _form.DockingManager.ContentAutoHideOpening += DockingManagerContentAutoHideOpeningEventHandler; _form.DockingManager.ContentAutoHideClosed += DockingManagerContentAutoHideClosedEventHandler; _form.DockingManager.WindowActivated += DockingManagerWindowActivatedEventHandler; _form.DockingManager.WindowDeactivated += FormDockingManagerWindowDeactivatedEventHandler; // init notification dialogs _infoNotificationDialog = new AlertNotificationForm(_form, Application.Name) { AutoDismiss = true }; _infoNotificationDialog.OpenLogClicked += AlertDialogOpenLogClicked; _errorNotificationDialog = new AlertNotificationForm(_form, Application.Name); _errorNotificationDialog.OpenLogClicked += AlertDialogOpenLogClicked; _errorNotificationDialog.Dismissed += ErrorDialogDismissed; }
internal void Remove(DesktopWindow window) { int index = windows.IndexOf(window); if (index >= 0) { windows.RemoveAt(index); if (!windows.Any()) return; UpdateSizesAfterRemoval(); } }
public void ReportSizeChange(DesktopWindow window, SizingCorner sizingCorner, Int32Rect initialPosition, Int32Rect lastPosition, Int32Rect currentPosition) { var layout = screens.Values.Where(l => l.Contains(window)).SingleOrDefault(); if (layout == null) return; bool leftColumnContainsWindow = layout.LeftColumn.Contains(window); if (leftColumnCorners.Contains(sizingCorner) && leftColumnContainsWindow) { int combinedWidth = layout.LeftColumn.Area.Width + layout.RightColumn.Area.Width; layout.LeftColumn.Area = new Int32Rect(layout.LeftColumn.Area.X, layout.LeftColumn.Area.Y, currentPosition.Width, layout.LeftColumn.Area.Height); layout.RightColumn.Area = new Int32Rect(layout.LeftColumn.Area.Width, layout.RightColumn.Area.Y, combinedWidth - layout.LeftColumn.Area.Width, layout.RightColumn.Area.Height); } if (rightColumnCorners.Contains(sizingCorner) && !leftColumnContainsWindow) { int combinedWidth = layout.LeftColumn.Area.Width + layout.RightColumn.Area.Width; layout.RightColumn.Area = new Int32Rect(currentPosition.X, layout.RightColumn.Area.Y, currentPosition.Width, layout.RightColumn.Area.Height); layout.LeftColumn.Area = new Int32Rect(layout.LeftColumn.Area.X, layout.LeftColumn.Area.Y, combinedWidth - layout.RightColumn.Area.Width, layout.LeftColumn.Area.Height); } }
public void Remove(DesktopWindow window) { foreach (var layout in screens.Values) { layout.LeftColumn.Remove(window); layout.RightColumn.Remove(window); } }
internal static bool IsInTitleBar(DesktopWindow window, Int32Point point) { var result = (int)NativeMethods.SendMessage(window.Handle, WM_NCHITTEST, 0, (point.Y << 16) + point.X); return result == HT_CAPTION; }
public WindowMovingEventArgs(DesktopWindow window) : base(window) { }
internal bool Contains(DesktopWindow window) { return windows.Contains(window); }
/// <summary> /// Constructor. /// </summary> /// <param name="args">Arguments for creation of the <see cref="Workspace"/>.</param> /// <param name="desktopWindow">The <see cref="DesktopWindow"/> that owns the <see cref="Workspace"/>.</param> protected internal Workspace(WorkspaceCreationArgs args, DesktopWindow desktopWindow) : base(args) { _commandHistory = new CommandHistory(100); _desktopWindow = desktopWindow; _userClosable = args.UserClosable; _dialogBoxes = new WorkspaceDialogBoxCollection(this); _host = new Host(this, args.Component); }
public void AddDesktopWindow(DesktopWindow desktopWindow) { DesktopWindow existing = _desktopWindows.Find(delegate(DesktopWindow test) { return test.Name == desktopWindow.Name; }); if (existing != null) throw new InvalidOperationException("A desktop window with the specified name already exists."); _desktopWindows.Add(desktopWindow); }
public static DesktopWindow FromXmlElement(XmlElement element) { Platform.CheckTrue(element.Name == "desktop-window", "The settings xml is invalid."); string name = element.GetAttribute("name"); TypeConverter converter = TypeDescriptor.GetConverter(typeof(Rectangle)); Rectangle restoreBounds = (Rectangle)converter.ConvertFromInvariantString(element.GetAttribute("bounds")); converter = TypeDescriptor.GetConverter(typeof(FormWindowState)); FormWindowState restoreState = (FormWindowState)converter.ConvertFromInvariantString(element.GetAttribute("state")); DesktopWindow window = new DesktopWindow(name); window.Bounds = restoreBounds; window.State = restoreState; foreach (XmlElement shelf in element["shelves"].ChildNodes) window._shelves.Add(Shelf.FromXmlElement(shelf)); return window; }
internal bool Contains(DesktopWindow window) { return LeftColumn.Contains(window) || RightColumn.Contains(window); }
/// <summary> /// Constructor /// </summary> /// <param name="window"></param> protected internal DesktopWindowView(DesktopWindow window) { }
public void SaveShelfState(string desktopWindowName, string shelfName, XmlDocument restoreDocument) { if (String.IsNullOrEmpty(shelfName)) return; desktopWindowName = desktopWindowName ?? ""; Initialize(); DesktopWindow window = _currentDesktop.GetDesktopWindow(desktopWindowName); if (window == null) { window = new DesktopWindow(desktopWindowName); _currentDesktop.AddDesktopWindow(window); } Shelf shelf = window.GetShelf(shelfName); if (shelf == null) { shelf = new Shelf(shelfName); window.AddShelf(shelf); } shelf.RestoreDocument = restoreDocument; }
internal void Restore(DesktopWindow window) { int index = windows.IndexOf(window); if (index >= 0) { CalculateNewHeightsAfterRestore(index); } }
protected WorkflowEventListenerArgs(DesktopWindow desktopWindow) { DesktopWindow = desktopWindow; }
public static IntPtr GetDesktopWindow(DesktopWindow desktopWindow) { IntPtr _ProgMan = GetShellWindow(); IntPtr _SHELLDLL_DefViewParent = _ProgMan; IntPtr _SHELLDLL_DefView = FindWindowEx(_ProgMan, IntPtr.Zero, "SHELLDLL_DefView", null); IntPtr _SysListView32 = FindWindowEx(_SHELLDLL_DefView, IntPtr.Zero, "SysListView32", "FolderView"); if (_SHELLDLL_DefView == IntPtr.Zero) { EnumWindows((hwnd, lParam) => { const int maxChars = 256; StringBuilder className = new StringBuilder(maxChars); if (GetClassName(hwnd, className, maxChars) > 0 && className.ToString() == "WorkerW") { IntPtr child = FindWindowEx(hwnd, IntPtr.Zero, "SHELLDLL_DefView", null); if (child != IntPtr.Zero) { _SHELLDLL_DefViewParent = hwnd; _SHELLDLL_DefView = child; _SysListView32 = FindWindowEx(child, IntPtr.Zero, "SysListView32", "FolderView"); ; return false; } } return true; }, IntPtr.Zero); } switch (desktopWindow) { case DesktopWindow.ProgMan: return _ProgMan; case DesktopWindow.SHELLDLL_DefViewParent: return _SHELLDLL_DefViewParent; case DesktopWindow.SHELLDLL_DefView: return _SHELLDLL_DefView; case DesktopWindow.SysListView32: return _SysListView32; default: return IntPtr.Zero; } }
/// <summary> /// Stops the hosted component. /// </summary> protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing && _host != null) { _host.StopComponent(); _host = null; if (_dialogBoxes != null) (_dialogBoxes as IDisposable).Dispose(); _dialogBoxes = null; _desktopWindow = null; } }
public WindowEventArgs(DesktopWindow window) { Window = window; }
/// <summary> /// Constructor. /// </summary> /// <param name="args">Creation args for the dialog box.</param> /// <param name="desktopWindow">The <see cref="DesktopWindow"/> that owns the dialog box.</param> protected internal DialogBox(DialogBoxCreationArgs args, DesktopWindow desktopWindow) :base(args) { _component = args.Component; _dialogSize = args.SizeHint; _size = args.Size; _allowUserResize = args.AllowUserResize; _desktopWindow = desktopWindow; _host = new Host(this, _component); }
public ActivityMonitorFailureWatcher(DesktopWindow window, Action showActivityMonitor) { _window = window; _showActivityMonitor = showActivityMonitor; _failedWorkItems = new HashSet<long>(); _connectionState = new DisconnectedState(this); }
public static IntPtr GetDesktopWindow(DesktopWindow desktopWindow = DesktopWindow.SysListView32) { var _ProgMan = GetShellWindow(); var _SHELLDLL_DefViewParent = _ProgMan; var _SHELLDLL_DefView = FindWindowEx(_ProgMan, IntPtr.Zero, "SHELLDLL_DefView", null); var _SysListView32 = FindWindowEx(_SHELLDLL_DefView, IntPtr.Zero, "SysListView32", "FolderView"); if (_SHELLDLL_DefView == IntPtr.Zero) { EnumWindows((hwnd, lParam) => { if (GetClassName(hwnd) == "WorkerW") { var child = FindWindowEx(hwnd, IntPtr.Zero, "SHELLDLL_DefView", null); if (child != IntPtr.Zero) { _SHELLDLL_DefViewParent = hwnd; _SHELLDLL_DefView = child; _SysListView32 = FindWindowEx(child, IntPtr.Zero, "SysListView32", "FolderView"); return false; } } return true; }, IntPtr.Zero); } switch (desktopWindow) { case DesktopWindow.ProgMan: return _ProgMan; case DesktopWindow.SHELLDLL_DefViewParent: return _SHELLDLL_DefViewParent; case DesktopWindow.SHELLDLL_DefView: return _SHELLDLL_DefView; case DesktopWindow.SysListView32: return _SysListView32; default: return IntPtr.Zero; } }
/// <summary> /// Creates a new view for the specified <see cref="DesktopWindow"/>. /// </summary> /// <remarks> /// Override this method if you want to return a custom implementation of <see cref="IDesktopWindowView"/>. /// In practice, it is preferable to subclass <see cref="DesktopWindowView"/> rather than implement <see cref="IDesktopWindowView"/> /// directly. /// </remarks> /// <param name="window"></param> /// <returns></returns> public virtual IDesktopWindowView CreateDesktopWindowView(DesktopWindow window) { return new DesktopWindowView(window); }