コード例 #1
0
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            #if DEBUG
            dw = new DebugWindow();
            dw.Show();
            #endif
            GACApplication application;
            if (args.Length == 0)
            {
                application = new GACApplication(true);
            }
            else
            {
                int interval;
                string error = null;
                if (args.Length < 2 || !int.TryParse(args[0], out interval) || !AllDirectoriesExist(args.Skip(1), out error))
                {
                    if (string.IsNullOrEmpty(error))
                        error = "Invalid command line arguments";

                    error = error + "\r\n\r\n" +
                            "usage: git-auto-commit <commit-interval-seconds> <directory 1>, <directory 2>, ..., <directory n>";

                    MessageBox.Show(error, "git-auto-commit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Environment.Exit(1);
                    return;
                }

                var tasks = args.Skip(1).Select(x => new AutoCommitTask(interval, x));
                application = new GACApplication(true, tasks);
            }

            var icon = new NotifyIconController(application);
            icon.Show();

            Application.Run();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: Pavuucek/GitAutoCommit
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            #if DEBUG
            _dw = new DebugWindow();
            _dw.Show();
            #endif
            GacApplication application;
            if (args.Length == 0)
            {
                application = new GacApplication(true);
            }
            else
            {
                int interval;
                string error = null;
                if (args.Length < 2 || !int.TryParse(args[0], out interval) ||
                    !AllDirectoriesExist(args.Skip(1), out error))
                {
                    if (string.IsNullOrEmpty(error))
                        error = Resources.Program_Main_Invalid_command_line_arguments;

                    error = error + "\r\n\r\n" +
                            Resources.Program_Main_usage;

                    MessageBox.Show(error, Resources.AppName, MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    Environment.Exit(1);
                    return;
                }

                var tasks = args.Skip(1).Select(x => new AutoCommitTask(interval, x));
                application = new GacApplication(true, tasks);
            }

            var icon = new NotifyIconController(application);
            icon.Show();

            Application.Run();
        }