Example #1
0
        static void Main()
        {
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            Application.ThreadException += OnThreadException;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var args = Environment.GetCommandLineArgs();

            if (args.Length == 2)
            {
                // the argument is most likely a GUID of a task scheduled for backup
                GUI.ScheduledBackupExecutor form;

                try { form = new GUI.ScheduledBackupExecutor(args[1]); }
                catch (InvalidOperationException e)
                {
                    MessageBox.Show("A scheduled backup task could not be initiated:\n\n" + e.Message,
                                    "RoboMirror", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }

                Application.Run(form);
            }
            else
            {
                GUI.MainForm form;

                try { form = new GUI.MainForm(); }
                catch (FileLockedException)
                {
                    MessageBox.Show("Another RoboMirror instance is currently running.", "RoboMirror cannot be started",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }

                Application.Run(form);
            }
        }
 public Status(ScheduledBackupExecutor executor)
 {
     _executor = executor;
 }