private void iconList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count >= 1) { _currentIconReference = ((AvailableIcon)e.AddedItems[0]).IconReference; } }
public LibraryIconSelectorControl(LibraryViewModel viewModel, Window userInterface) { InitializeComponent(); _userInterface = userInterface; _viewModel = viewModel; _currentIconReference = _viewModel.IconReference; _browseCommand = new Commands.BrowseCommand(this); _availableIcons = new ObservableCollection <AvailableIcon>(); _defaultIconPath = String.Format(@"{0}windows\system32\imageres.dll", Environment.SystemDirectory.Substring(0, 3).ToLowerInvariant()); tipText.Inlines.Add("Tip: Try browsing "); Run linkText = new Run(_defaultIconPath); Hyperlink link = new Hyperlink(linkText); //link.NavigateUri = new Uri(webAddress.Text); link.Click += new RoutedEventHandler(link_Click); tipText.Inlines.Add(link); tipText.Inlines.Add("."); AddDefaultIcons(); // add the icon(s) from the referenced file, unless it is one of the defaults. if (!IsBuiltInLibraryIcon(_currentIconReference)) { AddIcons(_currentIconReference.ModuleName); } base.DataContext = this; }
/// <exception cref="UnauthorizedAccessException"></exception> private BatScriptConfig TryCastToBatScriptConfig(IScriptStorageModel script, RegistryName registryName, MenuLocation location) { BatScriptConfig newConfig = null; try { IIconReference iconReference = null; if (!string.IsNullOrWhiteSpace(script.Icon)) { iconReference = new IconReference(script.Icon); } newConfig = new BatScriptConfig(registryName.Name, registryName.ID, settings, messagePrompt, iconPicker) { Label = script.Label, Icon = iconReference }; newConfig.LoadScript(); newConfig.ModifyLocation(location, true); } catch (System.Security.SecurityException) { return(null); } catch (ObjectDisposedException) { return(null); } catch (IOException) { return(null); } catch (ScriptAccessException) { return(null); } if (script.Command.Length <= 8 || script.Command.Substring(0, 5) != cmd) { return(null); } if (script.Command.Substring(7, 2) == BatScriptConfig.keepCMDOpen) { newConfig.KeepWindowOpen = true; } else if (script.Command.Substring(7, 2) == BatScriptConfig.closeCMD) { newConfig.KeepWindowOpen = false; } else { return(null); } return(newConfig); }
public void Constructor_String_WorksWithValidValues(string filePath, string index) { string reference = filePath + "," + index; subject = new IconReference(reference); Assert.AreEqual(filePath, subject.FilePath); Assert.AreEqual(index, subject.IconIndex.ToString()); }
private void AddDefaultIcons() { var systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System); foreach (int defaultIconIndex in _defaultIconIndexes) { IconReference iconRef = new IconReference(System.IO.Path.Combine(systemFolder, _defaultIconFile), defaultIconIndex); _availableIcons.Add(new AvailableIcon(iconRef)); } }
public void ClearWindow() { iconList2.Remove(tempWindow); windowFrame.RemoveChild(closeButton); RemoveChild(windowFrame); windowFrame = closeButton = null; tempWindow = null; }
public void MakeIconFolder(string assetName, string folderName) { ScheduleOnce((dt) => { var parentSprite = spriteModelFactory.MakeFolder(assetName, folderName, 400, 400, 1f); var mIconRef = new IconReference(parentSprite, assetName, 1f, true); iconList2.Add(mIconRef); AddEventListener(mListener.Copy(), mIconRef.Sprite); AddChild(mIconRef.Sprite, iconList2.Count, SpriteTypes.FolderTag); }, 0); }
public void Test_SelectNewIcon_OverwritesIconReferenceIfDialogDoesnotReturnNull(int index) { IconReference iconReference = new IconReference("filepath", 7); Given_All3ScriptConfigsAreInOrder(); Given_IconPicker_SelectIconReference_Returns(iconReference); Given_SelectedScriptConfigIndex_Equals(index); subject.SelectNewIcon.DoExecute(null); mockConfigs[index].VerifySet(m => m.Icon = iconReference); }
public void Test_SelectNewIcon_PromptsUserAboutRemovingTheIconIfThereAlreadyisOne() { IconReference iconReference = new IconReference("filepath", 7); Given_All3ScriptConfigsAreInOrder(); Given_SelectedScriptConfigIndex_Equals(0); Given_ScriptConfigs_IconReferences_Equal(iconReference); Given_MessagePrompt_PromptYesNo_IsVerifiable(); subject.SelectNewIcon.DoExecute(null); messagePrompt.Verify(m => m.PromptYesNo("Are you sure you want to remove the icon from One?", "Are you sure?", MessageType.Warning), Times.Once); }
private bool IsBuiltInLibraryIcon(IconReference iconRef) { bool isBuiltIn = false; if ((System.IO.Path.GetFileName(iconRef.ModuleName).Equals(_defaultIconFile, StringComparison.InvariantCultureIgnoreCase) && _defaultIconIndexes.Contains(iconRef.ResourceId)) || iconRef.ReferencePath.Equals(WinLibrary.DefaultIconReference, StringComparison.InvariantCultureIgnoreCase)) { isBuiltIn = true; } return(isBuiltIn); }
public void Test_SelectNewIcon_DoesNotRemoveTheIconIfThereAlreadyisOneButThePromptReturnsNo() { IconReference iconReference = new IconReference("filepath", 7); Given_All3ScriptConfigsAreInOrder(); Given_SelectedScriptConfigIndex_Equals(0); Given_ScriptConfigs_IconReferences_Equal(iconReference); Given_MessagePrompt_PromptYesNo_Returns(MessageResult.No); subject.SelectNewIcon.DoExecute(null); mockScriptOne.VerifySet(m => m.Icon = null, Times.Never); }
private void SaveIconToSidecarImpl() { var directory = SelectedDirectory; var icon = IconReference.FromResource(directory.FullPath, SelectedIcon.FullPath); var directoryInfo = new DirectoryInfo(directory.FullPath); var infoFile = new FolderInfoFile(directoryInfo); var info = infoFile.Object; info.Icon.Main = icon.Resource; infoFile.Save(); directory.Image.Refresh(); directory.OnPropertyChanged(nameof(directory.SidecarExists)); directory.OnPropertyChanged(nameof(directory.Sidecar)); }
void ApplyFolderIconsImpl(DirectoryInfo current, IconReference parentIcon, bool previewMode, bool fixAttributesOnly = false, bool recursive = true) { var iniFile = new DesktopIniParser(current.FullName); var icon = iniFile.Icon; var iconInfo = FolderIconInfo.Get(current.FullName); //IconReference finalIcon; //var isNew = GetCurrentIcon(current, icon, parentIcon, iconInfo, out finalIcon); if (parentIcon.IsEmpty) { var parentDirectory = current.IsRoot() ? current : current.Parent; parentIcon = new DesktopIniParser(parentDirectory.FullName).Icon; } var finalIcon = GetCurrentIconFromSidecar(current, iconInfo, parentIcon); if (!fixAttributesOnly && !finalIcon.IsEmpty && iniFile.Icon.Resource != finalIcon.Resource) { ReportProgress(0, $"<<LINK:{finalIcon.Resource}||{finalIcon.Icon.FullName}::500>>\t==>\t<<LINK:{current.FullName}::800>> [<<LINK:{icon.Info}>>]"); //ReportStatus($"Setting Main Icon To [LINK:{icon.Info}::500] for [LINK:{current.FullName}::800] [Parent: [LINK:{parentIcon.Info}]]"); if (!previewMode) { iniFile.IconResource = finalIcon; iniFile.Save(); } } else { var thisFile = iniFile.Ini; var verified = thisFile.VerifyHiddenSystem(!previewMode); verified &= thisFile.Directory.VerifySystem(!previewMode); verified &= FolderInfoFile.GetFile(thisFile.Directory.FullName, SidecarType.Main).VerifyHiddenSystem(!previewMode); if (!verified) { ReportProgress(0, $"*** Fixing desktop.ini attributes for <<LINK:{current.FullName}::1200>> [<<LINK:{icon.Info}>>]"); } } if (!recursive) { return; } foreach (var child in current.EnumerateDirectoriesSafe()) { ApplyFolderIconsImpl(child, finalIcon.IsEmpty ? parentIcon : finalIcon, previewMode, fixAttributesOnly); } }
/// <summary> /// Adds link "N minutes timer" /// </summary> /// <param name="minutes">The number of minutes</param> /// <param name="timerName">Name of the timer</param> /// <param name="icon">The icon for the jump-list</param> private static JumpListLink GetMinutesLink(int minutes, string timerName, IconReference icon) { string title = string.Format("New {0} minute{1} timer", minutes, IsPlural(minutes) ? "s" : ""); string arguments = " -minutes=" + minutes; if (!string.IsNullOrEmpty(timerName) && timerName != TimerOptions.Default.TimerName) { arguments += string.Format(" -name=\"{0}\"", timerName); title += string.Format(" ({0})", timerName); } return(new JumpListLink(Application.ExecutablePath, title) { IconReference = icon, Arguments = arguments }); }
private void SaveIconToSidecarImpl() { var directory = SelectedDirectory; var icon = IconReference.FromResource(directory.FullPath, SelectedIcon.FullPath); var directoryInfo = new DirectoryInfo(directory.FullPath); //TODO: Simplify Access to FolderInfoFile Constructor var infoFile = new FolderInfoFile(directoryInfo, SidecarType.Main, null); var info = infoFile.Object; info.Icon.Main = icon.Resource; infoFile.Save(); directory.Image.Result.Refresh(); directory.OnPropertyChanged(nameof(directory.SidecarExists)); directory.OnPropertyChanged(nameof(directory.Sidecar)); }
public WinLibrary(string name, List <string> folders, string saveFolder, IconReference iconReference) { _name = name; _saveFolder = saveFolder; _iconReference = iconReference; _libraryType = LibraryFolderType.Generic; if (folders == null) { _folders = new List <string>(); } else { _folders = folders; } }
/// <exception cref="UnauthorizedAccessException"></exception> private PowershellScriptConfig TryCastToPowershellScriptConfig(IScriptStorageModel script, RegistryName registryName, MenuLocation location) { PowershellScriptConfig newConfig = null; try { IIconReference iconReference = null; if (!string.IsNullOrWhiteSpace(script.Icon)) { iconReference = new IconReference(script.Icon); } newConfig = new PowershellScriptConfig(registryName.Name, registryName.ID, settings, messagePrompt, iconPicker) { Label = script.Label, Icon = iconReference }; newConfig.LoadScript(); newConfig.ModifyLocation(location, true); } catch (System.Security.SecurityException) { return(null); } catch (ObjectDisposedException) { return(null); } catch (IOException) { return(null); } catch (ScriptAccessException) { return(null); } if (script.Command.Length <= 12 || script.Command.Substring(0, 12) != powershell) { return(null); } newConfig.KeepWindowOpen = script.Command.Contains(PowershellScriptConfig.noExit); return(newConfig); }
public void CallBackIcon(string base64, string text, string extension) { ScheduleOnce((dt) => { if (base64 != "" && text != "") { var yLocation = mRandom.Next((int)(spriteModelFactory.DynamicHeight * 0.3f), (int)(spriteModelFactory.DynamicHeight - (spriteModelFactory.DynamicHeight * 0.3f))); var xLocation = mRandom.Next((int)(spriteModelFactory.DynamicWidth * 0.3f), (int)(spriteModelFactory.DynamicWidth - (spriteModelFactory.DynamicWidth * 0.3f))); var newIcons = spriteModelFactory.MakeIconBase64(base64, text, xLocation, yLocation, 1f, 1f, true); var mIconRef = new IconReference(newIcons, base64, 1f, true); iconList2.Add(mIconRef); AddEventListener(mListener.Copy(), mIconRef.Sprite); AddChild(mIconRef.Sprite, iconList2.Count, SpriteTypes.IconTag); } }, 0); }
public IconGenerationResult(IconGenerationFolder folder, double priority, IconReference icon) { Folder = folder; Priority = priority; Icon = icon; if (Folder == null) { Priorities = new[] { Priority }; return; } FolderSource = Folder.FolderSource; Root = Folder.Root; Source = Folder.Source; Path = Folder.Path; Directory = Folder.Directory; Priorities = new [] { Root.Priority, Folder.Priority, Path.Priority, Priority, Source.Priority }; }
static IconReference GetCurrentIconFromDirectory(DirectoryInfo current, FolderIconInfo iconInfo, IconReference parentIcon) { var baseDirectory = Path.Combine(LibSetting.Directories.Library, current.GetFullNameWithoutRoot()); var testDirectories = new[] { current.FullName, //Path.Combine(baseDirectory, current.Name), baseDirectory }; var testFileNames = new[] { current.Name, Path.Combine(current.Name, current.Name), "", "current" }; var testFileExtensions = new[] { ".ico", ".icl" }; var roots = iconInfo .GetRoots() .Select(x => Path.Combine(LibSetting.Directories.Library, x)) .ToArray(); foreach (var name in testFileNames) { foreach (var directory in roots.Concat(testDirectories)) { foreach (var extension in testFileExtensions) { var testPath = string.IsNullOrEmpty(name) ? directory + name + extension : Path.Combine(directory, name + extension); var testFile = new FileInfo(testPath); var message = current.FullName.Suffix(": ").PadRight(50) + testFile?.FullName; if (testFile.Exists && testFile.FullName != parentIcon.Icon?.FullName) { Debug.WriteLine("*** " + message); return(IconReference.FromFile(testFile)); } // Debug.WriteLine(" " + message); } } } Debug.WriteLine("xxx " + current.FullName.Suffix(": ").PadRight(50) + parentIcon.Icon?.FullName); return(IconReference.Empty); }
bool GetCurrentIconFromIni(DirectoryInfo current, IconReference currentIcon, IconReference parentIcon, FolderIconInfo iconInfo, out IconReference finalIcon) { if (currentIcon.Resource != parentIcon.Resource && !currentIcon.IsEmpty) { finalIcon = currentIcon; return(true); } if (!string.IsNullOrEmpty(iconInfo.Main)) { finalIcon = currentIcon; return(false); } finalIcon = GetCurrentIconFromDirectory(current, iconInfo, parentIcon); if (finalIcon.IsEmpty) { finalIcon = currentIcon; return(false); } return(true); }
/// <summary> /// Converts an icon reference to a WPF bitmap source. /// </summary> /// <param name="iconRef"></param> /// <returns></returns> public static ImageSource IconReferenceToImageSource(IconReference iconRef) { Icon icon = IconHelper.ExtractBestFitIcon(iconRef.ModuleName, iconRef.ResourceId, new System.Drawing.Size(32, 32)); //Icon icon = IconHelper.ExtractIcon(iconRef.ModuleName, iconRef.ResourceId); if (icon != null) { if (icon.Width <= 32) { Bitmap bitmap = icon.ToBitmap(); IntPtr hBitmap = bitmap.GetHbitmap(); ImageSource wpfBitmap = Imaging.CreateBitmapSourceFromHBitmap( hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); return(wpfBitmap); } } return(null); }
private static IconGenerationResult GetIconGenerationResultFromReference(IconReference icon, double priority = 100, DirectoryInfo directory = null, bool checkIconExists = false) { if (!icon.Validate(checkIconExists)) { return(null); } //var debug = string.IsNullOrWhiteSpace(icon.BaseDirectory); var baseDirectory = string.IsNullOrWhiteSpace(icon.BaseDirectory) ? directory : DirectoriesIO.GetInfo(icon.BaseDirectory); if (directory == null) { directory = baseDirectory; } var root = new IconGenerationRoot(priority, baseDirectory); var source = new IconGenerationSource(root, root.Priority, baseDirectory); var relative = directory.ParseRelativePath(root.Directory); var path = new IconGenerationPath(source, root.Priority, relative); var folder = new IconGenerationFolder(path, root.Priority, relative.Directory); return(new IconGenerationResult(folder, root.Priority, icon)); }
public void ShowWindow(CCSprite currentSprite, string folderName) { if (isModal) { return; } windowFrame = new CCSprite("BlankFrame") { PositionX = currentSprite.Position.X, PositionY = currentSprite.Position.Y, Tag = SpriteTypes.WindowTag }; var scaling = (spriteModelFactory.DynamicWidth * 0.1f) / windowFrame.ContentSize.Width; windowFrame.ContentSize = new CCSize(windowFrame.ContentSize.Width * scaling, windowFrame.ContentSize.Height * scaling); closeButton = new CCSprite("IconClose"); closeButton.ContentSize = new CCSize(windowFrame.ContentSize.Width * 0.075f, windowFrame.ContentSize.Width * 0.075f); closeButton.PositionX = windowFrame.ContentSize.Width - closeButton.ContentSize.Width / 2 - 3; closeButton.PositionY = windowFrame.ContentSize.Height - closeButton.ContentSize.Height / 2 - 3; closeButton.Tag = SpriteTypes.CloseWindowTag; AddEventListener(mListener.Copy(), closeButton); ScheduleOnce((dt) => { windowFrame.AddChild(closeButton, 1001, SpriteTypes.CloseWindowTag); lock (storedList) { var mEqualList = storedList.Where(l => l.FolderName == folderName).ToList(); for (var i = 0; i < mEqualList.Count; i++) { // Pull respective icon var mStoredIconRef = mEqualList[i]; var mSprite = mStoredIconRef.Sprite; var mContent = mSprite.GetChildByTag(SpriteTypes.ContentTag) as CCLabel; if (mContent != null) { var parentSprite = new CCSprite("BlankFrame"); parentSprite.ContentSize = new CCSize(windowFrame.ContentSize.Width * 0.25f, windowFrame.ContentSize.Height * 0.25f); var pSpacing = parentSprite.ContentSize.Width * 0.15f; var xSpacing = parentSprite.ContentSize.Width * ((i % 3)) + pSpacing * ((i % 3) + 1); var ySpacing = parentSprite.ContentSize.Height * ((i / 3)) + pSpacing * ((i / 3) + 1); parentSprite.PositionX = (parentSprite.ContentSize.Width * 0.5f) + xSpacing; parentSprite.PositionY = windowFrame.ContentSize.Height - (parentSprite.ContentSize.Height * 0.5f) - ySpacing; parentSprite.Tag = SpriteTypes.IconTag; mStoredIconRef.Sprite.ContentSize = parentSprite.ContentSize; mStoredIconRef.Sprite.PositionX = parentSprite.PositionX; mStoredIconRef.Sprite.PositionY = parentSprite.PositionY; byte[] bytes = Convert.FromBase64String(mStoredIconRef.Base64); var testTexture = new CCTexture2D(bytes); var testFrame = new CCSpriteFrame(testTexture, new CCRect(0, 0, testTexture.PixelsWide, testTexture.PixelsHigh)); var subIconFrame = new CCSprite(testFrame) { AnchorPoint = CCPoint.AnchorMiddle, ContentSize = new CCSize(parentSprite.ContentSize.Width * 0.75f, parentSprite.ContentSize.Height * 0.75f), PositionX = parentSprite.ContentSize.Width * 0.5f, PositionY = parentSprite.ContentSize.Height * 0.5f + parentSprite.ContentSize.Height * 0.075f, Tag = SpriteTypes.ImageTag }; var label = new CCLabel(mContent.Text, "Arial", 22, CCLabelFormat.SystemFont) { Scale = 0.25f * scaling, AnchorPoint = CCPoint.AnchorMiddle, HorizontalAlignment = CCTextAlignment.Center, VerticalAlignment = CCVerticalTextAlignment.Center, PositionX = parentSprite.ContentSize.Width * 0.5f, PositionY = parentSprite.ContentSize.Height * 0.075f, Color = CCColor3B.Black, Visible = mStoredIconRef.TextVisible, Tag = SpriteTypes.ContentTag }; parentSprite.AddChild(subIconFrame); AddEventListener(mListener.Copy(), parentSprite); windowFrame.AddChild(parentSprite, 1001, SpriteTypes.IconTag); parentSprite.AddChild(label); } } } AddEventListener(mListener.Copy(), windowFrame); tempWindow = new IconReference(windowFrame, "Window", 1f, true); iconList2.Add(tempWindow); AddChild(windowFrame, 1000, SpriteTypes.WindowTag); var moveAction = new CCMoveTo(0.2f, new CCPoint(spriteModelFactory.DynamicWidth / 2f, spriteModelFactory.DynamicHeight / 2f)); var dimension = Math.Min(spriteModelFactory.DynamicHeight, spriteModelFactory.DynamicWidth); var scale = (dimension / windowFrame.ContentSize.Width) * 0.9f; var scaleAction = new CCScaleTo(0.2f, scale); windowFrame.AddActions(false, moveAction, scaleAction); isModal = true; }, 0); }
public void SetUp() { subject = null; }
public void ToString_ReturnsPathCommaIndex(string filePath, string index) { subject = new IconReference(filePath, index); Assert.AreEqual(filePath + "," + index, subject.ToString()); }
public override int GetHashCode() { return(Enabled.GetHashCode() ^ IconReference.GetHashCode() ^ AutoApproval.GetHashCode() ^ VirtualServerObjects.GetEnumHashCode()); }
IconReference GetCurrentIconFromSidecar(DirectoryInfo current, FolderIconInfo iconInfo, IconReference parentIcon) { if (!string.IsNullOrEmpty(iconInfo.Main)) { return(iconInfo); } var finalIcon = GetCurrentIconFromDirectory(current, iconInfo, parentIcon); return(finalIcon.IsEmpty ? parentIcon : finalIcon); }
IconReference GetCurrentIconFromSidecar(DirectoryInfo current, FolderIconInfo iconInfo, IconReference parentIcon) { //TODO: Evaluate use of FolderIconInfo.Main vs FolderIconInfo.Icon/GetIconResource() if (!string.IsNullOrEmpty(iconInfo.Main)) { return(iconInfo); } var finalIcon = GetCurrentIconFromDirectory(current, iconInfo, parentIcon); return(finalIcon.IsEmpty ? parentIcon : finalIcon); }
bool OnTouchBegan(CCTouch touch, CCEvent touchEvent) { CCSprite caller = touchEvent.CurrentTarget as CCSprite; if (caller.Tag == SpriteTypes.IconTag) { ReorderChild(caller, 999); } CurrentSpriteTouched = null; touchType = Tags.Tag.None; startTime = DateTime.Now; if (windowFrame != null) { if (windowFrame.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { if (closeButton.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { isModal = false; var scaleAction = new CCScaleTo(0.2f, 0.05f); var functionAction = new CCCallFunc(ClearWindow); windowFrame.AddActions(false, scaleAction, functionAction); return(true); } var mIcons = windowFrame.Children; foreach (var mIcon in mIcons) { if (mIcon.Tag == SpriteTypes.IconTag && mIcon.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.TransitionIcon; var mContent = mIcon.GetChildByTag(SpriteTypes.ContentTag) as CCLabel; if (mContent != null) { StoredIconReference mStoredRef = null; foreach (StoredIconReference storedRef in storedList) { var mLoopSprite = storedRef.Sprite; var mLoopContent = mLoopSprite.GetChildByTag(SpriteTypes.ContentTag) as CCLabel; if (mLoopContent != null && mLoopContent.Text == mContent.Text) { var xMin = (spriteModelFactory.DynamicHeight * 0.1f) / 2; var yLocation = mRandom.Next((int)(spriteModelFactory.DynamicHeight * 0.3f), (int)(spriteModelFactory.DynamicHeight - (spriteModelFactory.DynamicHeight * 0.3f))); var xLocation = mRandom.Next((int)(spriteModelFactory.DynamicWidth * 0.3f), (int)(spriteModelFactory.DynamicWidth - (spriteModelFactory.DynamicWidth * 0.3f))); var newIcon = spriteModelFactory.MakeIconBase64(storedRef.Base64, mLoopContent.Text, xLocation, yLocation, storedRef.Scale, storedRef.TextScale, storedRef.TextVisible); var mIconRef = new IconReference(newIcon, storedRef.Base64, 1f, true); AddEventListener(mListener.Copy(), mIconRef.Sprite); iconList2.Add(mIconRef); AddChild(mIconRef.Sprite); mStoredRef = storedRef; } } if (mStoredRef != null) { storedList.Remove(mStoredRef); } } isModal = false; iconList2.Remove(tempWindow); windowFrame.RemoveChild(closeButton); RemoveChild(windowFrame); windowFrame = closeButton = null; tempWindow = null; return(true); } } return(false); } } #region ButtonSpecific Listeners if (caller.GetHashCode() == speakerFrame.GetHashCode()) { foreach (IconReference iconRef in iconList2) { var rect = iconRef.Sprite.BoundingBoxTransformedToWorld; if (speakerFrame.BoundingBoxTransformedToParent.IntersectsRect(rect)) { return(false); } } if (speakerFrame.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.Speak; CurrentSpriteTouched = speakerFrame; caller.Opacity = 155; return(true); } else { return(false); } } else if (caller.GetHashCode() == addFrame.GetHashCode()) { foreach (IconReference iconRef in iconList2) { var rect = iconRef.Sprite.BoundingBoxTransformedToWorld; if (addFrame.BoundingBoxTransformedToParent.IntersectsRect(rect)) { return(false); } } if (addFrame.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.Add; CurrentSpriteTouched = addFrame; caller.Opacity = 155; return(true); } else { return(false); } } else if (caller.GetHashCode() == takePhotoFrame.GetHashCode()) { foreach (IconReference iconRef in iconList2) { var rect = iconRef.Sprite.BoundingBoxTransformedToWorld; if (takePhotoFrame.BoundingBoxTransformedToParent.IntersectsRect(rect)) { return(false); } } if (takePhotoFrame.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.TakePhoto; CurrentSpriteTouched = takePhotoFrame; caller.Opacity = 155; return(true); } else { return(false); } } else if (caller.GetHashCode() == addFolderFrame.GetHashCode()) { foreach (IconReference iconRef in iconList2) { var rect = iconRef.Sprite.BoundingBoxTransformedToWorld; if (addFolderFrame.BoundingBoxTransformedToParent.IntersectsRect(rect)) { return(false); } } if (addFolderFrame.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.Folder; CurrentSpriteTouched = addFolderFrame; caller.Opacity = 155; return(true); } else { return(false); } } else if (caller.GetHashCode() == singleFrame.GetHashCode()) { foreach (IconReference iconRef in iconList2) { var rect = iconRef.Sprite.BoundingBoxTransformedToWorld; if (singleFrame.BoundingBoxTransformedToParent.IntersectsRect(rect)) { return(false); } } if (singleFrame.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.SingleMode; CurrentSpriteTouched = singleFrame; caller.Opacity = 155; return(true); } else { return(false); } } else if (caller.GetHashCode() == multiFrame.GetHashCode()) { foreach (IconReference iconRef in iconList2) { var rect = iconRef.Sprite.BoundingBoxTransformedToWorld; if (multiFrame.BoundingBoxTransformedToParent.IntersectsRect(rect)) { return(false); } } if (multiFrame.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.MultiMode; CurrentSpriteTouched = multiFrame; caller.Opacity = 155; return(true); } else { return(false); } } #endregion foreach (IconReference iconRef in iconList2) { if (iconRef.Sprite.Tag == SpriteTypes.IconTag) { if (inSingleMode) { if (caller.GetHashCode() == iconRef.Sprite.GetHashCode()) { if (iconRef.Sprite.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.Icon; CurrentSpriteTouched = iconRef.Sprite; caller.Opacity = 155; DeSelectIcons(); caller.Color = Green; return(true); } else { return(false); } } } else { if (caller.GetHashCode() == iconRef.Sprite.GetHashCode()) { if (iconRef.Sprite.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.Icon; CurrentSpriteTouched = iconRef.Sprite; caller.Opacity = 155; if (!sentenceFrame.Visible) { caller.Color = Green; } return(true); } else { return(false); } } } } else if (iconRef.Sprite.Tag == SpriteTypes.FolderTag) { if (caller.GetHashCode() == iconRef.Sprite.GetHashCode()) { if (iconRef.Sprite.BoundingBoxTransformedToWorld.ContainsPoint(touch.Location)) { touchType = Tags.Tag.FolderIcon; CurrentSpriteTouched = iconRef.Sprite; caller.Opacity = 155; return(true); } else { return(false); } } } } return(false); }