public void MarkSingleInstanceOnly(ToolStripItem menuItem, InstanceData instanceData) { this.ConstructingWaiter.Wait(); string instanceName = instanceData.InstanceName; bool needMark = true; Dictionary<string, MarkedInstance> markedInstancesCopy = this.MarkedInstances.ToDictionary(pair => pair.Key, pair => pair.Value); foreach (var markedInstance in markedInstancesCopy) { if (markedInstance.Key.EqualsIgnoreCase(instanceName)) { needMark = false; this.MarkedInstances[markedInstance.Key].LastKnownToolstrip = menuItem; } else { //We don't have that information initially or if call comes not from toolstrip. So perform a check. MarkedInstance instanceInfo = markedInstance.Value; this.UnMarkInstanceInternal(instanceInfo.LastKnownToolstrip, instanceInfo.InstanceData); } } if (needMark) { this.MarkInstanceInternal(menuItem, instanceData); } }
public virtual void MarkEntry(ToolStripItem menuItem, InstanceData instanceData) { this.ConstructingWaiter.Wait(); if (this.MarkedInstances.ContainsKey(instanceData.InstanceName)) { return; } this.MarkInstanceInternal(menuItem, instanceData); }
public virtual bool MarkInstance(InstanceData instanceData) { var rootPath = instanceData.InstaceRootPath; if (!this.CopyFavIcon(rootPath)) { return false; } var iconPath = GetFavIconPath(rootPath); return this.ChangeFolderIconNative(rootPath, iconPath); }
public static void UnMarkInstance(ToolStripItem menuItem, InstanceData instanceData) { ActualProvider.UnMarkEntry(menuItem, instanceData); }
public static void ToggleInstanceMarking(ToolStripItem menuItem, InstanceData instanceData) { ActualProvider.ToggleMarking(menuItem, instanceData); }
public static void MarkSingleInstanceOnly(ToolStripItem menuItem, InstanceData instanceData) { ActualProvider.MarkSingleInstanceOnly(menuItem, instanceData); }
public virtual void UnMarkInstance(InstanceData instanceData) { string rootPath = instanceData.InstaceRootPath; File.Delete(GetDesktopIniPath(rootPath)); this.ChangeFolderIconNative(rootPath, null); }
public MarkedInstance(InstanceData instanceData, ToolStripItem lastKnownToolstrip) { this.InstanceData = instanceData; this.LastKnownToolstrip = lastKnownToolstrip; }
public virtual void ToggleMarking(ToolStripItem menuItem, InstanceData instanceData) { this.ConstructingWaiter.Wait(); if (this.MarkedInstances.ContainsKey(instanceData.InstanceName)) { this.UnMarkInstanceInternal(menuItem, instanceData); } else { this.MarkInstanceInternal(menuItem, instanceData); } }
protected virtual void UnMarkInstanceInternal(ToolStripItem menuItem, InstanceData instanceData) { this.FileSystemProvider.UnMarkInstance(instanceData); if (menuItem != null) { this.MakeMenuItemUnmarked(menuItem); } this.MarkedInstances.Remove(instanceData.InstanceName); }
protected virtual void MarkInstanceInternal(ToolStripItem menuItem, InstanceData instanceData) { if (!this.FileSystemProvider.MarkInstance(instanceData)) { return; } if (menuItem != null) { this.MakeMenuItemMarked(menuItem); } this.MarkedInstances.Add(instanceData.InstanceName, new MarkedInstance(instanceData, menuItem)); }