private Image GetSocket(Socket socket, string suffix) { const string socketFormat = "pack://application:,,,/Images/Sockets/{0}.png"; string color; switch (socket.Attribute) { case "D": color = "green" + suffix; break; case "I": color = "blue" + suffix; break; case "S": color = "red" + suffix; break; default: color = "white" + suffix; break; } var url = string.Format(socketFormat, color); var img = new AlphaHittestedImage { Stretch = Stretch.None, Source = ApplicationState.BitmapCache.GetByLocalUrl(url) }; return img; }
private bool isSocketed(Tuple<int, int> nextAvail, Socket socket, int socketIndex, Gear item) { if (item.SocketedItems == null || item.SocketedItems.Count == 0) return false; return item.SocketedItems.Exists(i => i.Socket == socketIndex && (socket.Attribute == i.Color || socket.Attribute == "G" || i.Color == "G")); }
private Gem getSocketItemAt(Tuple<int, int> nextAvail, Socket socket, int socketIndex, Gear item) { return item.SocketedItems.First(i => i.Socket == socketIndex && (socket.Attribute == i.Color || socket.Attribute == "G" || i.Color == "G")); }
private Image getSocket(Tuple<int, int> current, Socket socket, string suffix) { string socketFormat = "pack://application:,,,/POEBuildOptimizer;component/Procurement/Images/Sockets/{0}.png"; string color = null; switch (socket.Attribute) { case "D": color = "green" + suffix; break; case "I": color = "blue" + suffix; break; case "S": color = "red" + suffix; break; default: color = "white" + suffix; break; } Image img = new Image(); var bitmap = new BitmapImage(new Uri(string.Format(socketFormat, color), UriKind.Absolute)); img.Stretch = System.Windows.Media.Stretch.None; bitmap.CacheOption = BitmapCacheOption.OnLoad; bitmap.Freeze(); img.Source = bitmap; return img; }