public void Init(string Name, string Image, string Description, int?Probability = null) { ButtonName.Text = Name; ButtonImage.Source = Resources[Image] as BitmapImage; ActionDescription.Init(Name, Resources[Image] as BitmapImage, Description, Probability); }
public void Init(string Name, System.Drawing.Image Image, string Description, int?Probability = null) { ButtonName.Text = Name; using (MemoryStream Stream = new MemoryStream()) { Image.Save(Stream, ImageFormat.Png); BitmapImage Temp = new BitmapImage(); Temp.BeginInit(); Temp.CacheOption = BitmapCacheOption.OnLoad; Temp.StreamSource = Stream; Temp.EndInit(); ButtonImage.Source = Temp; ActionDescription.Init(Name, Temp, Description, Probability); } }