|
| 1 | +using ExcelAddIn_TableOfContents.Properties; |
| 2 | +using System; |
| 3 | +using System.Reflection; |
| 4 | +using System.Windows.Forms; |
| 5 | + |
| 6 | +namespace ExcelAddIn_TableOfContents |
| 7 | +{ |
| 8 | + public partial class AboutForm : Form |
| 9 | + { |
| 10 | + public AboutForm() |
| 11 | + { |
| 12 | + InitializeComponent(); |
| 13 | + } |
| 14 | + |
| 15 | + private void AboutForm_Load(object sender, EventArgs e) |
| 16 | + { |
| 17 | + lblProdukt.Text = AssemblyProduct; |
| 18 | + label3.Text = AssemblyCopyright; |
| 19 | + label5.Text = String.Format("Version {0}", AssemblyVersion); |
| 20 | + |
| 21 | + checkBox1.Checked = Settings.Default.IsAutoUpdate; |
| 22 | + txtVersion.Text = Settings.Default.VersionUrl; |
| 23 | + txtDownload.Text = Settings.Default.UpdateUrl; |
| 24 | + } |
| 25 | + |
| 26 | + private void btnSave_Click(object sender, EventArgs e) |
| 27 | + { |
| 28 | + Settings.Default.IsAutoUpdate = checkBox1.Checked; |
| 29 | + //Settings.Default.VersionUrl = txtVersion.Text; |
| 30 | + //Settings.Default.UpdateUrl = txtDownload.Text; |
| 31 | + |
| 32 | + Settings.Default.Save(); |
| 33 | + } |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + #region Assemblyattributaccessoren |
| 38 | + |
| 39 | + public string AssemblyTitle |
| 40 | + { |
| 41 | + get |
| 42 | + { |
| 43 | + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false); |
| 44 | + if (attributes.Length > 0) |
| 45 | + { |
| 46 | + AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0]; |
| 47 | + if (titleAttribute.Title != "") |
| 48 | + { |
| 49 | + return titleAttribute.Title; |
| 50 | + } |
| 51 | + } |
| 52 | + return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase); |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + public string AssemblyVersion |
| 57 | + { |
| 58 | + get |
| 59 | + { |
| 60 | + return Assembly.GetExecutingAssembly().GetName().Version.ToString(); |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + public string AssemblyDescription |
| 65 | + { |
| 66 | + get |
| 67 | + { |
| 68 | + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false); |
| 69 | + if (attributes.Length == 0) |
| 70 | + { |
| 71 | + return ""; |
| 72 | + } |
| 73 | + return ((AssemblyDescriptionAttribute)attributes[0]).Description; |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + public string AssemblyProduct |
| 78 | + { |
| 79 | + get |
| 80 | + { |
| 81 | + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false); |
| 82 | + if (attributes.Length == 0) |
| 83 | + { |
| 84 | + return ""; |
| 85 | + } |
| 86 | + return ((AssemblyProductAttribute)attributes[0]).Product; |
| 87 | + } |
| 88 | + } |
| 89 | + |
| 90 | + public string AssemblyCopyright |
| 91 | + { |
| 92 | + get |
| 93 | + { |
| 94 | + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false); |
| 95 | + if (attributes.Length == 0) |
| 96 | + { |
| 97 | + return ""; |
| 98 | + } |
| 99 | + return ((AssemblyCopyrightAttribute)attributes[0]).Copyright; |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + public string AssemblyCompany |
| 104 | + { |
| 105 | + get |
| 106 | + { |
| 107 | + object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false); |
| 108 | + if (attributes.Length == 0) |
| 109 | + { |
| 110 | + return ""; |
| 111 | + } |
| 112 | + return ((AssemblyCompanyAttribute)attributes[0]).Company; |
| 113 | + } |
| 114 | + } |
| 115 | + #endregion |
| 116 | + |
| 117 | + } |
| 118 | +} |
0 commit comments