Storing WPF Image Resources

If you will use the image in multiple places, then it’s worth loading the image data only once into memory and then sharing it between all Image elements. To do this, create a BitmapSource as a resource somewhere: <BitmapImage x:Key=”MyImageSource” UriSource=”../Media/Image.png” /> Then, in your code, use something like: <Image Source=”{StaticResource MyImageSource}” /> In my … Read more

How to read embedded resource text file

You can use the Assembly.GetManifestResourceStream Method: Add the following usings using System.IO; using System.Reflection; Set property of relevant file: Parameter Build Action with value Embedded Resource Use the following code var assembly = Assembly.GetExecutingAssembly(); var resourceName = “MyCompany.MyProduct.MyFile.txt”; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream)) { string result = reader.ReadToEnd(); } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)