Beispiel #1
0
        public MainUI(string[] cmdArgs)
            : base()
        {
            Closing += OnMainFormClosing;
            Load    += OnMainFormLoad;


            try
            {
                //This call is required by the Windows Form Designer.
                InitializeComponent();

                // Get application name.
                ApplicationName = "";
                if ((cmdArgs.Length != 0))
                {
                    foreach (string Arg in cmdArgs)
                    {
                        if ((string.IsNullOrEmpty(ApplicationName) && (Arg[0] == '/')))
                        {
                            ApplicationName = Arg.Substring(1);
                        }
                        else
                        {
                            Args.Add(Arg);
                        }
                    }
                }
                if (string.IsNullOrEmpty(ApplicationName))
                {
                    ApplicationName = "ApsimUI";
                }
                RunToolStrip.Visible = ApplicationName == "ApsimUI";

                // Create our controller
                Configuration.Instance.ApplicationName = ApplicationName;
                PlugIns.LoadAll();
                SimulationController = new BaseController(this, ApplicationName, true);

                // Display splash screen
                if (!string.IsNullOrEmpty(Configuration.Instance.Setting("SplashScreen")) && (Args.Count == 0))
                {
                    Form SplashForm = (Form)BaseController.CreateClass(Configuration.Instance.Setting("SplashScreen"));
                    if (Configuration.Instance.Setting("SplashScreenButtonVisible").ToLower() == "yes")
                    {
                        SplashForm.ShowDialog();
                    }
                    else
                    {
                        SplashForm.Show();
                        Application.DoEvents();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
 public static void HelpAbout(BaseController Controller)
 {
     if (!string.IsNullOrEmpty(Configuration.Instance.Setting("SplashScreen")))
     {
         Form SplashForm = (Form)BaseController.CreateClass(Configuration.Instance.Setting("SplashScreen"));
         SplashForm.ShowDialog();
     }
 }