Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace System.Windows {
- public static class WindowTitleExtentsions {
- public static void SetTitle(this Window w,string s = "",bool includeBuildDate = false) {
- w.Title = includeBuildDate ? GetTitleWBuildDate(s) : GetTitle(s);
- }
- public static string GetTitleWBuildDate(string s = "") {
- //"M/d/yyyy h:mm:ss:ffff"
- //string nt = AboutAssembly.Current.Title + " - " + AboutAssembly.Current.Version.ToString();
- string nt = string.Format("{0} - {1}",
- AboutAssembly.Current.Title,
- AboutAssembly.Current.Version);
- if(!string.IsNullOrWhiteSpace(s))
- nt += " - " + s;
- string Build_Fmt = "ddd, MMM/dd/yyyy h:mm tt";
- #if DEBUG
- Build_Fmt = "ddd, MMM/dd/yyyy h:mm:ss tt";
- #endif
- nt += string.Format(" - Built on {0}",
- AboutAssembly.Current.BuildDate.ToString(Build_Fmt));
- return nt;
- }
- public static string GetTitle(string s = "") {
- string nt = string.Format("{0} - {1}",
- AboutAssembly.Current.Title,
- AboutAssembly.Current.Version);
- if(!string.IsNullOrWhiteSpace(s))
- return nt + " - " + s;
- else
- return nt;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment