Skip to content

Commit

Permalink
Fix about info
Browse files Browse the repository at this point in the history
  • Loading branch information
junian committed May 24, 2018
1 parent afd3ea6 commit bfe04d7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 88 deletions.
9 changes: 5 additions & 4 deletions src/Termission.EtoForms/Forms/AboutForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Reflection;
using Eto.Drawing;
using Eto.Forms;
using Juniansoft.Termission.Core;
using Juniansoft.Termission.EtoForms.Resources;

namespace Juniansoft.Termission.EtoForms.Forms
Expand All @@ -10,7 +11,7 @@ public class AboutForm : Dialog
{
public AboutForm()
{
var title = MainApplication.AssemblyProduct;
var title = App.AssemblyProduct;

/* dialog attributes */

Expand All @@ -33,15 +34,15 @@ public AboutForm()
TextAlignment = TextAlignment.Center
};

var version = MainApplication.AssemblyVersion;
var version = App.AssemblyVersion;
var labelVersion = new Label
{
Text = string.Format("Version {0}", version),
TextAlignment = TextAlignment.Center
};

var copyright = MainApplication.AssemblyCopyright;
var company = MainApplication.AssemblyCompany;
var copyright = App.AssemblyCopyright;
var company = App.AssemblyCompany;
var labelCopyright = new Label
{
Text = $"{copyright} by {company}",
Expand Down
3 changes: 2 additions & 1 deletion src/Termission.EtoForms/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Juniansoft.Termission.Core.ViewModels;
using Juniansoft.Termission.EtoForms.Views;
using Juniansoft.MvvmReady;
using Juniansoft.Termission.Core;

namespace Juniansoft.Termission.EtoForms.Forms
{
Expand All @@ -30,7 +31,7 @@ public MainForm()
_mainView = ServiceLocator.Current.Get<MainView>();
_mainVm = ServiceLocator.Current.Get<MainViewModel>();

Title = MainApplication.AssemblyProduct;
Title = App.AssemblyProduct;
ClientSize = new Eto.Drawing.Size(720, 480);
Style = EtoStyles.FormMain;
Icon = DesktopAppResources.DevAppIcon;
Expand Down
81 changes: 0 additions & 81 deletions src/Termission.EtoForms/MainApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,86 +105,5 @@ public void RegisterServices()
ServiceLocator.Current.Register<DeviceBotView>();
ServiceLocator.Current.Register<PreferencesView>();
}

#region Assembly Attribute Accessors

public static string AssemblyTitle
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return System.IO.Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
}
}

public static string AssemblyVersion
{
get
{
return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
}

public static string AssemblyDescription
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyDescriptionAttribute)attributes[0]).Description;
}
}

public static string AssemblyProduct
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyProductAttribute)attributes[0]).Product;
}
}

public static string AssemblyCopyright
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCopyrightAttribute)attributes[0]).Copyright;
}
}

public static string AssemblyCompany
{
get
{
object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
if (attributes.Length == 0)
{
return "";
}
return ((AssemblyCompanyAttribute)attributes[0]).Company;
}
}

#endregion
}
}
5 changes: 3 additions & 2 deletions src/Termission.EtoForms/MenuCommands/AboutCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
using System.Text;
using System.Threading.Tasks;
using Eto.Forms;

using Juniansoft.Termission.Core;

namespace Juniansoft.Termission.EtoForms.MenuCommands
{
public class AboutCommand: Command
{
public AboutCommand()
{
this.MenuText = $"About {MainApplication.AssemblyProduct}";
this.MenuText = $"About {App.AssemblyProduct}";
this.ToolBarText = "About";
this.ToolTip = "About";
}
Expand Down

0 comments on commit bfe04d7

Please sign in to comment.