示例#1
0
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            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;
            }

            foreach (var folder in args.Skip(1))
            {
                var handler = new AutoCommitHandler(interval, folder);
                Handlers.Add(handler);
            }

            var icon = new NotifyIconController(Handlers);

            icon.Show();

            Application.Run();
        }
示例#2
0
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            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;
            }

            foreach (var folder in args.Skip(1))
            {
                var handler = new AutoCommitHandler(interval, folder);
                Handlers.Add(handler);
            }

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

            Application.Run();
        }