/// <summary> /// Removes an application tile from the list. /// </summary> /// <param name="tile">The tile to remove.</param> /// <remarks>Disposes the <see cref="AppTile"/> (it cannot be reused).</remarks> private void RemoveTile(AppTile tile) { #region Sanity checks if (tile == null) throw new ArgumentNullException(nameof(tile)); #endregion // Flush queue first, to allow proper recoloring AddQueuedTiles(); _flowLayout.Controls.Remove(tile); if (tile.Visible) _flowLayout.Height -= tile.Height; _tileDictionary.Remove(tile.InterfaceUri); tile.Dispose(); RecolorTiles(); }
/// <inheritdoc/> public IAppTile QueueNewTile(FeedUri interfaceUri, string appName, AppStatus status, IIconCache iconCache = null, bool machineWide = false) { #region Sanity checks if (interfaceUri == null) { throw new ArgumentNullException(nameof(interfaceUri)); } if (appName == null) { throw new ArgumentNullException(nameof(appName)); } if (_tileDictionary.ContainsKey(interfaceUri)) { throw new InvalidOperationException("Duplicate interface URI"); } #endregion var tile = new AppTile(interfaceUri, appName, status, iconCache, machineWide) { Width = _flowLayout.Width }; if (appName.ContainsIgnoreCase(TextSearch.Text)) { _appTileQueueHeight += tile.Height; // Alternate between light and dark tiles tile.BackColor = _lastTileLight ? TileColorDark : TileColorLight; _lastTileLight = !_lastTileLight; } else { tile.Visible = false; } _appTileQueue.Add(tile); _tileDictionary.Add(interfaceUri, tile); return(tile); }
/// <summary> /// Removes an application tile from the list. /// </summary> /// <param name="tile">The tile to remove.</param> /// <remarks>Disposes the <see cref="AppTile"/> (it cannot be reused).</remarks> private void RemoveTile(AppTile tile) { #region Sanity checks if (tile == null) throw new ArgumentNullException(nameof(tile)); #endregion // Flush queue first, to allow propper recoloring AddQueuedTiles(); _flowLayout.Controls.Remove(tile); if (tile.Visible) _flowLayout.Height -= tile.Height; _tileDictionary.Remove(tile.InterfaceUri); tile.Dispose(); RecolorTiles(); }
/// <inheritdoc/> public IAppTile QueueNewTile(FeedUri interfaceUri, string appName, AppStatus status, IIconCache iconCache = null, bool machineWide = false) { #region Sanity checks if (interfaceUri == null) throw new ArgumentNullException(nameof(interfaceUri)); if (appName == null) throw new ArgumentNullException(nameof(appName)); if (_tileDictionary.ContainsKey(interfaceUri)) throw new InvalidOperationException("Duplicate interface URI"); #endregion var tile = new AppTile(interfaceUri, appName, status, iconCache, machineWide) {Width = _flowLayout.Width}; if (appName.ContainsIgnoreCase(TextSearch.Text)) { _appTileQueueHeight += tile.Height; // Alternate between light and dark tiles tile.BackColor = _lastTileLight ? TileColorDark : TileColorLight; _lastTileLight = !_lastTileLight; } else tile.Visible = false; _appTileQueue.Add(tile); _tileDictionary.Add(interfaceUri, tile); return tile; }