Friday, October 25, 2019

Text Over Progressbar

Transparent labels don't work in winforms so the text has to be manually drawn. From this article, you can add percents. Based on that code, here is a version with bolded custom text:

        private void UpdateProgressText(string ProgressText)
        {
            using (Graphics gr = prgStatus.CreateGraphics())
            {
                gr.DrawString(ProgressText,
                    new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold),
                    Brushes.Black,
                    new PointF(prgStatus.Width / 2 - (gr.MeasureString(ProgressText,
                        SystemFonts.DefaultFont).Width / 2.0F),
                    prgStatus.Height / 2 - (gr.MeasureString(ProgressText,
                        SystemFonts.DefaultFont).Height / 2.0F)));
            }
        }

Make sure to call UpdateProgressText() in the ProgressChanged() handler after doing a prgBar.Update();

Tuesday, October 22, 2019

Unblock Files Recursively

If you run into this scenario:


It happens when executables and msi's are downloaded from a browser. 

To fix it, just run this command in powershell:

dir -Path C:\Temp -Recurse | Unblock-File

It will remove the blocking for all files and subdirectories under the specified path.

Monday, September 9, 2019

Include dll Reference in Standalone exe for Visual Studio

If you want to build referenced .dll files into your exe so that you can end up with a standalone exe, follow these steps:

Copy the .dll file(s) to somewhere inside your project and include them
Make sure it is set as an Embedded Resource
In the project properties, Resources tab, add existing resource
Select the .dll that you included in the first step
Add the the .dll as a reference
Set Copy Local to false
In the code for the Form, insert the following code so that it executes before InitializeComponent()

AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => { string resourceName = new AssemblyName(args.Name).Name + ".dll"; string resource = Array.Find(this.GetType().Assembly.GetManifestResourceNames(), element => element.EndsWith(resourceName)); using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource)) { Byte[] assemblyData = new Byte[stream.Length]; stream.Read(assemblyData, 0, assemblyData.Length); return Assembly.Load(assemblyData); } };

You may need to add using System.Reflection; to your form for that code to work.



Thursday, August 29, 2019

Error Copying Files to VMware Image - Cannot scan local directory



This is a deceiving error from VMware. All it really means is that the source file path is too long.

Solution: Copy the file/folder from the source location to a simpler location (ie C:\Temp) and then copy the files from that simple location into your VM image.









Sunday, July 28, 2019

Air Fryer Guide


Air Fryer Temp/Times all from Experience!


I always have to look up the correct temp and timing when I use my air fryer so I decided to jot them all down here so I they are in a single place. I have started with recommendations from around the internet and adjusted them according to my experiences.


  • Frozen french fries - 380°  10 min
  • Frozen chicken nuggets - 400°  10 min
  • Frozen spring rolls - 360°  10 min
  • Pizza Rolls - 380°  10 min
  • Totino's Pizza - 390°  10 min - crunchy crust
  • Reheat Delivery Pizza - 320°  5 min
  • Reheat Leftover Waffle - 300°  3 min
  • Reheat Chicken Wings - 350°  4 min then 400°  4-5 min depending on size
  • Warm up boxed taco shells - 250°  2 min
  • Frozen burritos - Coat with oil, 320°  20 min
  • Brussles sprouts - Toss in a bowl with olive oil, salt & pepper. Cook at 360°  12 min, shaking half way through. Toss again with balsamic and parmesan cheese.
  • Hotdogs - 380°  5 min



The air fryer that I use is a COSORI 5.8qt and I love it.




Test post, please ignore