Skip to content

Commit

Permalink
Add runtime framework moniker to WinForms demo form title
Browse files Browse the repository at this point in the history
  • Loading branch information
jwosty committed Dec 30, 2019
1 parent fe0c768 commit 364be14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion NAudioDemo/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System.Linq;
using System.Reflection;
using System.Runtime.Versioning;
using System.Windows.Forms;
using NAudioDemo.Utils;

Expand All @@ -21,7 +23,9 @@ public MainForm()
listBoxDemos.Items.Add(demo);
}

Text += ((System.Runtime.InteropServices.Marshal.SizeOf(IntPtr.Zero) == 8) ? " (x64)" : " (x86)");
var arch = Environment.Is64BitProcess ? "x64" : "x86";
var framework = Assembly.GetEntryAssembly().GetCustomAttribute<TargetFrameworkAttribute>().FrameworkName;
this.Text = $"{this.Text} ({framework}) ({arch})";
}


Expand Down
3 changes: 1 addition & 2 deletions NAudioWpfDemo/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ public MainWindow()
InitializeComponent();
var arch = Environment.Is64BitProcess ? "x64" : "x86";
var framework = Assembly.GetEntryAssembly().GetCustomAttribute<TargetFrameworkAttribute>().FrameworkName;
//this.Title = this.Title + arch;
this.Title = $"{this.Title} ({framework}, {arch})";
this.Title = $"{this.Title} ({framework}) ({arch})";
}
}
}

0 comments on commit 364be14

Please sign in to comment.