public void AddClient(Client c) { Logger.Info($"add {c.Title}"); ClientList.Add(c); Task.Run(() => { Icon item = Win32dll.GetAppIcon(c.Hwnd); IconList.Add(item); //Logger.Warn( $"all Client {ClientTitles.ToJson( ) }" ); }); }
public void Tile(string selectedTag, int UIHeight) { List <Client> tiledClient = ClientList(selectedTag).Where(c => c.TileMode == TileMode.Tile).ToList( ); if (tiledClient.Count == 0) { return; } var master = tiledClient.First( ); var masterWidth = Tag(selectedTag).MasterWidth; bool onlyOne = tiledClient.Count == 1; masterWidth = onlyOne ? ScreenGeom.Width : masterWidth; ResizeClient(master, ScreenGeom.Left, ScreenGeom.Top + UIHeight, masterWidth, ScreenGeom.Height - UIHeight); Logger.Info($"master {master.Title} : {master.Rect}"); if (onlyOne) { return; } var winGeom = ScreenGeom; var slaveList = tiledClient.Skip(1).ToList( ); int slaveCount = slaveList.Count; var x = master.Rect.X + master.Rect.Width; int y = winGeom.Top + UIHeight; var w = winGeom.Width - masterWidth; var h = (ScreenGeom.Height - UIHeight) / slaveCount; for (int i = 0; i < slaveCount; i++) { var item = slaveList[i]; bool isLastOne = (i + 1 == slaveCount); var height = isLastOne ? winGeom.Top + winGeom.Height - y - 2 * item.Bw : h - 2 * item.Bw; ResizeClient(item, x, y, w - 2 * item.Bw, height); Logger.Info($"slave {item.Title} : {item.Rect}"); User32Methods.GetWindowRect(item.Hwnd, out var rect); if (!isLastOne) { y = item.Rect.Top + rect.Height; } } }