Ejemplo n.º 1
0
        public AboutUI(StartupOptions startup_options)
        {
            InitializeComponent();

            m_licence      = new Licence(startup_options.LicenceFilepath);
            m_installed_on = InstalledOn(startup_options);
            m_timer        = new Timer {
                Interval = 1000
            };

            // Version info
            m_edit_version.Text = string.Format(
                "{0} {1}" +
                "Version: {2}" +
                "Built: {3}" +
                "All Rights Reserved"
                , Util.GetAssemblyAttribute <AssemblyCompanyAttribute>().Company
                , Util.GetAssemblyAttribute <AssemblyCopyrightAttribute>().Copyright + Environment.NewLine
                , Util.AssemblyVersion() + Environment.NewLine
                , Util.AssemblyTimestamp() + Environment.NewLine
                );
            m_edit_version.Select(0, 0);

            // Version history
            m_btn_version_history.Click += (s, a) =>
            {
                HelpUI.ShowDialog(this, HelpUI.EContent.Html, "Version History", Resources.version_history);
            };

            // Update the text fields
            m_timer.Tick   += (s, a) => UpdateUI();
            m_timer.Enabled = true;

            UpdateUI();
        }
Ejemplo n.º 2
0
		static void Main(string[] args)
		{
			// Set up the unhandled exception handler
			var unhandled = (Exception)null;
			#if !DEBUG || TRAP_UNHANDLED_EXCEPTIONS
			try {
			#endif

				Environment.ExitCode = 0;
				Application.EnableVisualStyles();
				Application.SetCompatibleTextRenderingDefault(false);
				Xml_.Config
					.SupportWinFormsTypes()
					.SupportSystemDrawingPrimitiveTypes();

				// Start the main app
				Exception err = null;
				try { StartupOptions = new StartupOptions(args); }
				catch (Exception ex) { err = ex; }

				// If there was an error display the error message
				if (err != null)
				{
					MsgBox.Show(null,
						"There is an error in the startup options provided.\r\n"+
						$"Error Details:\r\n{err.Message}"
						, "Command Line Error"
						, MessageBoxButtons.OK
						, MessageBoxIcon.Error);
					HelpUI.ShowDialog(null, HelpUI.EContent.Html, Application.ProductName, Resources.command_line_ref);
					Environment.ExitCode = 1;
					return;
				}

				// If they just want help displayed...
				if (StartupOptions.ShowHelp)
				{
					HelpUI.ShowDialog(null, HelpUI.EContent.Html, Application.ProductName, Resources.command_line_ref);
					Environment.ExitCode = 0;
					return;
				}

				// If an export path is given, run as a command line tool doing an export
				if (StartupOptions.ExportPath != null)
				{
					RyLogViewer.Main.ExportToFile(StartupOptions);
					return;
				}

				// Otherwise show the app
				Application.Run(new Main(StartupOptions));

				// To catch any Disposes in the 'GC Finializer' thread
				GC.Collect();

			#if !DEBUG || TRAP_UNHANDLED_EXCEPTIONS
			} catch (Exception e) { unhandled = e; }
			#endif

			// Report unhandled exceptions
			if (unhandled != null)
				HandleTheUnhandled(unhandled);
		}