public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values[0] is HistoryTabViewModel == false)
            {
                return(null);
            }
            HistoryTabViewModel historyTabViewModel = (HistoryTabViewModel)values[0];

            HistoryTabViewModel.HistoryStatus historyStatus = (HistoryTabViewModel.HistoryStatus)values[1];

            if (historyStatus == null)
            {
                return(null);
            }
            string commitId = historyStatus.CommitId;

            if (string.IsNullOrEmpty(commitId))
            {
                return(null);
            }
            IGitRepository gitRepository = historyTabViewModel.TryGetGitRepository();

            if (gitRepository == null)
            {
                return(null);
            }
            List <HistoryFile> output = new List <HistoryFile>();

            foreach (var file_info in gitRepository.GetGitWrapper().GetFilelistOfCommit(commitId))
            {
                HistoryFile file = new HistoryFile();
                file.CommitId  = commitId;
                file.Status    = file_info.Status;
                file.FileName  = file_info.FileName;
                file.FileName2 = file_info.FileName2;
                file.Display   = file.FileName;
                if (string.IsNullOrEmpty(file.FileName2) == false)
                {
                    file.Display += " -> " + file.FileName2;
                }
                output.Add(file);
            }
            return(output);
        }
예제 #2
0
        private void HistoryList_ScrollChanged(object sender, RoutedEventArgs e)
        {
            List <ScrollBar> scrollBarList = GetVisualChildCollection <ScrollBar>(sender);

            foreach (ScrollBar scrollBar in scrollBarList)
            {
                if (scrollBar.Orientation == Orientation.Vertical)
                {
                    if (scrollBar.Maximum > 0 && scrollBar.Value == scrollBar.Maximum)
                    {
                        HistoryTabViewModel viewModel = (HistoryTabViewModel)DataContext;
                        if (viewModel.MoreHistoryCommand.CanExecute(sender))
                        {
                            viewModel.MoreHistoryCommand.Execute(sender);
                        }
                        return;
                    }
                }
            }
        }