/// <inheritdoc/> protected override void OnResponse(Gtk.ResponseType response_id) { base.OnResponse(response_id); VisualHelpers.Close(this); Dispose(); }
private static void OnAbout(object parameter) { // TODO: put strings in resources. var aboutDialog = new Gtk.AboutDialog(); aboutDialog.Version = SingleInstanceApplication.Version; var entryAssembly = Assembly.GetEntryAssembly(); var attribute = entryAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false).FirstOrDefault(); if (attribute != null) { aboutDialog.ProgramName = ((AssemblyTitleAttribute)attribute).Title; } attribute = entryAssembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false).FirstOrDefault(); if (attribute != null) { aboutDialog.Copyright = ((AssemblyCopyrightAttribute)attribute).Copyright; } var metadataAttributes = entryAssembly.GetCustomAttributes(typeof(AssemblyMetadataAttribute), false).Cast <AssemblyMetadataAttribute>(); // Too wordy. ////attribute = entryAssembly.GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false)[0]; ////var description = ((AssemblyDescriptionAttribute)attribute).Description; var metadataAttribute = metadataAttributes.FirstOrDefault(a => a.Key == INTV.Core.Utility.ResourceHelpers.AboutKey); var description = metadataAttribute == null ? string.Empty : metadataAttribute.Value; attribute = entryAssembly.GetCustomAttributes(typeof(AssemblyTrademarkAttribute), false).FirstOrDefault(); var trademark = attribute == null ? string.Empty : ((AssemblyTrademarkAttribute)attribute).Trademark; var comments = description; if (string.IsNullOrEmpty(comments)) { comments = trademark; } else if (!string.IsNullOrEmpty(trademark)) { comments += "\n\n" + trademark; } if (!string.IsNullOrEmpty(comments)) { aboutDialog.Comments = comments; } metadataAttribute = metadataAttributes.FirstOrDefault(a => a.Key == INTV.Core.Utility.ResourceHelpers.WebsiteKey); aboutDialog.Website = metadataAttribute == null ? "http://www.intvfunhouse.com/intvfunhouse/" : metadataAttribute.Value; metadataAttribute = metadataAttributes.FirstOrDefault(a => a.Key == INTV.Core.Utility.ResourceHelpers.WebsiteNameKey); aboutDialog.WebsiteLabel = metadataAttribute == null ? "INTV Funhouse" : metadataAttribute.Value; var authors = new List <string>(); foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { var authorAttributes = assembly.GetCustomAttributes(typeof(AssemblyMetadataAttribute), false).Cast <AssemblyMetadataAttribute>().Where(a => a.Key == INTV.Core.Utility.ResourceHelpers.AuthorKey); authors.AddRange(authorAttributes.Select(a => a.Value)); } var weightedAuthors = authors.GroupBy(a => a); aboutDialog.Authors = weightedAuthors.Select(wa => wa.Key).ToArray(); #if SCALE_DOWN var image = SingleInstanceApplication.SplashScreenResourceType.LoadImageResource(SingleInstanceApplication.SplashScreenResource); aboutDialog.Logo = image.ScaleSimple(Convert.ToInt32(image.Width * 0.75), Convert.ToInt32(image.Height * 0.75), Gdk.InterpType.Bilinear); #else aboutDialog.Logo = SingleInstanceApplication.SplashScreenResourceType.LoadImageResource(SingleInstanceApplication.SplashScreenResource); #endif try { // BUG: Should we rely on the file being there and trust nobody hacks it? Anyone care? var programDir = SingleInstanceApplication.Instance.ProgramDirectory; var licensePath = System.IO.Path.Combine(programDir, "license.txt"); aboutDialog.License = System.IO.File.ReadAllText(licensePath); } catch (Exception) { } var result = aboutDialog.Run(); VisualHelpers.Close(aboutDialog); }