// // - Methods - // /// <summary> /// Checks the version of both the application and the DVTk library. /// <br></br> /// If one or both are a non-official or Alpha version, a warning message box is displayed. /// </summary> public static void CheckVersion() { String warningText = String.Empty; // // Check the version of the application. // Assembly applicationAssembly = Assembly.GetEntryAssembly(); if (IsLocalBuild(applicationAssembly)) { warningText = "This application with version number " + GetVersionString(applicationAssembly) + " is an untested non-official version!"; } else if (IsAlphaBuild(applicationAssembly)) { warningText = "This application with version number " + GetVersionString(applicationAssembly) + " is an untested Alpha version!"; } // // Check the version of the library. // // Any class, enumerate from the DVTk assembly will work. Dvtk.Events.ReportLevel reportLevel = Dvtk.Events.ReportLevel.None; Assembly libraryAssembly = Assembly.GetAssembly(reportLevel.GetType()); if (IsLocalBuild(libraryAssembly)) { if (warningText.Length > 0) { warningText += "\n\n"; } warningText += "The DVTk library (used by this application) with version number " + GetVersionString(libraryAssembly) + " is an untested non-official version!"; } else if (IsAlphaBuild(libraryAssembly)) { if (warningText.Length > 0) { warningText += "\n\n"; } warningText += "The DVTk library (used by this application) with version number " + GetVersionString(libraryAssembly) + " is an untested Alpha version!"; } // // Display a message box with a warning if needed. // if (warningText.Length > 0) { MessageBox.Show(warningText, "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void AboutForm_Load(object sender, System.EventArgs e) { // // Get the versions of the application and library. // Assembly applicationAssembly = Assembly.GetEntryAssembly(); String applicationVersion = GetVersionString(applicationAssembly); // Any class, enumerate from the DVTk assembly will work. Dvtk.Events.ReportLevel reportLevel = Dvtk.Events.ReportLevel.None; Assembly libraryAssembly = Assembly.GetAssembly(reportLevel.GetType()); String libraryVersion = GetVersionString(libraryAssembly); // // Set the caption text of this form. // this.Text = string.Format("About {0}", this.applicationName); // // Set the versions and the copyright statement in this form. // StringBuilder versionString = new StringBuilder(); StringBuilder copyrightString = new StringBuilder(); StringBuilder lGPLString = new StringBuilder(); versionString.Append(applicationName + " " + applicationVersion + "\n\n"); versionString.Append("DVTk Library " + libraryVersion + "\n"); copyrightString.Append("DVTk - The Healthcare Validation Toolkit (www.dvtk.org)\n\n"); FileInfo info = new FileInfo(Assembly.GetExecutingAssembly().Location); copyrightString.Append("Copyright © " + info.CreationTime.Year + " DVTk\n"); lGPLString.Append("DVTk is free software; you can redistribute it and/or modify it under the terms of the GNU\n"); lGPLString.Append("Lesser General Public License as published by the Free Software Foundation; either version 3.0\n"); lGPLString.Append("of the License, or (at your option) any later version.\n"); lGPLString.Append("\n"); lGPLString.Append("DVTk is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even\n"); lGPLString.Append("the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser\n"); lGPLString.Append("General Public License for more details.\n"); lGPLString.Append("\n"); lGPLString.Append("You should have received a copy of the GNU Lesser General Public License along with this\n"); lGPLString.Append("application; if not, see <http://www.gnu.org/licenses/>\n"); this.labelVersions.Text = versionString.ToString(); this.labelCopyRight.Text = copyrightString.ToString(); this.labelLGPL.Text = lGPLString.ToString(); }