public static VirtualDesktop FromComObject(IVirtualDesktop desktop) { VirtualDesktopHelper.ThrowIfNotSupported(); var wrapper = wrappers.GetOrAdd(desktop.GetID(), _ => new VirtualDesktop(desktop)); return wrapper; }
protected virtual NodeParseResult ParseNode(IVirtualDesktop node) { var result = ParseContainer("VirtualDesktop #" + (node.Index + 1) + " (id: " + node.Index + ")", node.Direction, new RECT(), node.MyFocusNode, node.FocusNode, node.Childs); if (node.FloatingNodes.Count == 0) { return(result); } var desktop = result.Element as GraphCluster; var relations = new List <GraphRelation>(); var clusters = new List <GraphCluster>(); var objects = new List <GraphObject>(); // Create a new frame for all floating objects and add an relation to small circle above var floaters = AllocCluster(); floaters.Label = "Floating nodes"; ParseChilds(ref floaters, ref objects, ref relations, ref clusters, node.MyFocusNode, node.FocusNode, node.FloatingNodes); // Alloc small circle inside desktop frame var obj = AllocObject(); obj.Label = "Floating"; obj.Shape = GraphShapeEnum.Circle; desktop.Objects.Add(obj); relations.Add(new GraphRelation(obj, floaters.RelateToCluster, relateFromObj2Cluster: floaters)); clusters.Add(floaters); relations.AddRange(result.Relations); clusters.AddRange(result.Clusters); return(new NodeParseResult(result.Element, result.Objects, relations, clusters)); }
/// <summary> /// Switches the active desktop /// </summary> public void SwitchDesktop() { Logger.Debug("Cambiar el escritorio virtual activo"); Debug.Assert(this.Desktops.Count > 0, "There are no desktop registered"); if (!this.HasDesktopActive) { this.ActivateDefaultDesktop(); } else { IVirtualDesktop currentDesktop = this.ActiveDesktop; this.Desktops .ToList() .ForEach(vd => vd.Deactivate()); this.ActiveDesktop = null; IVirtualDesktop desktop = this.Desktops.Where(vd => vd.Id != currentDesktop.Id).FirstOrDefault(); if (desktop != null) { this.ActiveDesktop = desktop; this.ActiveDesktop.Activate(); } else { this.ActivateDefaultDesktop(); } } }
public override bool TransferNodeToAnotherDesktop(Node child, IVirtualDesktop destination) { var ret = false; var i = Childs.IndexOf(child); if (i == -1) { return(false); } _ignoreChildsOnUpdateRect.Add(i); if (destination.AddNodes(child)) { _ignoreChildsOnUpdateRect.Remove(i); ret = true; Desktop.FocusTracker.Untrack(Childs[i]); RemoveChildAt(i, false); if (i > 0) { Childs[i - 1].SetFocus(); } else if (i < Childs.Count) { Childs[i].SetFocus(); } } else { _ignoreChildsOnUpdateRect.Remove(i); } return(ret); }
void IVirtualDesktopNotification.VirtualDesktopCreated(IVirtualDesktop pDesktop) { if (Created != null) { Created.Invoke(this, FromComObject(pDesktop)); } }
public void VirtualDesktopRenamed(IVirtualDesktop pDesktop, string chName) { var desktop = pDesktop.ToVirtualDesktop(); desktop._name = chName; Renamed?.Invoke(this, new VirtualDesktopRenamedEventArgs(desktop, chName)); }
public static VirtualDesktop FromComObject(IVirtualDesktop desktop) { VirtualDesktopHelper.ThrowIfNotSupported(); var wrapper = wrappers.GetOrAdd(desktop.GetID(), _ => new VirtualDesktop(desktop)); return(wrapper); }
public void VirtualDesktopWallpaperChanged(IVirtualDesktop pDesktop, string chPath) { var desktop = pDesktop.ToVirtualDesktop(); desktop._wallpaperPath = chPath; WallpaperChanged?.Invoke(this, new VirtualDesktopWallpaperChangedEventArgs(desktop, chPath)); }
/// <summary> /// Activates the default desktop /// </summary> public void ActivateDefaultDesktop() { Logger.Debug("Activar el escritorio virtual por defecto"); Debug.Assert(this.Desktops.Count > 0, "There are no desktop registered"); this.ActiveDesktop = this.Desktops.First(); this.ActiveDesktop.Activate(); }
void IVirtualDesktopNotification.CurrentVirtualDesktopChanged(IVirtualDesktop pDesktopOld, IVirtualDesktop pDesktopNew) { var args = new VirtualDesktopChangedEventArgs(FromComObject(pDesktopOld), FromComObject(pDesktopNew)); if (CurrentChanged != null) { CurrentChanged.Invoke(this, args); } }
void IVirtualDesktopNotification.VirtualDesktopDestroyed(IVirtualDesktop pDesktopDestroyed, IVirtualDesktop pDesktopFallback) { var args = new VirtualDesktopDestroyEventArgs(FromComObject(pDesktopDestroyed), FromComObject(pDesktopFallback)); if (Destroyed != null) { Destroyed.Invoke(this, args); } }
private static string DesktopNameFromDesktop(IVirtualDesktop desktop) { var desktopName = Microsoft.Win32.Registry .GetValue( $"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\VirtualDesktops\\Desktops\\{{{desktop.GetId()}}}", "Name", null)?.ToString(); if (string.IsNullOrEmpty(desktopName)) { desktopName = "Desktop " + (DesktopManager.GetDesktopIndex(desktop) + 1); } return(desktopName); }
public VirtualDesktopConfiguration(IVirtualDesktop targetDesktop, IConfigurationFactory factory) { Guid = targetDesktop.Guid; var background = targetDesktop.Background; _backgroundPath = background.Path; _fit = background.Fit; TargetDesktop = targetDesktop; _backgroundPathSetter = SetBackgroundPath; _fitSetter = SetFit; _propertyChangedBinding = factory.Bind(UpdateFromTarget, targetDesktop); _configurationFactory = factory; }
/// <summary> /// get index of desktop /// </summary> internal static int GetDesktopIndex(IVirtualDesktop desktop) { int index = -1; var IdSearch = desktop.GetId(); VirtualDesktopManagerInternal.GetDesktops(out var desktops); for (int i = 0; i < VirtualDesktopManagerInternal.GetCount(); i++) { desktops.GetAt(i, typeof(IVirtualDesktop).GUID, out object objdesktop); if (IdSearch.CompareTo(((IVirtualDesktop)objdesktop).GetId()) == 0) { index = i; break; } } Marshal.ReleaseComObject(desktops); return(index); }
public IVirtualDesktop GetAdjacentDesktop(IVirtualDesktop pDesktopReference, AdjacentDesktop uDirection) { if (_manager14328 != null) { return(_manager14328.GetAdjacentDesktop(pDesktopReference, uDirection)); } if (_manager10240 != null) { return(_manager10240.GetAdjacentDesktop(pDesktopReference, uDirection)); } if (_manager10130 != null) { return(_manager10130.GetAdjacentDesktop(pDesktopReference, uDirection)); } throw new NotSupportedException(); }
// TODO //public VirtualDesktopConfiguration(IVirtualDesktop targetDesktop, IConfigurationFactory factory) //{ // BindToTarget(targetDesktop, factory); // // should take values from desktop // UpdateFromTarget(); //} public void BindToTarget(IVirtualDesktop value, IConfigurationFactory factory) { _propertyChangedBinding?.Unbind(); TargetDesktop = value; _configurationFactory = factory; if (value == null) { _backgroundPathSetter = path => ThrowWhenUnbound(nameof(BackgroundPath)); _fitSetter = fit => ThrowWhenUnbound(nameof(Fit)); return; } _backgroundPathSetter = SetBackgroundPath; _fitSetter = SetFit; _propertyChangedBinding = factory.Bind(UpdateFromTarget, value); var updateTargetBackground = true; // TODO this should have tests for it causing a return if (!_backgroundPath.HasValue) { _backgroundPath = value.Background.Path; updateTargetBackground = false; } // TODO be sure to fully test that this returns if (_fit.Equals(default(Fit))) { _fit = value.Background.Fit; updateTargetBackground = false; } if (!updateTargetBackground) { return; } value.Background = factory.BackgroundFrom(_backgroundPath, _fit); }
public void Travel(IVirtualDesktop start) { _global_object_index = 0; _global_cluster_index = 1; var result = ParseNode(start); Objects = result.Objects; Clusters = result.Clusters; Relations = result.Relations; if (result.Element is GraphCluster) { var cc = result.Element as GraphCluster; Clusters.Add(cc); } else { Objects.Add(result.Element as GraphObject); } }
public void SwitchDesktop(IVirtualDesktop desktop) { if (_manager14328 != null) { _manager14328?.SwitchDesktop(desktop); return; } if (_manager10240 != null) { _manager10240?.SwitchDesktop(desktop); return; } if (_manager10130 != null) { _manager10130.SwitchDesktop(desktop); return; } throw new NotSupportedException(); }
public void RemoveDesktop(IVirtualDesktop pRemove, IVirtualDesktop pFallbackDesktop) { if (_manager14328 != null) { _manager14328.RemoveDesktop(pRemove, pFallbackDesktop); return; } if (_manager10240 != null) { _manager10240.RemoveDesktop(pRemove, pFallbackDesktop); return; } if (_manager10130 != null) { _manager10130.RemoveDesktop(pRemove, pFallbackDesktop); return; } throw new NotSupportedException(); }
public void MoveViewToDesktop(IntPtr pView, IVirtualDesktop desktop) { if (_manager14328 != null) { _manager14328?.MoveViewToDesktop(pView, desktop); return; } if (_manager10240 != null) { _manager10240?.MoveViewToDesktop(pView, desktop); return; } if (_manager10130 != null) { _manager10130.MoveViewToDesktop(pView, desktop); return; } throw new NotSupportedException(); }
void IVirtualDesktopNotification.VirtualDesktopCreated(IVirtualDesktop pDesktop) { Created?.Invoke(this, FromComObject(pDesktop)); }
void IVirtualDesktopNotification.CurrentVirtualDesktopChanged(IVirtualDesktop pDesktopOld, IVirtualDesktop pDesktopNew) { var args = new VirtualDesktopChangedEventArgs(FromComObject(pDesktopOld), FromComObject(pDesktopNew)); CurrentChanged?.Invoke(this, args); }
public void SetDesktopWallpaper(IVirtualDesktop desktop, string path) => throw new NotSupportedException();
public void SetDesktopName(IVirtualDesktop desktop, string name) => throw new NotSupportedException();
public void MoveViewToDesktop(IntPtr hWnd, IVirtualDesktop desktop) => this.InvokeMethod(Args(this._factory.ApplicationViewFromHwnd(hWnd).ComObject, ((VirtualDesktop)desktop).ComObject));
public void RemoveDesktop(IVirtualDesktop pRemove, IVirtualDesktop pFallbackDesktop) => this.InvokeMethod(Args(((VirtualDesktop)pRemove).ComObject, ((VirtualDesktop)pFallbackDesktop).ComObject));
public void SwitchDesktop(IVirtualDesktop desktop) => this.InvokeMethod(Args(((VirtualDesktop)desktop).ComObject));
public IVirtualDesktop GetAdjacentDesktop(IVirtualDesktop pDesktopReference, AdjacentDesktop uDirection) => this.InvokeMethodAndWrap(Args(((VirtualDesktop)pDesktopReference).ComObject, uDirection));
private VirtualDesktop(IVirtualDesktop comObject) { ComObjects.Register(comObject); this.Id = comObject.GetID(); }
void IVirtualDesktopNotification.VirtualDesktopDestroyFailed(IVirtualDesktop pDesktopDestroyed, IVirtualDesktop pDesktopFallback) { var args = new VirtualDesktopDestroyEventArgs(FromComObject(pDesktopDestroyed), FromComObject(pDesktopFallback)); DestroyFailed?.Invoke(this, args); }
internal static void Register(IVirtualDesktop vd) { _virtualDesktops.AddOrUpdate(vd.GetID(), vd, (guid, desktop) => vd); }
private Desktop(IVirtualDesktop itf) { this.itf = itf; }
private Desktop(IVirtualDesktop desktop) { this.ivd = desktop; }
private VirtualDesktop(IVirtualDesktop comObject) { this.ComObject = comObject; this.Id = comObject.GetID(); }
/// <summary> /// Initializes a new instance of the <see cref="ActiveDesktopChangedInfo"/> class. /// </summary> /// <param name="newActiveDesktop">The new active desktop.</param> public ActiveDesktopChangedInfo(IVirtualDesktop newActiveDesktop) { this.newActiveDesktop = newActiveDesktop; }
public void CurrentVirtualDesktopChanged(IVirtualDesktop pDesktopOld, IVirtualDesktop pDesktopNew) { this.CurrentChangedCore(pDesktopOld, pDesktopNew); }