about_snippets_visualstudio/About/Form1.cs

58 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Eugen.ESystem.Windows.Forms
{
public partial class Form1 : Form
{
#region Version und Copyright
// Version und Copyright
string name = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen
string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
string copyright = ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
string icon = Application.StartupPath + "\\Info.bmp";
//Assembly Datum und Zeit
static DateTime value = AssemblyDateTime();
string date = value.ToShortDateString();
string time = value.ToLongTimeString();
private static DateTime AssemblyDateTime()
{
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var buildDateTime = new DateTime(2000, 1, 1).Add(new TimeSpan(TimeSpan.TicksPerDay * version.Build + TimeSpan.TicksPerSecond * 2 * version.Revision));
//Tage seit dem 1. Januar 2000 und Sekunden seit Mitternacht, (multiplizier mit 2 ergibt das Original)
return buildDateTime;
}
#endregion
public Form1()
{
InitializeComponent();
}
private void buttonShowAbout_Click(object sender, EventArgs e)
{
//
//Diese Zeile und die dazugehörige Methode in das Programm kopieren
//
// Zeigt das 'About' Fenster an
ShowAboutWindow(name, version, copyright);
}
private void ShowAboutWindow(string programName, string programVersion, string programCopyright)
{
var about = new Eugen.ESystem.Windows.Forms.About(programName, programVersion, programCopyright);
about.ShowDialog();
}
}
}