Example #1
0
        private bool StageSelectedFiles(bool showWarning)
        {
            var unstaged = this.listView1.Items.Cast <GitFile>()
                           .Where(item => item.IsSelected && !item.IsStaged)
                           .ToList();
            var count = unstaged.Count;
            int i     = 0;

            foreach (var item in unstaged)
            {
                CurrentTracker.StageFile(item.FilePath);
                ShowStatusMessage(string.Format("Staged ({0}/{1}): {2}", i++, count, item.FileName));
            }

            CurrentTracker.Refresh();

            bool hasStaged = CurrentTracker == null ? false :
                             CurrentTracker.ChangedFiles.Any(f => f.IsStaged);

            if (!hasStaged && showWarning)
            {
                MessageBox.Show("No file has been staged for commit.", "Commit",
                                MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            return(hasStaged);
        }
 private void menuStage_Click(object sender, RoutedEventArgs e)
 {
     GetSelectedFileFullName(fileName =>
     {
         CurrentTracker.StageFile(fileName);
         ShowStatusMessage("Staged file: " + fileName);
     }, false);
 }
        private void StageSelectedFiles()
        {
            var unstaged = this.listView1.Items.Cast <GitFile>()
                           .Where(item => item.IsSelected && !item.IsStaged)
                           .ToList();
            var count = unstaged.Count;
            int i     = 0;

            foreach (var item in unstaged)
            {
                CurrentTracker.StageFile(item.FilePath);
                ShowStatusMessage(string.Format("Staged ({0}/{1}): {2}", i++, count, item.FileName));
            }

            CurrentTracker.Refresh();
        }