private void ListButtonClick(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;

            if (button == null)
            {
                return;
            }

            var context = button.DataContext as Enlistment;

            if (context == null)
            {
                return;
            }

            if (context.State == State.Done)
            {
                context.State = State.WIP;
            }
            else if (context.State == State.WIP)
            {
                context.State = State.InPR;
            }
            else if (context.State == State.InPR)
            {
                context.State = State.Auto;
            }
            else if (context.State == State.Auto)
            {
                context.State = State.Done;
            }

            RepoStateManager.SetRepoState(context.Name, context.State);
        }
        public EnlistmentsPage(EnlistmentsPageData data)
        {
            AppStateManager.AppState = AppState.Directed;
            var enlistments = new List <Enlistment>();
            var directories = Directory.GetDirectories(data.Directory);

            foreach (var directory in directories)
            {
                var directoryStripped = DirectoryStripped(directory);
                if (!data.DirectoryIncludeList.Contains(directoryStripped))
                {
                    continue;
                }

                using (var repo = new Repository(directory))
                {
                    var checkedOutBranch = repo.Head;
                    var branchStripped   = BranchStripped(checkedOutBranch.FriendlyName);
                    var state            = RepoStateManager.GetRepoState(directoryStripped) ?? State.Done;
                    enlistments.Add(new Enlistment(directory, directoryStripped, branchStripped, state));
                }
            }
            InitializeComponent();
            DataContext = enlistments;
        }