Exemple #1
0
 /// <summary>
 /// The about form_ help button clicked.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void AboutForm_HelpButtonClicked(object sender, CancelEventArgs e)
 {
     using (var intro = new IntroForm()) intro.ShowDialog();
 }
Exemple #2
0
        /// <summary>
        /// The run.
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        internal void Run(string[] args)
        {
            ExecutionParam executionParam;
            if (!ExecutionParam.Parse(args, AppUtil.GetLocalDataPath(this.GUI_INI_FILENAME), this.Logger, out executionParam))
            {
                ExecutionParam.ShowHelp();
                return;
            }

            this.Logger.InfoFormat("Application {0} {1} was started!", AppUtil.ProductName, AppUtil.ProductVersion);
            this.MuteApplicationVolume();

            if (args.Length < 1 && !SingleInstance.Start())
            {
                // Show up other instance if no parameter was specified
                if (MessageBox.Show(
                    "Another instance was already running. Do you want to start a new instance ?",
                    AppUtil.ProductName,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question) == DialogResult.No)
                {
                    SingleInstance.ShowFirstInstance();
                    return;
                }
            }

            string historyFile = AppUtil.GetLocalDataPath(this.HISTORY_FILENAME);
            bool firstStart = !File.Exists(historyFile);
            if (firstStart)
            {
                Directory.CreateDirectory(AppUtil.LocalProductDataPath);
                File.Create(historyFile);
                using (var introForm = new IntroForm()) introForm.ShowDialog();
            }

            var globalContext = WinFormGlobalContext.GetInstance(this.Logger);
            globalContext.SetFirstStart(firstStart);
            AppContext.Initialize(globalContext);

            MonitorEnvironment env = this.GetEnvironment(executionParam, globalContext);
            if (env == null)
            {
                Environment.Exit(1);
            }

            env.Logger = this.Logger;
            globalContext.SetEnvironment(env);
            var mainForm = new FlightStatisticForm(null, executionParam, true);
            CheckFareForm checkFareForm = null;

            if (executionParam != null && executionParam.OperationMode != OperationMode.Unspecified)
            {
                mainForm.Hide();
                mainForm.WindowState = FormWindowState.Minimized;
                var controller = new CheckFareController(executionParam);
                checkFareForm = new CheckFareForm(executionParam);
                checkFareForm.Attach(controller);

                if (executionParam.IsMinimized)
                {
                    checkFareForm.WindowState = FormWindowState.Minimized;
                    checkFareForm.ShowInTaskbar = false;
                }

                checkFareForm.Show();
            }

            Application.Run(mainForm);
            SingleInstance.Stop();
            this.Logger.Info("Application stopped");
        }
 /// <summary>
 /// The mnu quick start_ click.
 /// </summary>
 /// <param name="sender">
 /// The sender.
 /// </param>
 /// <param name="e">
 /// The e.
 /// </param>
 private void mnuQuickStart_Click(object sender, EventArgs e)
 {
     using (var intro = new IntroForm()) intro.ShowDialog(this);
 }