private void AssertCopy(IFavorite copy) { int stored = this.CheckDatabase.Favorites.Count(); Assert.AreEqual(2, stored, "Favorites count doesn't match after copy added to the persistence"); IFavorite secondary = this.SecondaryFavorites.ToList()[1]; Assert.AreEqual(secondary.ServerName, FAVORITE_SERVERNAME2, "Values not updated properly"); // next method loads details of not loaded favorite from database, it shouldn't fail, even if it is a copy string toolTip = copy.GetToolTipText(); Assert.IsFalse(string.IsNullOrEmpty(toolTip), "ToolTip wasn't resolved for copy of favorite"); }
internal void UpdateByFavorite(IFavorite favorite) { this.Name = favorite.Name; this.Text = favorite.Name; this.Favorite = favorite; this.Tag = favorite; // temporary solution, for backward compatibility only this.ImageKey = FavoriteIcons.GetTreeviewImageListKey(favorite.Protocol); this.SelectedImageKey = this.ImageKey; // possible performance hit on SQL persistence, when loading details for each created favorite and also in menu loader this.ToolTipText = favorite.GetToolTipText(); }
private ToolStripButton CreateFavoriteButton(IFavorite favorite) { Image buttonImage = favorite.ToolBarIconImage; ToolStripButton favoriteBtn = new ToolStripButton(favorite.Name, buttonImage, this.serverToolStripMenuItemClick); favoriteBtn.ToolTipText = favorite.GetToolTipText(); favoriteBtn.Tag = favorite; favoriteBtn.Overflow = ToolStripItemOverflow.AsNeeded; return favoriteBtn; }
private static ToolStripMenuItem CreateFavoriteMenuItem(IFavorite favorite) { ToolStripMenuItem item = new ToolStripMenuItem(favorite.Name); item.Tag = FAVORITE; item.Image = favorite.ToolBarIconImage; item.ToolTipText = favorite.GetToolTipText(); return item; }
private static ListViewItem FavoriteToListViewItem(IFavorite favorite) { var item = new ListViewItem(); item.Tag = favorite; item.Text = favorite.Name; item.ToolTipText = favorite.GetToolTipText(); item.ImageKey = FavoriteIcons.GetTreeviewImageListKey(favorite.Protocol); return item; }