diff --git a/Daten/Construction.png b/Daten/Construction.png new file mode 100644 index 0000000..1d4b1d0 Binary files /dev/null and b/Daten/Construction.png differ diff --git a/Daten/Email.png b/Daten/Email.png new file mode 100644 index 0000000..ec32fd8 Binary files /dev/null and b/Daten/Email.png differ diff --git a/Daten/Error.png b/Daten/Error.png new file mode 100644 index 0000000..4248432 Binary files /dev/null and b/Daten/Error.png differ diff --git a/Daten/Information.png b/Daten/Information.png new file mode 100644 index 0000000..6c532b2 Binary files /dev/null and b/Daten/Information.png differ diff --git a/Daten/Instruction.png b/Daten/Instruction.png new file mode 100644 index 0000000..79f1c8d Binary files /dev/null and b/Daten/Instruction.png differ diff --git a/Daten/Question.png b/Daten/Question.png new file mode 100644 index 0000000..22ccc4f Binary files /dev/null and b/Daten/Question.png differ diff --git a/Daten/Telephone.png b/Daten/Telephone.png new file mode 100644 index 0000000..7aadfda Binary files /dev/null and b/Daten/Telephone.png differ diff --git a/Daten/Tips.png b/Daten/Tips.png new file mode 100644 index 0000000..73a3cc0 Binary files /dev/null and b/Daten/Tips.png differ diff --git a/Daten/Warning.png b/Daten/Warning.png new file mode 100644 index 0000000..82772fe Binary files /dev/null and b/Daten/Warning.png differ diff --git a/Info/Class1.cs b/Info/Class1.cs deleted file mode 100644 index f570702..0000000 --- a/Info/Class1.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Info -{ - public class Class1 - { - } -} diff --git a/Info/Info.csproj b/Info/Info.csproj deleted file mode 100644 index d49035a..0000000 --- a/Info/Info.csproj +++ /dev/null @@ -1,54 +0,0 @@ - - - - - Debug - AnyCPU - e23aff77-ebf4-4966-b3e4-a49fc6ce92c7 - Library - Properties - Info - Info - v4.6.1 - 512 - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Info.sln b/InfoBox.sln similarity index 61% rename from Info.sln rename to InfoBox.sln index d347696..b42047b 100644 --- a/Info.sln +++ b/InfoBox.sln @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28307.645 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Info", "Info\Info.csproj", "{E23AFF77-EBF4-4966-B3E4-A49FC6CE92C7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfoBox", "InfoBox\InfoBox.csproj", "{E23AFF77-EBF4-4966-B3E4-A49FC6CE92C7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test_InfoBox", "Test_Info\Test_InfoBox.csproj", "{3683B887-8256-414A-B502-0F6B7088654D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,6 +17,10 @@ Global {E23AFF77-EBF4-4966-B3E4-A49FC6CE92C7}.Debug|Any CPU.Build.0 = Debug|Any CPU {E23AFF77-EBF4-4966-B3E4-A49FC6CE92C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E23AFF77-EBF4-4966-B3E4-A49FC6CE92C7}.Release|Any CPU.Build.0 = Release|Any CPU + {3683B887-8256-414A-B502-0F6B7088654D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3683B887-8256-414A-B502-0F6B7088654D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3683B887-8256-414A-B502-0F6B7088654D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3683B887-8256-414A-B502-0F6B7088654D}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/InfoBox/FixLineLenght.cs b/InfoBox/FixLineLenght.cs new file mode 100644 index 0000000..e7391ee --- /dev/null +++ b/InfoBox/FixLineLenght.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Eugen.ESystem.Windows.Forms +{ + public static class FixLineLenght + { + /// + /// Formats a string with a fixed line length. + /// + static FixLineLenght() + { + } + + /// + /// Formats a string with a fixed line length. + /// + /// String to be formatted. + /// Maximum line length + /// + public static string Format(string text, int lineLenght) + { + int pos = 0; + int spacePos = 0; + string character = ""; + string temp = ""; + string result = ""; + + while (text.Length > 0) + { + if (text.Length <= lineLenght) + { + result = String.Concat(result, text); + text = ""; + } + else + { + while (pos <= lineLenght) + { + character = text.Remove(0, pos).Remove(1); + + //Bei einem Zeilenumbruch oder Wagenrücklauf eine neu Zeile beginnen + if (character == "\n" || character == "\r") + { + spacePos = text.IndexOf("\n") + 1; + break; + } + + if (character == " ") + { + spacePos = pos + 1; + } + + pos++; + } + + temp = text.Remove(spacePos - 1); + if (temp.EndsWith("\n") || temp.EndsWith("\r")) + { + temp = temp.Remove(temp.Length - 1);// Ein schon enthaltenes '\n' oder '\r' am Ende de temporären Strings muss entfernt werden + } + text = text.Remove(0, spacePos); + result = String.Concat(result, temp, "\r\n"); + pos = 0; + spacePos = 0; + } + } + + return result; + } + } +} diff --git a/InfoBox/InfoBox.Designer.cs b/InfoBox/InfoBox.Designer.cs new file mode 100644 index 0000000..33bf0d3 --- /dev/null +++ b/InfoBox/InfoBox.Designer.cs @@ -0,0 +1,175 @@ +namespace Eugen.ESystem.Windows.Forms +{ + partial class InfoBox + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pictureBox = new System.Windows.Forms.PictureBox(); + this.labelTitle = new System.Windows.Forms.Label(); + this.labelHeaderRow1 = new System.Windows.Forms.Label(); + this.labelHeaderRow2 = new System.Windows.Forms.Label(); + this.labelHeaderRow3 = new System.Windows.Forms.Label(); + this.textBox = new System.Windows.Forms.TextBox(); + this.buttonClose1 = new System.Windows.Forms.Button(); + this.buttonClose2 = new System.Windows.Forms.Button(); + this.buttonExport = new System.Windows.Forms.Button(); + this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // pictureBox + // + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Information; + this.pictureBox.Location = new System.Drawing.Point(20, 20); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(32, 32); + this.pictureBox.TabIndex = 0; + this.pictureBox.TabStop = false; + // + // labelTitle + // + this.labelTitle.AutoSize = true; + this.labelTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 28F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelTitle.Location = new System.Drawing.Point(70, 15); + this.labelTitle.Name = "labelTitle"; + this.labelTitle.Size = new System.Drawing.Size(98, 44); + this.labelTitle.TabIndex = 4; + this.labelTitle.Text = "Title"; + // + // labelHeaderRow1 + // + this.labelHeaderRow1.AutoSize = true; + this.labelHeaderRow1.Location = new System.Drawing.Point(78, 80); + this.labelHeaderRow1.Name = "labelHeaderRow1"; + this.labelHeaderRow1.Size = new System.Drawing.Size(36, 13); + this.labelHeaderRow1.TabIndex = 5; + this.labelHeaderRow1.Text = "Zeile1"; + // + // labelHeaderRow2 + // + this.labelHeaderRow2.AutoSize = true; + this.labelHeaderRow2.Location = new System.Drawing.Point(78, 93); + this.labelHeaderRow2.Name = "labelHeaderRow2"; + this.labelHeaderRow2.Size = new System.Drawing.Size(39, 13); + this.labelHeaderRow2.TabIndex = 6; + this.labelHeaderRow2.Text = "Zeile 2"; + // + // labelHeaderRow3 + // + this.labelHeaderRow3.AutoSize = true; + this.labelHeaderRow3.Location = new System.Drawing.Point(78, 106); + this.labelHeaderRow3.Name = "labelHeaderRow3"; + this.labelHeaderRow3.Size = new System.Drawing.Size(39, 13); + this.labelHeaderRow3.TabIndex = 7; + this.labelHeaderRow3.Text = "Zeile 3"; + // + // textBox + // + this.textBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBox.Location = new System.Drawing.Point(12, 140); + this.textBox.Multiline = true; + this.textBox.Name = "textBox"; + this.textBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.textBox.Size = new System.Drawing.Size(668, 288); + this.textBox.TabIndex = 3; + // + // buttonClose1 + // + this.buttonClose1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonClose1.Location = new System.Drawing.Point(605, 434); + this.buttonClose1.Name = "buttonClose1"; + this.buttonClose1.Size = new System.Drawing.Size(75, 23); + this.buttonClose1.TabIndex = 1; + this.buttonClose1.Text = "Schließen"; + this.buttonClose1.UseVisualStyleBackColor = true; + this.buttonClose1.Click += new System.EventHandler(this.buttonClose1_Click); + // + // buttonClose2 + // + this.buttonClose2.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.buttonClose2.Location = new System.Drawing.Point(309, 434); + this.buttonClose2.Name = "buttonClose2"; + this.buttonClose2.Size = new System.Drawing.Size(75, 23); + this.buttonClose2.TabIndex = 1; + this.buttonClose2.Text = "Schließen"; + this.buttonClose2.UseVisualStyleBackColor = true; + this.buttonClose2.Click += new System.EventHandler(this.buttonClose2_Click); + // + // buttonExport + // + this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonExport.Location = new System.Drawing.Point(12, 434); + this.buttonExport.Name = "buttonExport"; + this.buttonExport.Size = new System.Drawing.Size(75, 23); + this.buttonExport.TabIndex = 2; + this.buttonExport.Text = "Exportieren"; + this.buttonExport.UseVisualStyleBackColor = true; + this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click); + // + // saveFileDialog + // + this.saveFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.saveFileDialog_FileOk); + // + // InfoBox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(692, 469); + this.Controls.Add(this.buttonExport); + this.Controls.Add(this.buttonClose2); + this.Controls.Add(this.buttonClose1); + this.Controls.Add(this.textBox); + this.Controls.Add(this.labelHeaderRow3); + this.Controls.Add(this.labelHeaderRow2); + this.Controls.Add(this.labelHeaderRow1); + this.Controls.Add(this.labelTitle); + this.Controls.Add(this.pictureBox); + this.MinimumSize = new System.Drawing.Size(400, 300); + this.Name = "InfoBox"; + this.Text = "WindowTitle"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox pictureBox; + private System.Windows.Forms.Label labelTitle; + private System.Windows.Forms.Label labelHeaderRow1; + private System.Windows.Forms.Label labelHeaderRow2; + private System.Windows.Forms.Label labelHeaderRow3; + private System.Windows.Forms.TextBox textBox; + private System.Windows.Forms.Button buttonClose1; + private System.Windows.Forms.Button buttonClose2; + private System.Windows.Forms.Button buttonExport; + private System.Windows.Forms.SaveFileDialog saveFileDialog; + } +} \ No newline at end of file diff --git a/InfoBox/InfoBox.cs b/InfoBox/InfoBox.cs new file mode 100644 index 0000000..146cbe0 --- /dev/null +++ b/InfoBox/InfoBox.cs @@ -0,0 +1,264 @@ +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 InfoBox : Form + { + #region Version und Copyright + // Version und Copyright + static string dllName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen + static string dllVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + static string copyright = GenerateCopyright(); + 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; + } + + private static string CurrentYear() + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + + private static string StartYear() + { + string startYear = ""; + if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © ")) + { + startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", ""); + while (startYear.StartsWith(" ")) + { + startYear = startYear.Remove(0, 1); + } + startYear = startYear.Remove(startYear.IndexOf(" ")); + return startYear; + } + else + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + } + + private static string GenerateCopyright() + { + string startYear = StartYear(); + string currentYear = CurrentYear(); + + if (startYear == currentYear) + { + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + else + { + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear)); + } + } + #endregion + + #region DLL-Info + /// + /// Contains the name of the program file + /// + public static string DllName { set; get; } + + /// + /// Contains the version of the program file + /// + public static string DllVersion { set; get; } + + /// + /// Contains the copyright notice + /// + public static string Copyright { set; get; } + + private static void SetDllInfo() + { + //Name, Version und Copyright setzen + DllName = dllName; + DllVersion = dllVersion; + Copyright = copyright; + } + #endregion + + /// + /// Displays a self-defined information box + /// + static InfoBox() + { + SetDllInfo(); //Name, Version und Copyright der DLL setzen + } + + /// + /// Displays a self-defined information box + /// + /// A valid string. + /// The icon that is displayed. + /// A valid string. + /// A valid string. + /// A valid string. + /// A valid string. + /// A valid string. + /// 'True' = The Export function is available. 'False' = The export function is not available. + public InfoBox(string caption, Icons icon, string title, string headerRow1, string headerRow2, string headerRow3, string text, bool export) + { + SetDllInfo(); //Name, Version und Copyright der DLL setzen + + InitializeComponent(); + + SetContent(caption, icon, title, headerRow1, headerRow2, headerRow3, text, export); //Fensterinhalt setzen + } + + /// + /// Available Icons + /// + public enum Icons + { + Construction, + Email, + Error, + Information, + Instruction, + Question, + Telephon, + Tips, + Warning + } + + private void buttonClose1_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void buttonClose2_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void buttonExport_Click(object sender, EventArgs e) + { + //Speichert den Inhalt der TextBox oder den selektierten Bereich daraus + saveFileDialog.Filter = Language.dialog001; + saveFileDialog.ShowDialog(); + } + + private void saveFileDialog_FileOk(object sender, CancelEventArgs e) + { + string fileName = saveFileDialog.FileName; + string text = ExportText(); + + try + { + File.WriteAllText(fileName, text); //Schreibt den Text in eine Datei + } + catch (Exception) + { + MessageBox.Show(Language.message001, + Language.messageHead001, + MessageBoxButtons.OK, + MessageBoxIcon.Error, + MessageBoxDefaultButton.Button1); + } + } + + private void SetContent(string windowTitle, Icons icon, string title, string headerRow1, string headerRow2, string headerRow3, string text, bool export) + { + //Export Button freischalten oder nicht + if (export) + { + buttonExport.Visible = true; + buttonClose1.Visible = true; + buttonClose2.Visible = false; + } + else + { + buttonExport.Visible = false; + buttonClose1.Visible = false; + buttonClose2.Visible = true; + } + + //Icon setzen + switch (icon) + { + case Icons.Construction: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Construction; + break; + case Icons.Email: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Email; + break; + case Icons.Error: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Error; + break; + case Icons.Information: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Information; + break; + case Icons.Instruction: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Instruction; + break; + case Icons.Question: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Question; + break; + case Icons.Telephon: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Telephone; + break; + case Icons.Tips: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Tips; + break; + case Icons.Warning: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Warning; + break; + default: + this.pictureBox.Image = global::Eugen.ESystem.Windows.Forms.Pictures.Information; + break; + } + + this.Text = windowTitle; //Fenster Titel + labelTitle.Text = title; //Titel schreiben + labelHeaderRow1.Text = headerRow1; //Header Zeile 1 schreiben + labelHeaderRow2.Text = headerRow2; //Header Zeile 2 schreiben + labelHeaderRow3.Text = headerRow3; //Header Zeile 3 schreiben + textBox.Text = text; //Text schreiben + } + + private string ExportText() + { + if (textBox.SelectionLength > 0) + { + return textBox.SelectedText; //Gibt den selektierten Text zurück + } + else + { + return FixLineLenght.Format(textBox.Text, 80); //Gibt den ganzen Text formatiert zurück + } + } + + /// + /// Sets a user specific window size. + /// + /// A value greater than 400. + /// A value greater than 300. + public void SetSize(int width, int height) + { + this.ClientSize = new System.Drawing.Size(width - 8, height - 31); + } + } +} diff --git a/InfoBox/InfoBox.csproj b/InfoBox/InfoBox.csproj new file mode 100644 index 0000000..7b887c5 --- /dev/null +++ b/InfoBox/InfoBox.csproj @@ -0,0 +1,128 @@ + + + + + Debug + AnyCPU + {E23AFF77-EBF4-4966-B3E4-A49FC6CE92C7} + Library + Properties + InfoBox + InfoBox + v4.6.1 + 512 + false + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + InfoBox.cs + + + True + True + Language.de.resx + + + True + True + Language.resx + + + True + True + Language.en.resx + + + True + True + Pictures.resx + + + + + + InfoBox.cs + + + Eugen.ESystem.Windows.Forms + ResXFileCodeGenerator + Language.de.Designer.cs + + + Eugen.ESystem.Windows.Forms + ResXFileCodeGenerator + Language.en.Designer.cs + + + ResXFileCodeGenerator + Language.Designer.cs + Eugen.ESystem.Windows.Forms + + + ResXFileCodeGenerator + Pictures.Designer.cs + Eugen.ESystem.Windows.Forms + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/InfoBox/InfoBox.resx b/InfoBox/InfoBox.resx new file mode 100644 index 0000000..5e7f0a6 --- /dev/null +++ b/InfoBox/InfoBox.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/InfoBox/Language.Designer.cs b/InfoBox/Language.Designer.cs new file mode 100644 index 0000000..3ede241 --- /dev/null +++ b/InfoBox/Language.Designer.cs @@ -0,0 +1,90 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Eugen.ESystem.Windows.Forms { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Language { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Language() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Info.Language", typeof(Language).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Text-Datei (*.txt)|*.txt|Alle Dateien (*.*)|*.* ähnelt. + /// + internal static string dialog001 { + get { + return ResourceManager.GetString("dialog001", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Datei konnte nicht gespeichert werden. ähnelt. + /// + internal static string message001 { + get { + return ResourceManager.GetString("message001", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Fehler ähnelt. + /// + internal static string messageHead001 { + get { + return ResourceManager.GetString("messageHead001", resourceCulture); + } + } + } +} diff --git a/InfoBox/Language.de.Designer.cs b/InfoBox/Language.de.Designer.cs new file mode 100644 index 0000000..e69de29 diff --git a/InfoBox/Language.de.resx b/InfoBox/Language.de.resx new file mode 100644 index 0000000..e702524 --- /dev/null +++ b/InfoBox/Language.de.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Text-Datei (*.txt)|*.txt|Alle Dateien (*.*)|*.* + + + Datei konnte nicht gespeichert werden. + + + Fehler + + \ No newline at end of file diff --git a/InfoBox/Language.en.Designer.cs b/InfoBox/Language.en.Designer.cs new file mode 100644 index 0000000..e69de29 diff --git a/InfoBox/Language.en.resx b/InfoBox/Language.en.resx new file mode 100644 index 0000000..794d239 --- /dev/null +++ b/InfoBox/Language.en.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Text-File (*.txt)|*.txt|All Files (*.*)|*.* + + + File could not be saved. + + + Error + + \ No newline at end of file diff --git a/InfoBox/Language.resx b/InfoBox/Language.resx new file mode 100644 index 0000000..e702524 --- /dev/null +++ b/InfoBox/Language.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Text-Datei (*.txt)|*.txt|Alle Dateien (*.*)|*.* + + + Datei konnte nicht gespeichert werden. + + + Fehler + + \ No newline at end of file diff --git a/InfoBox/Pictures.Designer.cs b/InfoBox/Pictures.Designer.cs new file mode 100644 index 0000000..f65b526 --- /dev/null +++ b/InfoBox/Pictures.Designer.cs @@ -0,0 +1,153 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Eugen.ESystem.Windows.Forms { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Pictures { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Pictures() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InfoBox.Pictures", typeof(Pictures).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Construction { + get { + object obj = ResourceManager.GetObject("Construction", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Email { + get { + object obj = ResourceManager.GetObject("Email", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Error { + get { + object obj = ResourceManager.GetObject("Error", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Information { + get { + object obj = ResourceManager.GetObject("Information", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Instruction { + get { + object obj = ResourceManager.GetObject("Instruction", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Question { + get { + object obj = ResourceManager.GetObject("Question", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Telephone { + get { + object obj = ResourceManager.GetObject("Telephone", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Tips { + get { + object obj = ResourceManager.GetObject("Tips", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Warning { + get { + object obj = ResourceManager.GetObject("Warning", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + } +} diff --git a/InfoBox/Pictures.resx b/InfoBox/Pictures.resx new file mode 100644 index 0000000..20a1758 --- /dev/null +++ b/InfoBox/Pictures.resx @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + Resources\Construction.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Email.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Error.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Information.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Instruction.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Question.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Telephone.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Tips.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Resources\Warning.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + \ No newline at end of file diff --git a/Info/Properties/AssemblyInfo.cs b/InfoBox/Properties/AssemblyInfo.cs similarity index 87% rename from Info/Properties/AssemblyInfo.cs rename to InfoBox/Properties/AssemblyInfo.cs index cf700fa..1786ab2 100644 --- a/Info/Properties/AssemblyInfo.cs +++ b/InfoBox/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die einer Assembly zugeordnet sind. -[assembly: AssemblyTitle("Info")] +[assembly: AssemblyTitle("Test_InfoBox")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Info")] -[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyProduct("Test_InfoBox")] +[assembly: AssemblyCopyright("Copyright © 2019 by Eugen Höglinger")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/InfoBox/Resources/Construction.png b/InfoBox/Resources/Construction.png new file mode 100644 index 0000000..1d4b1d0 Binary files /dev/null and b/InfoBox/Resources/Construction.png differ diff --git a/InfoBox/Resources/Email.png b/InfoBox/Resources/Email.png new file mode 100644 index 0000000..ec32fd8 Binary files /dev/null and b/InfoBox/Resources/Email.png differ diff --git a/InfoBox/Resources/Error.png b/InfoBox/Resources/Error.png new file mode 100644 index 0000000..4248432 Binary files /dev/null and b/InfoBox/Resources/Error.png differ diff --git a/InfoBox/Resources/Information.png b/InfoBox/Resources/Information.png new file mode 100644 index 0000000..6c532b2 Binary files /dev/null and b/InfoBox/Resources/Information.png differ diff --git a/InfoBox/Resources/Instruction.png b/InfoBox/Resources/Instruction.png new file mode 100644 index 0000000..79f1c8d Binary files /dev/null and b/InfoBox/Resources/Instruction.png differ diff --git a/InfoBox/Resources/Question.png b/InfoBox/Resources/Question.png new file mode 100644 index 0000000..22ccc4f Binary files /dev/null and b/InfoBox/Resources/Question.png differ diff --git a/InfoBox/Resources/Telephone.png b/InfoBox/Resources/Telephone.png new file mode 100644 index 0000000..7aadfda Binary files /dev/null and b/InfoBox/Resources/Telephone.png differ diff --git a/InfoBox/Resources/Tips.png b/InfoBox/Resources/Tips.png new file mode 100644 index 0000000..73a3cc0 Binary files /dev/null and b/InfoBox/Resources/Tips.png differ diff --git a/InfoBox/Resources/Warning.png b/InfoBox/Resources/Warning.png new file mode 100644 index 0000000..82772fe Binary files /dev/null and b/InfoBox/Resources/Warning.png differ diff --git a/Test_Info/App.config b/Test_Info/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/Test_Info/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Test_Info/Form1.Designer.cs b/Test_Info/Form1.Designer.cs new file mode 100644 index 0000000..baab45f --- /dev/null +++ b/Test_Info/Form1.Designer.cs @@ -0,0 +1,118 @@ +namespace Test_Info +{ + partial class Form1 + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.buttonShowInfo = new System.Windows.Forms.Button(); + this.groupBoxProgramInfo = new System.Windows.Forms.GroupBox(); + this.labelProgramInfo = new System.Windows.Forms.Label(); + this.groupBoxDLLInfo = new System.Windows.Forms.GroupBox(); + this.labelDLLInfo = new System.Windows.Forms.Label(); + this.groupBoxProgramInfo.SuspendLayout(); + this.groupBoxDLLInfo.SuspendLayout(); + this.SuspendLayout(); + // + // buttonShowInfo + // + this.buttonShowInfo.Location = new System.Drawing.Point(12, 287); + this.buttonShowInfo.Name = "buttonShowInfo"; + this.buttonShowInfo.Size = new System.Drawing.Size(776, 23); + this.buttonShowInfo.TabIndex = 0; + this.buttonShowInfo.Text = "Show Information Box"; + this.buttonShowInfo.UseVisualStyleBackColor = true; + this.buttonShowInfo.Click += new System.EventHandler(this.buttonShowInfo_Click); + // + // groupBoxProgramInfo + // + this.groupBoxProgramInfo.Controls.Add(this.labelProgramInfo); + this.groupBoxProgramInfo.Location = new System.Drawing.Point(12, 372); + this.groupBoxProgramInfo.Name = "groupBoxProgramInfo"; + this.groupBoxProgramInfo.Size = new System.Drawing.Size(385, 66); + this.groupBoxProgramInfo.TabIndex = 11; + this.groupBoxProgramInfo.TabStop = false; + this.groupBoxProgramInfo.Text = "Programm Information"; + // + // labelProgramInfo + // + this.labelProgramInfo.AutoSize = true; + this.labelProgramInfo.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelProgramInfo.Location = new System.Drawing.Point(7, 20); + this.labelProgramInfo.Name = "labelProgramInfo"; + this.labelProgramInfo.Size = new System.Drawing.Size(16, 13); + this.labelProgramInfo.TabIndex = 0; + this.labelProgramInfo.Text = "..."; + // + // groupBoxDLLInfo + // + this.groupBoxDLLInfo.Controls.Add(this.labelDLLInfo); + this.groupBoxDLLInfo.Location = new System.Drawing.Point(403, 372); + this.groupBoxDLLInfo.Name = "groupBoxDLLInfo"; + this.groupBoxDLLInfo.Size = new System.Drawing.Size(385, 66); + this.groupBoxDLLInfo.TabIndex = 12; + this.groupBoxDLLInfo.TabStop = false; + this.groupBoxDLLInfo.Text = "DLL Information"; + // + // labelDLLInfo + // + this.labelDLLInfo.AutoSize = true; + this.labelDLLInfo.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelDLLInfo.Location = new System.Drawing.Point(7, 20); + this.labelDLLInfo.Name = "labelDLLInfo"; + this.labelDLLInfo.Size = new System.Drawing.Size(16, 13); + this.labelDLLInfo.TabIndex = 0; + this.labelDLLInfo.Text = "..."; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.groupBoxProgramInfo); + this.Controls.Add(this.groupBoxDLLInfo); + this.Controls.Add(this.buttonShowInfo); + this.Name = "Form1"; + this.Text = "Test_InfoBox"; + this.Load += new System.EventHandler(this.Form1_Load); + this.groupBoxProgramInfo.ResumeLayout(false); + this.groupBoxProgramInfo.PerformLayout(); + this.groupBoxDLLInfo.ResumeLayout(false); + this.groupBoxDLLInfo.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button buttonShowInfo; + private System.Windows.Forms.GroupBox groupBoxProgramInfo; + private System.Windows.Forms.Label labelProgramInfo; + private System.Windows.Forms.GroupBox groupBoxDLLInfo; + private System.Windows.Forms.Label labelDLLInfo; + } +} + diff --git a/Test_Info/Form1.cs b/Test_Info/Form1.cs new file mode 100644 index 0000000..7e7fd97 --- /dev/null +++ b/Test_Info/Form1.cs @@ -0,0 +1,141 @@ +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; +using Eugen.ESystem.Windows.Forms; + +namespace Test_Info +{ + public partial class Form1 : Form + { + #region Version und Copyright + // Version und Copyright + string programName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); //Den Programmnamen auslesen + string programVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); + static object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); + string copyright = GenerateCopyright(); + 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; + } + + private static string CurrentYear() + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + + private static string StartYear() + { + //string startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + //return startYear.Remove(0, startYear.LastIndexOf(" ") + 1); + string startYear = ""; + if (((AssemblyCopyrightAttribute)attributes[0]).Copyright.Contains("Copyright © ")) + { + startYear = ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace("Copyright © ", ""); + while (startYear.StartsWith(" ")) + { + startYear = startYear.Remove(0, 1); + } + startYear = startYear.Remove(startYear.IndexOf(" ")); + return startYear; + } + else + { + DateTime dtn = DateTime.Now; + return dtn.Year.ToString(); + } + } + + private static string GenerateCopyright() + { + string startYear = StartYear(); + string currentYear = CurrentYear(); + + if (startYear == currentYear) + { + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; + } + else + { + //return String.Concat(((AssemblyCopyrightAttribute)attributes[0]).Copyright, "-", currentYear); + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright.Replace(startYear, String.Concat(startYear, "-", currentYear)); + } + } + #endregion + + #region Programm-Info + /// + /// Contains the name of the program file + /// + public static string ProgramName { set; get; } + + /// + /// Contains the version of the program file + /// + public static string ProgramVersion { set; get; } + + /// + /// Contains the copyright notice + /// + public static string Copyright { set; get; } + + private void SetProgramInfo() + { + //Name, Version und Copyright setzen + ProgramName = programName; + ProgramVersion = programVersion; + Copyright = copyright; + } + #endregion + + public Form1() + { + SetProgramInfo(); + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + labelProgramInfo.Text = String.Concat(ProgramName, "\r\n", ProgramVersion, "\r\n", Copyright); // Zeigt die Programm-Information an + + labelDLLInfo.Text = String.Concat(InfoBox.DllName, "\r\n", InfoBox.DllVersion, "\r\n", InfoBox.Copyright); // Zeigt die DLL-Information an + } + + private void buttonShowInfo_Click(object sender, EventArgs e) + { + string text = "In diesem Bereich wird die komplette Information ausgegeben. Beim Exportieren wird der Inhalt dieses Bereiches auf eine Zeilenlänge von 80 Zeichen formatiert und dann in eine Textdatei exportiert. So kann die Textdatei problemlos auf ein A4 im Hochformat ausgedruckt werden. Zeilenumbrüche und Wagenrückläufe im Text werden erkannt und bei der Formatierung berücksichtigt.\r\nWird der Text oder ein Teil davom markiert und dann exportiert, dann wir der markierte Teil unformatiert exportiert."; + + // + // Diese Zeilen gehört in das Programm kopiert + // + // Aufruf des Informationsfensters + var info = new InfoBox("Meine Info", InfoBox.Icons.Information, "Gesamte Information", "Text selektieren, ist umformatiert exportieren", "Text nicht selektieren, ist formatiert exportiern", "Entscheiden Sie.", text, true); + info.ShowDialog(); + // + // + + var info1 = new InfoBox("Meine Warnung", InfoBox.Icons.Warning, "Alle Probleme", "Gefahr im Anzug!", "Nicht ignorieren!", "Sofort reagiern!", text, true); + info1.ShowDialog(); + + var info2 = new InfoBox("Meine Frage", InfoBox.Icons.Question, "Ist das Korrekt?", "Kann das sein?", "Oder doch nicht?", "Was ist Ihre Meinung?", "Die Export Funktion kann unterdrückt werden, dann sieht das Fenster so aus.", false); + info2.SetSize(400, 300); //Eine neue Fenstergröße definieren + info2.ShowDialog(); + } + } +} diff --git a/Test_Info/Form1.resx b/Test_Info/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Test_Info/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Test_Info/Program.cs b/Test_Info/Program.cs new file mode 100644 index 0000000..59668e2 --- /dev/null +++ b/Test_Info/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Test_Info +{ + static class Program + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Test_Info/Properties/AssemblyInfo.cs b/Test_Info/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..04778fe --- /dev/null +++ b/Test_Info/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("Test_InfoBox")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Test_InfoBox")] +[assembly: AssemblyCopyright("Copyright © 2019 by Eugen Höglinger")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("3683b887-8256-414a-b502-0f6b7088654d")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.*")] +//[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Test_Info/Properties/Resources.Designer.cs b/Test_Info/Properties/Resources.Designer.cs new file mode 100644 index 0000000..7805d98 --- /dev/null +++ b/Test_Info/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion: 4.0.30319.42000 +// +// Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn +// der Code neu generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Test_Info.Properties +{ + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder-Klasse + // über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der Option /str erneut aus, oder erstellen Sie Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test_Info.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenlookups, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Test_Info/Properties/Resources.resx b/Test_Info/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Test_Info/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Test_Info/Properties/Settings.Designer.cs b/Test_Info/Properties/Settings.Designer.cs new file mode 100644 index 0000000..30ed4a9 --- /dev/null +++ b/Test_Info/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Test_Info.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Test_Info/Properties/Settings.settings b/Test_Info/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Test_Info/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Test_Info/Test_InfoBox.csproj b/Test_Info/Test_InfoBox.csproj new file mode 100644 index 0000000..e419f75 --- /dev/null +++ b/Test_Info/Test_InfoBox.csproj @@ -0,0 +1,89 @@ + + + + + Debug + AnyCPU + {3683B887-8256-414A-B502-0F6B7088654D} + WinExe + Test_Info + Test_Info + v4.6.1 + 512 + true + false + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + {e23aff77-ebf4-4966-b3e4-a49fc6ce92c7} + InfoBox + + + + \ No newline at end of file