Exemplo n.º 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,
                                    "DeeMirror", MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }

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

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

                    return;
                }

                Application.Run(form);
            }
        }
Exemplo n.º 2
0
 public Status(ScheduledBackupExecutor executor)
 {
     _executor = executor;
 }