├── .gitignore ├── App.xaml ├── App.xaml.cs ├── Converters ├── ExtensionToImageConverter.cs ├── GenericVisibilityConverter.cs ├── GetDataGridContentHeightConverter.cs ├── GetSelectedTreeViewItemConverter.cs ├── IsHeadToFontWeightConverter.cs ├── IsHeadToTextDecorationsConverter.cs ├── NullToVisibilityConverter.cs ├── StatusGridGroupToColorConverter.cs ├── StatusToCharacterConverter.cs └── StatusToColorConverter.cs ├── DesignData ├── Branches.xaml ├── ChangesetHistory.xaml ├── RecentRepositories.xaml └── SampleApplication.xaml ├── Externals └── .gitkeep ├── Git-GUI.csproj ├── Git-GUI.csproj.DotSettings ├── Git-GUI.csproj.user ├── Git-GUI.sln ├── Libraries ├── Animation │ ├── BindableDoubleAnimation.cs │ └── LinearGradientAnimation.cs ├── ChangesetGraph.cs ├── Configuration.cs ├── DateUtil.cs ├── DelegateCommand.cs ├── EnhancedObservableCollection.cs ├── Extensions.cs ├── FileUtil.cs ├── GenericUtil.cs ├── IconUtil.cs ├── Observable.cs ├── RepoUtil.cs └── UIHelper.cs ├── Models ├── Branch.cs ├── Commit.cs ├── DetachedHead.cs ├── RecentCommitMessage.cs ├── Remote.cs ├── Stash.cs ├── StatusItem.cs ├── Submodule.cs └── Tag.cs ├── Properties ├── AssemblyInfo.cs ├── Resources.Designer.cs ├── Resources.resx ├── Settings.Designer.cs ├── Settings.settings └── app.manifest ├── README.md ├── Resources ├── AbstractBackground.jpg └── Icons │ ├── Add.png │ ├── AddNote.png │ ├── Alert.png │ ├── Annotate.png │ ├── Archive.png │ ├── Branch-24.png │ ├── Branch.png │ ├── Cancel.png │ ├── Checkout.png │ ├── Clipboard.png │ ├── Clone.png │ ├── CloseWindow.png │ ├── Copy.png │ ├── CopyPatch.png │ ├── Cross.png │ ├── DatabaseRefresh.png │ ├── Delete.png │ ├── Detect.png │ ├── Edit.png │ ├── Email.png │ ├── Export.png │ ├── Fetch.png │ ├── Forget.png │ ├── Git-GUI.ico │ ├── Git-GUI.png │ ├── GitHub.png │ ├── Hash.png │ ├── History.png │ ├── Home.png │ ├── Ignore.png │ ├── Information.png │ ├── MaximizeWindow.png │ ├── Merge.png │ ├── MessageWrite.png │ ├── Messages.png │ ├── MinimizeWindow.png │ ├── Open.png │ ├── OpenIgnoreEditor.png │ ├── Patch.png │ ├── Plus.gif │ ├── Plus.png │ ├── Pull.png │ ├── Push.png │ ├── Question.png │ ├── Recent.png │ ├── Remote.png │ ├── Rename.png │ ├── RepositoryWrite.png │ ├── Reset.png │ ├── ResetHard.png │ ├── RestoreWindow.png │ ├── Revert.png │ ├── SVN.png │ ├── Save.png │ ├── Search.png │ ├── Settings.png │ ├── Stash-24.png │ ├── Stash.png │ ├── Statistics.png │ ├── Submodule.png │ ├── TabPlus.png │ ├── Tag.png │ ├── Tick.png │ ├── Unstage.png │ ├── VisualDiff.png │ └── Warning.png ├── Styles ├── Border.xaml ├── Button.xaml ├── ChangesetHistoryDataGrid.xaml ├── Colors.xaml ├── ComboBox.xaml ├── DataGrid.xaml ├── DisplayTags.xaml ├── GridSplitter.xaml ├── LeftToolbar.xaml ├── NewTabList.xaml ├── Panel.xaml ├── Scrollbar.xaml ├── Separator.xaml ├── SplitButton.xaml ├── TabItem.xaml ├── TextBlock.xaml ├── TextBox.xaml ├── TopToolbar.xaml ├── TreeView.xaml └── Window.xaml ├── TemplateSelectors ├── RepoTabContentTemplateSelector.cs └── TabTemplateSelector.cs ├── Templates ├── RepoTabContentTemplate.xaml ├── RepoTabDashboardContentTemplate.xaml ├── RepoTabNewTemplate.xaml └── RepoTabTemplate.xaml ├── UserControls ├── CenterArea.xaml ├── CenterArea.xaml.cs ├── ChangesetHistory.xaml ├── ChangesetHistory.xaml.cs ├── ChangesetHistoryContextMenu.xaml ├── ChangesetHistoryContextMenu.xaml.cs ├── CommitPanel.xaml ├── CommitPanel.xaml.cs ├── Dialogs │ ├── ConfirmDialog.xaml │ ├── ConfirmDialog.xaml.cs │ ├── PromptDialog.xaml │ └── PromptDialog.xaml.cs ├── DiffPanel.xaml ├── DiffPanel.xaml.cs ├── LeftToolbar.xaml ├── LeftToolbar.xaml.cs ├── LeftToolbarContextMenus │ ├── TagContextMenu.xaml │ └── TagContextMenu.xaml.cs ├── MainMenu.xaml ├── MainMenu.xaml.cs ├── MenuButton.cs ├── NewTabPage.xaml ├── NewTabPage.xaml.cs ├── Panel.xaml ├── Panel.xaml.cs ├── SplitButton.cs ├── StatusGrid.xaml ├── StatusGrid.xaml.cs ├── StatusGridContextMenu.xaml ├── StatusGridContextMenu.xaml.cs ├── TopToolbar.xaml └── TopToolbar.xaml.cs ├── ViewModels ├── BaseViewModel.cs ├── MainWindowViewModel.cs ├── RepositoryViewModel.cs ├── RepositoryViewModel.cs.BASE.cs ├── RepositoryViewModel.cs.LOCAL.cs └── RepositoryViewModel.cs.REMOTE.cs ├── Views ├── About.xaml ├── About.xaml.cs ├── MainWindow.xaml └── MainWindow.xaml.cs ├── app.config ├── license.txt └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | #Custom 2 | *.dll 3 | *.pdb 4 | *.psess 5 | *.vsp 6 | *.pfx 7 | 8 | #OS junk files 9 | [Tt]humbs.db 10 | *.DS_Store 11 | 12 | #Visual Studio files 13 | *.[Oo]bj 14 | *.user 15 | *.aps 16 | *.pch 17 | *.vspscc 18 | *.vssscc 19 | *_i.c 20 | *_p.c 21 | *.ncb 22 | *.suo 23 | *.tlb 24 | *.tlh 25 | *.bak 26 | *.[Cc]ache 27 | *.ilk 28 | *.log 29 | *.lib 30 | *.sbr 31 | *.sdf 32 | *.opensdf 33 | *.unsuccessfulbuild 34 | ipch/ 35 | obj/ 36 | [Bb]in 37 | [Dd]ebug*/ 38 | [Rr]elease*/ 39 | Ankh.NoLoad 40 | 41 | #Tooling 42 | _ReSharper*/ 43 | *.resharper 44 | [Tt]est[Rr]esult* 45 | 46 | #Project files 47 | [Bb]uild/ 48 | 49 | #Subversion files 50 | .svn 51 | 52 | # Office Temp Files 53 | ~$* 54 | 55 | #NuGet 56 | packages/ 57 | -------------------------------------------------------------------------------- /App.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | 4 | namespace GG 5 | { 6 | /// 7 | /// Interaction logic for App.xaml 8 | /// 9 | public partial class App : Application 10 | { 11 | public App() 12 | { 13 | #if !DEBUG 14 | AppDomain.CurrentDomain.UnhandledException += NBug.Handler.UnhandledException; 15 | Application.Current.DispatcherUnhandledException += NBug.Handler.DispatcherUnhandledException; 16 | #endif 17 | } 18 | 19 | protected override void OnStartup(StartupEventArgs e) 20 | { 21 | var mainWindow = new MainWindow 22 | { 23 | DataContext = new MainWindowViewModel() 24 | }; 25 | 26 | base.MainWindow = mainWindow; 27 | 28 | mainWindow.Show(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Converters/ExtensionToImageConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Globalization; 4 | using System.Windows; 5 | using System.Windows.Data; 6 | using System.Windows.Media.Imaging; 7 | using GG.Libraries; 8 | 9 | namespace GG.Converters 10 | { 11 | /// 12 | /// Converts a file extension to an image source. 13 | /// 14 | class ExtensionToImageConverter : IValueConverter 15 | { 16 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 17 | { 18 | return IconUtil.GetIcon((string) value, true, false); 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 22 | { 23 | return null; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Converters/GenericVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | using System.Globalization; 4 | using System.Windows; 5 | using System.Windows.Data; 6 | 7 | namespace GG.Converters 8 | { 9 | public class GenericVisibilityConverter : IValueConverter 10 | { 11 | #region Implementation of IValueConverter 12 | 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | // Whether to invert the visibility. 16 | var invert = (string) parameter == "not" ? true : false; 17 | 18 | // int 0 19 | if (value is int && (int) value == 0) 20 | return invert ? Visibility.Visible : Visibility.Collapsed; 21 | 22 | // int > 0 23 | if (value is int && (int) value > 0) 24 | return invert ? Visibility.Collapsed : Visibility.Visible; 25 | 26 | // null || bool == false 27 | if (value == null || (value is bool && (bool) value == false)) 28 | return invert ? Visibility.Visible : Visibility.Collapsed; 29 | 30 | // bool == true 31 | if (value is bool && (bool) value == true) 32 | return invert ? Visibility.Collapsed : Visibility.Visible; 33 | 34 | // Fall back to "visible". 35 | return invert ? Visibility.Collapsed : Visibility.Visible; 36 | } 37 | 38 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 39 | { 40 | throw new NotImplementedException(); 41 | } 42 | 43 | #endregion 44 | } 45 | } -------------------------------------------------------------------------------- /Converters/GetDataGridContentHeightConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Controls; 4 | using System.Windows.Data; 5 | using GG.Libraries; 6 | 7 | namespace GG.Converters 8 | { 9 | /// 10 | /// Returns the height of the body (data grid actual height - column header height). 11 | /// 12 | class GetDataGridContentHeightConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | var dataGrid = (DataGrid) value; 17 | var height = dataGrid.ActualHeight - 24; 18 | 19 | return height >= 0 ? height : 0; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 23 | { 24 | return null; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Converters/GetSelectedTreeViewItemConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Globalization; 4 | using System.Windows.Controls; 5 | using System.Windows.Data; 6 | 7 | namespace GG.Converters 8 | { 9 | /// 10 | /// Returns the height of the body (data grid actual height - column header height). 11 | /// 12 | class GetSelectedTreeViewItemConverter : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 15 | { 16 | return ((TreeView) value).SelectedItem; 17 | } 18 | 19 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 20 | { 21 | return null; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Converters/IsHeadToFontWeightConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows; 5 | 6 | namespace GG.Converters 7 | { 8 | /// 9 | /// Converts IsHead status into a font weight. 10 | /// 11 | class IsHeadToFontWeightConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | return (bool) value ? FontWeights.Bold : FontWeights.Normal; 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | return false; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Converters/IsHeadToTextDecorationsConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows; 5 | 6 | namespace GG.Converters 7 | { 8 | /// 9 | /// Converts IsHead status into text decorations. 10 | /// 11 | class IsHeadToTextDecorationsConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | return (bool) value ? TextDecorations.Underline : new TextDecorationCollection(); 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | return false; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Converters/NullToVisibilityConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows; 4 | using System.Windows.Data; 5 | 6 | namespace GG.Converters 7 | { 8 | public class NullToVisibilityConverter : IValueConverter 9 | { 10 | #region Implementation of IValueConverter 11 | 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | return value == null ? Visibility.Visible : Visibility.Collapsed; 15 | } 16 | 17 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 18 | { 19 | throw new NotImplementedException(); 20 | } 21 | 22 | #endregion 23 | } 24 | } -------------------------------------------------------------------------------- /Converters/StatusGridGroupToColorConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows.Media; 5 | 6 | namespace GG.Converters 7 | { 8 | /// 9 | /// Converts LibGit2Sharp.Status into a single character string. 10 | /// 11 | class StatusGridGroupToColorConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | return ((string) value) == "Staged" ? new SolidColorBrush(Color.FromRgb(76, 120, 0)) : new SolidColorBrush(Color.FromRgb(120, 37, 0)); 16 | } 17 | 18 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 19 | { 20 | return Brushes.White; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Converters/StatusToCharacterConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | 5 | namespace GG.Converters 6 | { 7 | /// 8 | /// Converts LibGit2Sharp.Status into a single character string. 9 | /// 10 | class StatusToCharacterConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | LibGit2Sharp.FileStatus status = (LibGit2Sharp.FileStatus) value; 15 | 16 | if (status.HasFlag(LibGit2Sharp.FileStatus.Removed) || status.HasFlag(LibGit2Sharp.FileStatus.Missing)) 17 | return "D"; 18 | 19 | if (status.HasFlag(LibGit2Sharp.FileStatus.Added)) 20 | return "A"; 21 | 22 | if (status.HasFlag(LibGit2Sharp.FileStatus.Staged) || status.HasFlag(LibGit2Sharp.FileStatus.Modified)) 23 | return "M"; 24 | 25 | if (status.HasFlag(LibGit2Sharp.FileStatus.Untracked)) 26 | return "?"; 27 | 28 | throw new Exception("Could not convert status " + status.ToString() + " to a character!"); 29 | } 30 | 31 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 32 | { 33 | return LibGit2Sharp.FileStatus.Removed; 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /Converters/StatusToColorConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.Windows.Data; 4 | using System.Windows.Media; 5 | 6 | namespace GG.Converters 7 | { 8 | /// 9 | /// Converts LibGit2Sharp.Status into a SolidColorBrush to be used in background / text. 10 | /// 11 | class StatusToColorConverter : IValueConverter 12 | { 13 | // Light colors. 14 | static SolidColorBrush COLOR_RED = new SolidColorBrush(Color.FromRgb(220, 104, 107)); 15 | static SolidColorBrush COLOR_GREEN = new SolidColorBrush(Color.FromRgb(122, 183, 64)); 16 | static SolidColorBrush COLOR_BLUE = new SolidColorBrush(Color.FromRgb(81, 140, 220)); 17 | static SolidColorBrush COLOR_GRAY = new SolidColorBrush(Color.FromRgb(142, 142, 142)); 18 | 19 | // Dark colors. 20 | static SolidColorBrush COLOR_DARK_RED = new SolidColorBrush(Color.FromRgb(167, 44, 47)); 21 | static SolidColorBrush COLOR_DARK_GREEN = new SolidColorBrush(Color.FromRgb(62, 123, 04)); 22 | static SolidColorBrush COLOR_DARK_BLUE = new SolidColorBrush(Color.FromRgb(21, 80, 160)); 23 | static SolidColorBrush COLOR_DARK_GRAY = new SolidColorBrush(Color.FromRgb(82, 82, 82)); 24 | 25 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 26 | { 27 | if (value == null) 28 | return COLOR_RED; 29 | 30 | var status = (LibGit2Sharp.FileStatus) value; 31 | 32 | // Whether to use darker colors (for text). 33 | var darkerColors = (string) parameter == "dark"; 34 | 35 | // Removed & Missing = red. 36 | if (status.HasFlag(LibGit2Sharp.FileStatus.Removed) || status.HasFlag(LibGit2Sharp.FileStatus.Missing)) 37 | return darkerColors ? COLOR_DARK_RED : COLOR_RED; 38 | 39 | // Added = green. 40 | if (status.HasFlag(LibGit2Sharp.FileStatus.Added)) 41 | return darkerColors ? COLOR_DARK_GREEN : COLOR_GREEN; 42 | 43 | // Modified = blue. 44 | if (status.HasFlag(LibGit2Sharp.FileStatus.Modified) || status.HasFlag(LibGit2Sharp.FileStatus.Staged)) 45 | return darkerColors ? COLOR_DARK_BLUE : COLOR_BLUE; 46 | 47 | // Untracked = gray. 48 | if (status.HasFlag(LibGit2Sharp.FileStatus.Untracked)) 49 | return darkerColors ? COLOR_DARK_GRAY : COLOR_GRAY; 50 | 51 | throw new Exception("Could not convert status " + status + " to a SolidColorBrush!"); 52 | } 53 | 54 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 55 | { 56 | return LibGit2Sharp.FileStatus.Removed; 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /DesignData/Branches.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /DesignData/ChangesetHistory.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | master 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DesignData/RecentRepositories.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /DesignData/SampleApplication.xaml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | master 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Externals/.gitkeep: -------------------------------------------------------------------------------- 1 | keep -------------------------------------------------------------------------------- /Git-GUI.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | No -------------------------------------------------------------------------------- /Git-GUI.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | C:\Setups\Software\Git-GUI\|publish\ 5 | http://www.gitgui.com/publish/ 6 | http://www.gitgui.com/support 7 | 8 | 9 | 10 | en-US 11 | false 12 | 13 | -------------------------------------------------------------------------------- /Git-GUI.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Git-GUI", "Git-GUI.csproj", "{3E181F9A-55E5-4769-BB53-AE95AC319AAF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x64 = Debug|x64 9 | Debug|x86 = Debug|x86 10 | Release|x64 = Release|x64 11 | Release|x86 = Release|x86 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {3E181F9A-55E5-4769-BB53-AE95AC319AAF}.Debug|x64.ActiveCfg = Debug|x86 15 | {3E181F9A-55E5-4769-BB53-AE95AC319AAF}.Debug|x64.Build.0 = Debug|x86 16 | {3E181F9A-55E5-4769-BB53-AE95AC319AAF}.Debug|x86.ActiveCfg = Debug|x86 17 | {3E181F9A-55E5-4769-BB53-AE95AC319AAF}.Debug|x86.Build.0 = Debug|x86 18 | {3E181F9A-55E5-4769-BB53-AE95AC319AAF}.Release|x64.ActiveCfg = Release|x64 19 | {3E181F9A-55E5-4769-BB53-AE95AC319AAF}.Release|x64.Build.0 = Release|x64 20 | {3E181F9A-55E5-4769-BB53-AE95AC319AAF}.Release|x86.ActiveCfg = Release|x86 21 | {3E181F9A-55E5-4769-BB53-AE95AC319AAF}.Release|x86.Build.0 = Release|x86 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | GlobalSection(Performance) = preSolution 27 | HasPerformanceSessions = true 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /Libraries/Animation/BindableDoubleAnimation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Media.Animation; 4 | 5 | namespace GG.Libraries.Animation 6 | { 7 | public class BindableDoubleAnimation : DoubleAnimationBase 8 | { 9 | DoubleAnimation internalAnimation; 10 | 11 | public DoubleAnimation InternalAnimation { get { return internalAnimation; } } 12 | 13 | public double To 14 | { 15 | get { return (double) GetValue(ToProperty); } 16 | set { SetValue(ToProperty, value); } 17 | } 18 | 19 | /// 20 | /// Dependency backing property for the property. 21 | /// 22 | public static readonly DependencyProperty ToProperty = 23 | DependencyProperty.Register("To", typeof(double), typeof(BindableDoubleAnimation), new UIPropertyMetadata(0d, new PropertyChangedCallback((s, e) => 24 | { 25 | BindableDoubleAnimation sender = (BindableDoubleAnimation) s; 26 | sender.internalAnimation.To = (double) e.NewValue; 27 | }))); 28 | 29 | 30 | public double From 31 | { 32 | get { return (double) GetValue(FromProperty); } 33 | set { SetValue(FromProperty, value); } 34 | } 35 | 36 | /// 37 | /// Dependency backing property for the property. 38 | /// 39 | public static readonly DependencyProperty FromProperty = 40 | DependencyProperty.Register("From", typeof(double), typeof(BindableDoubleAnimation), new UIPropertyMetadata(0d, new PropertyChangedCallback((s, e) => 41 | { 42 | BindableDoubleAnimation sender = (BindableDoubleAnimation) s; 43 | sender.internalAnimation.From = (double) e.NewValue; 44 | }))); 45 | 46 | 47 | public BindableDoubleAnimation() 48 | { 49 | internalAnimation = new DoubleAnimation(); 50 | } 51 | 52 | protected override double GetCurrentValueCore(double defaultOriginValue, double defaultDestinationValue, AnimationClock animationClock) 53 | { 54 | return internalAnimation.GetCurrentValue(defaultOriginValue, defaultDestinationValue, animationClock); 55 | } 56 | 57 | protected override Freezable CreateInstanceCore() 58 | { 59 | return internalAnimation.Clone(); ; 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /Libraries/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Xml.Serialization; 4 | 5 | namespace GG.Libraries 6 | { 7 | [XmlRoot("Configuration")] 8 | public class Configuration 9 | { 10 | [XmlArrayItem("Repository")] 11 | [XmlArray("RecentRepositories")] 12 | public List RecentRepositories { get; set; } 13 | 14 | [XmlArray("OpenedRepositories")] 15 | public List OpenedRepositories { get; set; } 16 | 17 | /// 18 | /// Loads the configuration from the Configuration.xml file. 19 | /// 20 | /// 21 | public static Configuration LoadConfiguration() 22 | { 23 | if (File.Exists("./Configuration.xml")) 24 | { 25 | using (var fileStream = new FileStream("./Configuration.xml", FileMode.Open)) 26 | { 27 | return (Configuration) new XmlSerializer(typeof(Configuration)).Deserialize(fileStream); 28 | } 29 | } 30 | 31 | // If the configuration file was not found, create a new empty configuration and save it. 32 | var configuration = new Configuration(); 33 | configuration.Save(); 34 | 35 | return configuration; 36 | } 37 | 38 | /// 39 | /// Saves the configuration to the Configuration.xml file. 40 | /// 41 | public void Save() 42 | { 43 | using (var fileStream = new FileStream("./Configuration.xml", FileMode.Create)) 44 | { 45 | new XmlSerializer(typeof(Configuration)).Serialize(fileStream, this); 46 | } 47 | } 48 | 49 | public Configuration() 50 | { 51 | RecentRepositories = new List(); 52 | OpenedRepositories = new List(); 53 | } 54 | } 55 | 56 | public class RepositoryConfiguration 57 | { 58 | [XmlAttribute("Name")] 59 | public string Name { get; set; } 60 | 61 | [XmlAttribute("RepositoryFullPath")] 62 | public string RepositoryFullPath { get; set; } 63 | } 64 | } -------------------------------------------------------------------------------- /Libraries/DateUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GG.Libraries 4 | { 5 | public class DateUtil 6 | { 7 | /// 8 | /// Converts a DateTime object into a relative time string. 9 | /// 10 | /// 11 | /// 12 | public static string GetRelativeDate(DateTime dt) 13 | { 14 | var ts = new TimeSpan(DateTime.Now.Ticks - dt.Ticks); 15 | double delta = Math.Abs(ts.TotalSeconds); 16 | 17 | const int SECOND = 1; 18 | const int MINUTE = 60 * SECOND; 19 | const int HOUR = 60 * MINUTE; 20 | const int DAY = 24 * HOUR; 21 | 22 | if (delta < 2 * MINUTE) 23 | { 24 | return "One minute ago"; 25 | } 26 | 27 | if (delta < 45 * MINUTE) 28 | { 29 | return ts.Minutes + " minutes ago"; 30 | } 31 | 32 | if (delta < 90 * MINUTE) 33 | { 34 | return "An hour ago"; 35 | } 36 | 37 | if (delta < 48 * HOUR) 38 | { 39 | return ts.Hours + " hours ago"; 40 | } 41 | 42 | if (delta < 7 * DAY) 43 | { 44 | return ts.Days + " days ago"; 45 | } 46 | 47 | return dt.ToShortDateString() + ' ' + dt.ToShortTimeString(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Libraries/DelegateCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | using System.Windows.Input; 4 | 5 | public class DelegateCommand : ICommand 6 | { 7 | private readonly Action execute; 8 | private readonly Predicate canExecute; 9 | 10 | public DelegateCommand(Action execute) 11 | : this(execute, null) 12 | { } 13 | 14 | public DelegateCommand(Action execute, Predicate canExecute) 15 | { 16 | if (execute == null) 17 | throw new ArgumentNullException("execute"); 18 | 19 | this.execute = execute; 20 | this.canExecute = canExecute; 21 | } 22 | 23 | #region ICommand Members 24 | 25 | [DebuggerStepThrough] 26 | public bool CanExecute(object parameter) 27 | { 28 | return canExecute == null ? true : canExecute(parameter); 29 | } 30 | 31 | public event EventHandler CanExecuteChanged 32 | { 33 | add { CommandManager.RequerySuggested += value; } 34 | remove { CommandManager.RequerySuggested -= value; } 35 | } 36 | 37 | public void Execute(object parameter) 38 | { 39 | execute(parameter); 40 | } 41 | 42 | #endregion 43 | } -------------------------------------------------------------------------------- /Libraries/EnhancedObservableCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.Specialized; 4 | using System.Collections.Generic; 5 | using System.ComponentModel; 6 | 7 | namespace GG.Libraries 8 | { 9 | /// 10 | /// Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed. 11 | /// 12 | /// 13 | public class EnhancedObservableCollection : System.Collections.ObjectModel.ObservableCollection 14 | { 15 | private bool disableNotifications = false; 16 | 17 | protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) 18 | { 19 | if (!disableNotifications) 20 | base.OnCollectionChanged(e); 21 | } 22 | 23 | /// 24 | /// Disables all change notifications for this collection. You need to re-enable them or they will never fire. 25 | /// 26 | /// Note: Enabling notifications will not fire the supressed notifications. 27 | /// 28 | public void DisableNotifications() 29 | { 30 | disableNotifications = true; 31 | } 32 | 33 | /// 34 | /// Enables notifications back. 35 | /// 36 | /// A reset notification is sent if the sendNotification parameter is set to true. 37 | /// 38 | /// 39 | public void EnableNotifications(bool sendNotification = false) 40 | { 41 | disableNotifications = false; 42 | 43 | if (sendNotification) 44 | OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); 45 | } 46 | 47 | /// 48 | /// Adds the elements of the specified collection to the end of the ObservableCollection(Of T). 49 | /// 50 | public void AddRange(IEnumerable collection) 51 | { 52 | var temporarilyDisableNotifications = !disableNotifications; 53 | 54 | if (temporarilyDisableNotifications) 55 | disableNotifications = true; 56 | 57 | foreach (T item in collection) 58 | Add(item); 59 | 60 | if (temporarilyDisableNotifications) 61 | disableNotifications = false; 62 | 63 | OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); 64 | } 65 | 66 | /// 67 | /// Returns true if the collection is empty. 68 | /// 69 | public bool IsEmpty 70 | { 71 | get { return Count == 0; } 72 | } 73 | 74 | /// 75 | /// Initializes a new instance of the System.Collections.ObjectModel.ObservableCollection(Of T) class. 76 | /// 77 | public EnhancedObservableCollection() : base() { } 78 | 79 | /// 80 | /// Initializes a new instance of the System.Collections.ObjectModel.ObservableCollection(Of T) class that contains elements copied from the specified collection. 81 | /// 82 | /// collection: The collection from which the elements are copied. 83 | /// The collection parameter cannot be null. 84 | public EnhancedObservableCollection(IEnumerable collection) : base(collection) { } 85 | } 86 | } -------------------------------------------------------------------------------- /Libraries/Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.Serialization; 4 | using System.Runtime.Serialization.Formatters.Binary; 5 | 6 | namespace GG 7 | { 8 | public static class Extensions 9 | { 10 | /// 11 | /// Crops the string to the specified length. 12 | /// 13 | /// 14 | /// 15 | /// 16 | public static string Right(this string str, int length) 17 | { 18 | if (length < 0) 19 | throw new ArgumentOutOfRangeException("length"); 20 | 21 | if (length == 0 || str == null) 22 | return string.Empty; 23 | 24 | int len = str.Length; 25 | if (length >= len) 26 | return str; 27 | else 28 | return str.Substring(len - length, length); 29 | } 30 | 31 | /// 32 | /// Removes line breaks. 33 | /// 34 | /// 35 | /// 36 | public static string RemoveLineBreaks(this string str) 37 | { 38 | return str.Replace("\n", "").Replace("\r", ""); 39 | } 40 | 41 | /// 42 | /// Perform a deep Copy of the object. 43 | /// 44 | /// The type of object being copied. 45 | /// The object instance to copy. 46 | /// The copied object. 47 | public static T Clone(this T source) 48 | { 49 | if (!typeof(T).IsSerializable) 50 | { 51 | throw new ArgumentException("The type must be serializable.", "source"); 52 | } 53 | 54 | // Don't serialize a null object, simply return the default for that object 55 | if (Object.ReferenceEquals(source, null)) 56 | { 57 | return default(T); 58 | } 59 | 60 | IFormatter formatter = new BinaryFormatter(); 61 | Stream stream = new MemoryStream(); 62 | using (stream) 63 | { 64 | formatter.Serialize(stream, source); 65 | stream.Seek(0, SeekOrigin.Begin); 66 | return (T) formatter.Deserialize(stream); 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Libraries/FileUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | namespace GG.Libraries 5 | { 6 | class FileUtil 7 | { 8 | /// 9 | /// Returns a human formatted file size of the given file. 10 | /// 11 | /// 12 | /// 13 | public static string GetFormattedFileSize(string fileFullPath) 14 | { 15 | if (!File.Exists(fileFullPath)) 16 | return "--"; 17 | 18 | double bytes = new System.IO.FileInfo(fileFullPath).Length; 19 | 20 | string[] suffixes = { "B", "KB", "MB", "GB" }; 21 | int order = 0; 22 | 23 | while (bytes >= 1024 && order + 1 < suffixes.Length) 24 | { 25 | order++; 26 | bytes = bytes / 1024; 27 | } 28 | 29 | return string.Format("{0:0.##} {1}", bytes, suffixes[order]); 30 | } 31 | 32 | /// 33 | /// Tells whether the given file is a binary file based on if there are any null bytes. 34 | /// 35 | /// 36 | /// 37 | public static bool IsBinaryFile(string fileFullPath) 38 | { 39 | if (!File.Exists(fileFullPath)) 40 | return false; 41 | 42 | byte[] fileBytes = File.ReadAllBytes(fileFullPath); 43 | 44 | bool hadNullByte = false; 45 | 46 | foreach (byte b in fileBytes) 47 | { 48 | if (b == (byte) 0) 49 | { 50 | hadNullByte = true; 51 | break; 52 | } 53 | } 54 | 55 | return hadNullByte; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Libraries/GenericUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GG.Libraries 8 | { 9 | public static class GenericUtil 10 | { 11 | /// 12 | /// Converts a string to a hex string. 13 | /// 14 | /// 15 | /// 16 | public static string ConvertStringToHex(string asciiString) 17 | { 18 | string hex = ""; 19 | 20 | foreach (char c in asciiString) 21 | { 22 | int tmp = c; 23 | hex += String.Format("{0:x2}", (uint) System.Convert.ToUInt32(tmp.ToString())); 24 | } 25 | 26 | return hex; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Libraries/IconUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Windows; 4 | using System.Windows.Media; 5 | using System.Windows.Media.Imaging; 6 | 7 | namespace GG.Libraries 8 | { 9 | /// 10 | /// Retrieves system icons and converts them to proper bitmap format for display in the application. 11 | /// 12 | public class IconUtil 13 | { 14 | /// 15 | /// Returns ImageSource for the specified file path/name/extension. 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | public static ImageSource GetIcon(string path, bool smallIcon, bool isDirectory) 22 | { 23 | // SHGFI_USEFILEATTRIBUTES takes the file name and attributes into account if it doesn't exist. 24 | uint flags = SHGFI_ICON | SHGFI_USEFILEATTRIBUTES; 25 | if (smallIcon) 26 | flags |= SHGFI_SMALLICON; 27 | 28 | uint attributes = FILE_ATTRIBUTE_NORMAL; 29 | if (isDirectory) 30 | attributes |= FILE_ATTRIBUTE_DIRECTORY; 31 | 32 | SHFILEINFO shfi; 33 | if (IntPtr.Zero != SHGetFileInfo( 34 | path, 35 | attributes, 36 | out shfi, 37 | (uint) Marshal.SizeOf(typeof(SHFILEINFO)), 38 | flags)) 39 | { 40 | return System.Windows.Interop.Imaging.CreateBitmapSourceFromHIcon( 41 | shfi.hIcon, 42 | Int32Rect.Empty, 43 | BitmapSizeOptions.FromEmptyOptions()); 44 | } 45 | return null; 46 | } 47 | 48 | [StructLayout(LayoutKind.Sequential)] 49 | private struct SHFILEINFO 50 | { 51 | public IntPtr hIcon; 52 | public int iIcon; 53 | public uint dwAttributes; 54 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] 55 | public string szDisplayName; 56 | [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)] 57 | public string szTypeName; 58 | } 59 | 60 | [DllImport("shell32", CharSet=CharSet.Unicode)] 61 | private static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, out SHFILEINFO psfi, uint cbFileInfo, uint flags); 62 | 63 | private const uint FILE_ATTRIBUTE_READONLY = 0x00000001; 64 | private const uint FILE_ATTRIBUTE_HIDDEN = 0x00000002; 65 | private const uint FILE_ATTRIBUTE_SYSTEM = 0x00000004; 66 | private const uint FILE_ATTRIBUTE_DIRECTORY = 0x00000010; 67 | private const uint FILE_ATTRIBUTE_ARCHIVE = 0x00000020; 68 | private const uint FILE_ATTRIBUTE_DEVICE = 0x00000040; 69 | private const uint FILE_ATTRIBUTE_NORMAL = 0x00000080; 70 | private const uint FILE_ATTRIBUTE_TEMPORARY = 0x00000100; 71 | private const uint FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200; 72 | private const uint FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400; 73 | private const uint FILE_ATTRIBUTE_COMPRESSED = 0x00000800; 74 | private const uint FILE_ATTRIBUTE_OFFLINE = 0x00001000; 75 | private const uint FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000; 76 | private const uint FILE_ATTRIBUTE_ENCRYPTED = 0x00004000; 77 | private const uint FILE_ATTRIBUTE_VIRTUAL = 0x00010000; 78 | 79 | private const uint SHGFI_ICON = 0x000000100; // get icon 80 | private const uint SHGFI_DISPLAYNAME = 0x000000200; // get display name 81 | private const uint SHGFI_TYPENAME = 0x000000400; // get type name 82 | private const uint SHGFI_ATTRIBUTES = 0x000000800; // get attributes 83 | private const uint SHGFI_ICONLOCATION = 0x000001000; // get icon location 84 | private const uint SHGFI_EXETYPE = 0x000002000; // return exe type 85 | private const uint SHGFI_SYSICONINDEX = 0x000004000; // get system icon index 86 | private const uint SHGFI_LINKOVERLAY = 0x000008000; // put a link overlay on icon 87 | private const uint SHGFI_SELECTED = 0x000010000; // show icon in selected state 88 | private const uint SHGFI_ATTR_SPECIFIED = 0x000020000; // get only specified attributes 89 | private const uint SHGFI_LARGEICON = 0x000000000; // get large icon 90 | private const uint SHGFI_SMALLICON = 0x000000001; // get small icon 91 | private const uint SHGFI_OPENICON = 0x000000002; // get open icon 92 | private const uint SHGFI_SHELLICONSIZE = 0x000000004; // get shell size icon 93 | private const uint SHGFI_PIDL = 0x000000008; // pszPath is a pidl 94 | private const uint SHGFI_USEFILEATTRIBUTES = 0x000000010; // use passed dwFileAttribute 95 | } 96 | } -------------------------------------------------------------------------------- /Libraries/Observable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace GG.Libraries 5 | { 6 | public class Observable : INotifyPropertyChanged 7 | { 8 | private T value; 9 | 10 | public Observable() 11 | { 12 | 13 | } 14 | 15 | public Observable(T value) 16 | { 17 | this.value = value; 18 | } 19 | 20 | public T Value 21 | { 22 | get { return value; } 23 | set 24 | { 25 | this.value = value; 26 | PropertyChanged(this, new PropertyChangedEventArgs("Value")); 27 | } 28 | } 29 | 30 | public static implicit operator T(Observable val) 31 | { 32 | return val.value; 33 | } 34 | 35 | 36 | public event PropertyChangedEventHandler PropertyChanged = delegate { }; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Libraries/UIHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Media; 4 | 5 | namespace GG.Libraries 6 | { 7 | class UIHelper 8 | { 9 | /// 10 | /// Returns the first ancester of specified type 11 | /// 12 | public static T FindAncestor(DependencyObject current) 13 | where T : DependencyObject 14 | { 15 | current = VisualTreeHelper.GetParent(current); 16 | 17 | while (current != null) 18 | { 19 | if (current is T) 20 | { 21 | return (T) current; 22 | } 23 | current = VisualTreeHelper.GetParent(current); 24 | }; 25 | return null; 26 | } 27 | 28 | /// 29 | /// Returns a specific ancester of an object 30 | /// 31 | public static T FindAncestor(DependencyObject current, T lookupItem) 32 | where T : DependencyObject 33 | { 34 | while (current != null) 35 | { 36 | if (current is T && current == lookupItem) 37 | { 38 | return (T) current; 39 | } 40 | current = VisualTreeHelper.GetParent(current); 41 | }; 42 | return null; 43 | } 44 | 45 | /// 46 | /// Finds an ancestor object by name and type 47 | /// 48 | public static T FindAncestor(DependencyObject current, string parentName) 49 | where T : DependencyObject 50 | { 51 | while (current != null) 52 | { 53 | if (!string.IsNullOrEmpty(parentName)) 54 | { 55 | var frameworkElement = current as FrameworkElement; 56 | if (current is T && frameworkElement != null && frameworkElement.Name == parentName) 57 | { 58 | return (T) current; 59 | } 60 | } 61 | else if (current is T) 62 | { 63 | return (T) current; 64 | } 65 | current = VisualTreeHelper.GetParent(current); 66 | }; 67 | 68 | return null; 69 | 70 | } 71 | 72 | /// 73 | /// Looks for a child control within a parent by name 74 | /// 75 | public static T FindChild(DependencyObject parent, string childName) 76 | where T : DependencyObject 77 | { 78 | // Confirm parent and childName are valid. 79 | if (parent == null) return null; 80 | 81 | T foundChild = null; 82 | 83 | int childrenCount = VisualTreeHelper.GetChildrenCount(parent); 84 | for (int i = 0; i < childrenCount; i++) 85 | { 86 | var child = VisualTreeHelper.GetChild(parent, i); 87 | // If the child is not of the request child type child 88 | T childType = child as T; 89 | if (childType == null) 90 | { 91 | // recursively drill down the tree 92 | foundChild = FindChild(child, childName); 93 | 94 | // If the child is found, break so we do not overwrite the found child. 95 | if (foundChild != null) break; 96 | } 97 | else if (!string.IsNullOrEmpty(childName)) 98 | { 99 | var frameworkElement = child as FrameworkElement; 100 | // If the child's name is set for search 101 | if (frameworkElement != null && frameworkElement.Name == childName) 102 | { 103 | // if the child's name is of the request name 104 | foundChild = (T) child; 105 | break; 106 | } 107 | else 108 | { 109 | // recursively drill down the tree 110 | foundChild = FindChild(child, childName); 111 | 112 | // If the child is found, break so we do not overwrite the found child. 113 | if (foundChild != null) break; 114 | } 115 | } 116 | else 117 | { 118 | // child element found. 119 | foundChild = (T) child; 120 | break; 121 | } 122 | } 123 | 124 | return foundChild; 125 | } 126 | 127 | /// 128 | /// Looks for a child control within a parent by type 129 | /// 130 | public static T FindChild(DependencyObject parent) 131 | where T : DependencyObject 132 | { 133 | // Confirm parent is valid. 134 | if (parent == null) return null; 135 | 136 | T foundChild = null; 137 | 138 | int childrenCount = VisualTreeHelper.GetChildrenCount(parent); 139 | for (int i = 0; i < childrenCount; i++) 140 | { 141 | var child = VisualTreeHelper.GetChild(parent, i); 142 | // If the child is not of the request child type child 143 | T childType = child as T; 144 | if (childType == null) 145 | { 146 | // recursively drill down the tree 147 | foundChild = FindChild(child); 148 | 149 | // If the child is found, break so we do not overwrite the found child. 150 | if (foundChild != null) break; 151 | } 152 | else 153 | { 154 | // child element found. 155 | foundChild = (T) child; 156 | break; 157 | } 158 | } 159 | return foundChild; 160 | } 161 | } 162 | } 163 | -------------------------------------------------------------------------------- /Models/Branch.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Collections.ObjectModel; 4 | 5 | namespace GG.Models 6 | { 7 | public class Branch 8 | { 9 | /// 10 | /// The canonical name in form of "refs/heads/master". 11 | /// 12 | public string CanonicalName { get; set; } 13 | 14 | /// 15 | /// The actual name of the branch, e.g. "origin/master". 16 | /// 17 | public string Name { get; set; } 18 | 19 | public Branch TrackedBranch { get; set; } 20 | private string TrackedBranchName { get; set; } 21 | 22 | public Commit Tip { get; set; } 23 | public string TipHash { get; set; } 24 | 25 | public bool IsRemote { get; set; } 26 | public bool IsTracking { get; set; } 27 | 28 | public int AheadBy { get; set; } 29 | public int BehindBy { get; set; } 30 | 31 | /// 32 | /// Stores the right most visual position of any commit within this branch tree. 33 | /// 34 | public int RightMostVisualPosition { get; set; } 35 | 36 | private RepositoryViewModel repositoryViewModel { get; set; } 37 | 38 | /// 39 | /// Creates a new branch model. 40 | /// 41 | /// 42 | public static Branch Create(RepositoryViewModel repositoryViewModel, LibGit2Sharp.Repository repo, LibGit2Sharp.Branch branch) 43 | { 44 | Branch newBranch = new Branch 45 | { 46 | CanonicalName = branch.CanonicalName, 47 | Name = branch.Name, 48 | IsRemote = branch.IsRemote, 49 | IsTracking = branch.IsTracking, 50 | TipHash = branch.Tip.Sha.ToString(), 51 | AheadBy = branch.AheadBy, 52 | BehindBy = branch.BehindBy, 53 | TrackedBranchName = branch.TrackedBranch != null ? branch.TrackedBranch.Name : null 54 | }; 55 | 56 | newBranch.repositoryViewModel = repositoryViewModel; 57 | 58 | // Loop through the first N commits and let them know about me. 59 | foreach (LibGit2Sharp.Commit branchCommit in branch.Commits.Take(repositoryViewModel.CommitsPerPage)) 60 | { 61 | Commit commit = repositoryViewModel.Commits.Where(c => c.Hash == branchCommit.Sha.ToString()).FirstOrDefault(); 62 | 63 | if (commit != null) 64 | { 65 | commit.Branches.Add(newBranch); // Let the commit know that I am one of her branches. 66 | 67 | // Process commit DisplayTags (tags to display next to the commit description, in this case = branch Tips). 68 | if (newBranch.TipHash == commit.Hash) 69 | { 70 | commit.DisplayTags.Add(branch.Name); 71 | newBranch.Tip = commit; 72 | } 73 | } 74 | } 75 | 76 | return newBranch; 77 | } 78 | 79 | /// 80 | /// Post processes the branch. This means setting the Tip and Tracking Branch properties. 81 | /// 82 | /// 83 | public void PostProcess(ObservableCollection branches, ObservableCollection commits) 84 | { 85 | // Set the TrackedBranch to be an actual Branch model. 86 | TrackedBranch = branches.Where(b => b.Name == TrackedBranchName).FirstOrDefault(); 87 | 88 | // Set the Tip to be an actual Commit model. 89 | Tip = commits.Where(c => c.Hash == TipHash).FirstOrDefault(); 90 | } 91 | 92 | /// 93 | /// Deletes this branch. 94 | /// 95 | public void Delete() 96 | { 97 | LibGit2Sharp.Repository repo = new LibGit2Sharp.Repository(repositoryViewModel.RepositoryFullPath); 98 | 99 | repo.Branches.Delete(Name); 100 | 101 | repo.Dispose(); 102 | 103 | repositoryViewModel.LoadEntireRepository(); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Models/Commit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using GG.Libraries; 4 | using System.Linq; 5 | using System.Collections.ObjectModel; 6 | 7 | namespace GG.Models 8 | { 9 | public class Commit 10 | { 11 | public string AuthorEmail { get; set; } 12 | public string AuthorName { get; set; } 13 | public DateTime Date { get; set; } 14 | public string Description { get; set; } 15 | public string ShortDescription { get; set; } 16 | public List DisplayTags { get; set; } 17 | public ObservableCollection Tags { get; set; } 18 | public string Hash { get; set; } 19 | public List Branches { get; set; } 20 | public List BranchesAround { get; set; } 21 | public List ParentHashes { get; set; } 22 | public int ParentCount { get; set; } 23 | public List Parents { get; set; } 24 | public int VisualPosition { get; set; } 25 | public bool IsHead { get; set; } 26 | public List Children { get; set; } 27 | 28 | /// 29 | /// Returns the ObjectId of LibGit2Sharp. 30 | /// 31 | public LibGit2Sharp.ObjectId ObjectId { get; set; } 32 | 33 | /// 34 | /// Returns the date of this changeset in relative format. 35 | /// 36 | public string FormattedDate 37 | { 38 | get 39 | { 40 | return DateUtil.GetRelativeDate(Date); 41 | } 42 | } 43 | 44 | /// 45 | /// Returns a 7 character wide hash string. 46 | /// 47 | public string HashShort 48 | { 49 | get 50 | { 51 | return Hash.Substring(0, 7); 52 | } 53 | } 54 | 55 | /// 56 | /// Returns the author in format "name <email>". 57 | /// 58 | public string Author 59 | { 60 | get 61 | { 62 | return AuthorName + " <" + AuthorEmail + ">"; 63 | } 64 | } 65 | 66 | /// 67 | /// Returns whether this is a merge commit. 68 | /// 69 | /// 70 | public bool IsMergeCommit() 71 | { 72 | return ParentCount > 1; 73 | } 74 | 75 | /// 76 | /// Creates a new commit object from the given parameters. 77 | /// 78 | /// 79 | /// 80 | /// 81 | /// 82 | public static Commit Create(LibGit2Sharp.Repository repo, 83 | LibGit2Sharp.Commit commit, 84 | ObservableCollection tags) 85 | { 86 | var c = new Commit(); 87 | 88 | // Process Tags (Git tags to display next to the commit description). 89 | var commitTags = new ObservableCollection(); 90 | foreach (var tag in tags) 91 | { 92 | if (tag.TargetSha == commit.Sha) 93 | { 94 | commitTags.Add(tag); 95 | tag.Target = c; 96 | } 97 | } 98 | 99 | // Process display tags. 100 | var displayTags = new List(); 101 | if (repo.Head.Tip == commit) 102 | displayTags.Add("HEAD"); 103 | 104 | // Process ParentHashes. 105 | var parentHashes = new List(); 106 | foreach (var parentCommit in commit.Parents) 107 | { 108 | parentHashes.Add(parentCommit.Sha); 109 | } 110 | 111 | // Set properties. 112 | c.AuthorEmail = commit.Author.Email; 113 | c.AuthorName = commit.Author.Name; 114 | c.Date = commit.Author.When.DateTime; 115 | c.Description = commit.Message; 116 | c.ShortDescription = commit.Message.Right(72).RemoveLineBreaks(); 117 | c.DisplayTags = displayTags; 118 | c.Branches = new List(); 119 | c.Tags = commitTags; 120 | c.Hash = commit.Sha; 121 | c.ParentHashes = parentHashes; 122 | c.ParentCount = commit.ParentsCount; 123 | c.Parents = new List(); 124 | c.ObjectId = commit.Id; 125 | c.VisualPosition = -1; // -1 means it's not yet calculated. 126 | c.Children = new List(); 127 | 128 | return c; 129 | } 130 | 131 | /// 132 | /// Post-processes the commit. This means that we set up the parent object relationship. 133 | /// 134 | /// 135 | public void PostProcess(ObservableCollection commits, ObservableCollection branches) 136 | { 137 | // Set Parents. 138 | if (ParentCount > 0) 139 | { 140 | foreach (string hash in ParentHashes) 141 | { 142 | Commit parentCommit = commits.Where(c => c.Hash == hash).FirstOrDefault(); 143 | 144 | if (parentCommit != null) 145 | { 146 | Parents.Add(parentCommit); 147 | parentCommit.Children.Add(this); 148 | } 149 | } 150 | } 151 | 152 | // Set BranchesAround. 153 | BranchesAround = RepoUtil.GetBranchesAroundCommit(this, branches); 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /Models/DetachedHead.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GG.Models 4 | { 5 | /// 6 | /// This class represents a detached head "branch". 7 | /// 8 | public class DetachedHead : Branch 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Models/RecentCommitMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace GG.Models 8 | { 9 | /// 10 | /// This class represents a recent commit message. 11 | /// 12 | public class RecentCommitMessage 13 | { 14 | public string CroppedMessage { get; private set; } 15 | public string FullMessage { get; private set; } 16 | 17 | public RecentCommitMessage(string message) 18 | { 19 | FullMessage = message; 20 | CroppedMessage = message.Right(72); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Models/Remote.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GG.Models 4 | { 5 | public class Remote 6 | { 7 | public string Name { get; set; } 8 | public string Tip { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /Models/Stash.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GG.Models 4 | { 5 | public class Stash 6 | { 7 | public string Name { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /Models/StatusItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using GG.Libraries; 8 | 9 | namespace GG.Models 10 | { 11 | public class StatusItem 12 | { 13 | public LibGit2Sharp.FileStatus Status { set; get; } 14 | public string Filename { set; get; } 15 | public string Size { set; get; } 16 | public string IsBinary { set; get; } 17 | 18 | /// 19 | /// Returns the generic status (i.e. either "Staged" or "Unstaged"). 20 | /// 21 | public string GenericStatus 22 | { 23 | get 24 | { 25 | if ((Status & LibGit2Sharp.FileStatus.Staged) == LibGit2Sharp.FileStatus.Staged) 26 | { 27 | return "Staged"; 28 | } 29 | 30 | if ((Status & LibGit2Sharp.FileStatus.Removed) == LibGit2Sharp.FileStatus.Removed) 31 | { 32 | return "Staged"; 33 | } 34 | 35 | if ((Status & LibGit2Sharp.FileStatus.Added) == LibGit2Sharp.FileStatus.Added) 36 | { 37 | return "Staged"; 38 | } 39 | 40 | return "Not staged"; 41 | } 42 | } 43 | 44 | /// 45 | /// Returns true whether this status item is staged. 46 | /// 47 | public bool IsStaged 48 | { 49 | get 50 | { 51 | return GenericStatus == "Staged"; 52 | } 53 | } 54 | 55 | public string Extension 56 | { 57 | get 58 | { 59 | return Path.GetExtension(Filename); 60 | } 61 | } 62 | 63 | public bool IsIgnored() 64 | { 65 | return (Status & LibGit2Sharp.FileStatus.Ignored) == LibGit2Sharp.FileStatus.Ignored; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /Models/Submodule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GG.Models 4 | { 5 | public class Submodule 6 | { 7 | public string Name { get; set; } 8 | public string Path { get; set; } 9 | public string Url { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Models/Tag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace GG.Models 4 | { 5 | public class Tag 6 | { 7 | public string CanonicalName { get; set; } 8 | public string Name { get; set; } 9 | public Commit Target { get; set; } 10 | public string TargetSha { get; set; } 11 | public bool IsAnnotated { get; set; } 12 | public bool HasCommitAsTarget { get; set; } 13 | 14 | /// 15 | /// Creates a new tag. 16 | /// 17 | /// 18 | /// 19 | /// 20 | public static Tag Create(LibGit2Sharp.Repository repo, LibGit2Sharp.Tag tag) 21 | { 22 | Tag newTag = new Tag 23 | { 24 | CanonicalName = tag.CanonicalName, 25 | Name = tag.Name, 26 | //Annotation = tag.Annotation, 27 | IsAnnotated = false, //tag.IsAnnotated, 28 | TargetSha = tag.Target.Sha, 29 | HasCommitAsTarget = tag.Target.GetType().FullName == "LibGit2Sharp.Commit" 30 | }; 31 | 32 | return newTag; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("A graphical user interface for Git.")] 11 | [assembly: AssemblyDescription("A graphical user interface for Git.")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("Git-GUI")] 15 | [assembly: AssemblyCopyright("Copyright © Kai Sellgren")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("1.0.0.0")] 55 | [assembly: AssemblyFileVersion("1.0.0.0")] 56 | -------------------------------------------------------------------------------- /Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17379 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GG.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GG.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17379 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GG.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Properties/app.manifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Git-GUI 2 | 3 | Git-GUI is Windows only graphical user interface for Git source code management. 4 | 5 | #####*Please note: Git-GUI is not ready yet -- i.e. it's an alpha version that does not support everything you need. I'm working on it to make it a stable product.* 6 | 7 | #### FAQ 8 | 9 | #####Do I need the official Git installed on my computer? 10 | No. Git-GUI is standalone, it does not need Git installation. 11 | 12 | #####Does Git-GUI have something to do with the official Git built-in tool called git-gui (```git gui``` on command line)? 13 | No. Git-GUI is a software written by me (Kai Sellgren) as a hobby project. 14 | 15 | #####How does it look like? 16 | Git-GUI 17 | 18 | *Remember: heavily work in progress!* 19 | 20 | #####What do I need to run it? 21 | - Windows Vista, 7 or 8. 22 | - You need to have .NET framework 4.5 runtime installed/updated. Windows Update will do that for you if it does not have already. 23 | 24 | ### Project goals 25 | I aim to make a complete product that features the majority of Git functionality including from basic stuff to Stashes, Remotes and Bisects. 26 | 27 | ### Contributing 28 | 29 | So you want to fix a bug or add a feature? Or perhaps you just want to try it out? Here's what you need to do: 30 | 31 | - Install [.NET Framework 4.5](http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27541) or newer. 32 | - Install [Visual Studio 2012 RC](http://www.microsoft.com/visualstudio/11/en-us/downloads) or newer. 33 | - Install [Nuget](http://nuget.org/) for Visual Studio (it's a package manager). 34 | - Restart Visual Studio. 35 | - Install [LibGit2Sharp](http://nuget.org/packages/LibGit2Sharp) via NuGet: ```Install-Package LibGit2Sharp``` 36 | - Install [Microsoft.Windows.Shell](https://nuget.org/packages/Microsoft.Windows.Shell) via NuGet: ```Install-Package Microsoft.Windows.Shell``` 37 | - Restart Visual Studio or reload the project. 38 | - Press F5. 39 | -------------------------------------------------------------------------------- /Resources/AbstractBackground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/AbstractBackground.jpg -------------------------------------------------------------------------------- /Resources/Icons/Add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Add.png -------------------------------------------------------------------------------- /Resources/Icons/AddNote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/AddNote.png -------------------------------------------------------------------------------- /Resources/Icons/Alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Alert.png -------------------------------------------------------------------------------- /Resources/Icons/Annotate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Annotate.png -------------------------------------------------------------------------------- /Resources/Icons/Archive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Archive.png -------------------------------------------------------------------------------- /Resources/Icons/Branch-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Branch-24.png -------------------------------------------------------------------------------- /Resources/Icons/Branch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Branch.png -------------------------------------------------------------------------------- /Resources/Icons/Cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Cancel.png -------------------------------------------------------------------------------- /Resources/Icons/Checkout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Checkout.png -------------------------------------------------------------------------------- /Resources/Icons/Clipboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Clipboard.png -------------------------------------------------------------------------------- /Resources/Icons/Clone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Clone.png -------------------------------------------------------------------------------- /Resources/Icons/CloseWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/CloseWindow.png -------------------------------------------------------------------------------- /Resources/Icons/Copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Copy.png -------------------------------------------------------------------------------- /Resources/Icons/CopyPatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/CopyPatch.png -------------------------------------------------------------------------------- /Resources/Icons/Cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Cross.png -------------------------------------------------------------------------------- /Resources/Icons/DatabaseRefresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/DatabaseRefresh.png -------------------------------------------------------------------------------- /Resources/Icons/Delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Delete.png -------------------------------------------------------------------------------- /Resources/Icons/Detect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Detect.png -------------------------------------------------------------------------------- /Resources/Icons/Edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Edit.png -------------------------------------------------------------------------------- /Resources/Icons/Email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Email.png -------------------------------------------------------------------------------- /Resources/Icons/Export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Export.png -------------------------------------------------------------------------------- /Resources/Icons/Fetch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Fetch.png -------------------------------------------------------------------------------- /Resources/Icons/Forget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Forget.png -------------------------------------------------------------------------------- /Resources/Icons/Git-GUI.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Git-GUI.ico -------------------------------------------------------------------------------- /Resources/Icons/Git-GUI.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Git-GUI.png -------------------------------------------------------------------------------- /Resources/Icons/GitHub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/GitHub.png -------------------------------------------------------------------------------- /Resources/Icons/Hash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Hash.png -------------------------------------------------------------------------------- /Resources/Icons/History.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/History.png -------------------------------------------------------------------------------- /Resources/Icons/Home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Home.png -------------------------------------------------------------------------------- /Resources/Icons/Ignore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Ignore.png -------------------------------------------------------------------------------- /Resources/Icons/Information.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Information.png -------------------------------------------------------------------------------- /Resources/Icons/MaximizeWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/MaximizeWindow.png -------------------------------------------------------------------------------- /Resources/Icons/Merge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Merge.png -------------------------------------------------------------------------------- /Resources/Icons/MessageWrite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/MessageWrite.png -------------------------------------------------------------------------------- /Resources/Icons/Messages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Messages.png -------------------------------------------------------------------------------- /Resources/Icons/MinimizeWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/MinimizeWindow.png -------------------------------------------------------------------------------- /Resources/Icons/Open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Open.png -------------------------------------------------------------------------------- /Resources/Icons/OpenIgnoreEditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/OpenIgnoreEditor.png -------------------------------------------------------------------------------- /Resources/Icons/Patch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Patch.png -------------------------------------------------------------------------------- /Resources/Icons/Plus.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Plus.gif -------------------------------------------------------------------------------- /Resources/Icons/Plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Plus.png -------------------------------------------------------------------------------- /Resources/Icons/Pull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Pull.png -------------------------------------------------------------------------------- /Resources/Icons/Push.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Push.png -------------------------------------------------------------------------------- /Resources/Icons/Question.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Question.png -------------------------------------------------------------------------------- /Resources/Icons/Recent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Recent.png -------------------------------------------------------------------------------- /Resources/Icons/Remote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Remote.png -------------------------------------------------------------------------------- /Resources/Icons/Rename.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Rename.png -------------------------------------------------------------------------------- /Resources/Icons/RepositoryWrite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/RepositoryWrite.png -------------------------------------------------------------------------------- /Resources/Icons/Reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Reset.png -------------------------------------------------------------------------------- /Resources/Icons/ResetHard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/ResetHard.png -------------------------------------------------------------------------------- /Resources/Icons/RestoreWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/RestoreWindow.png -------------------------------------------------------------------------------- /Resources/Icons/Revert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Revert.png -------------------------------------------------------------------------------- /Resources/Icons/SVN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/SVN.png -------------------------------------------------------------------------------- /Resources/Icons/Save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Save.png -------------------------------------------------------------------------------- /Resources/Icons/Search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Search.png -------------------------------------------------------------------------------- /Resources/Icons/Settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Settings.png -------------------------------------------------------------------------------- /Resources/Icons/Stash-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Stash-24.png -------------------------------------------------------------------------------- /Resources/Icons/Stash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Stash.png -------------------------------------------------------------------------------- /Resources/Icons/Statistics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Statistics.png -------------------------------------------------------------------------------- /Resources/Icons/Submodule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Submodule.png -------------------------------------------------------------------------------- /Resources/Icons/TabPlus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/TabPlus.png -------------------------------------------------------------------------------- /Resources/Icons/Tag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Tag.png -------------------------------------------------------------------------------- /Resources/Icons/Tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Tick.png -------------------------------------------------------------------------------- /Resources/Icons/Unstage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Unstage.png -------------------------------------------------------------------------------- /Resources/Icons/VisualDiff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/VisualDiff.png -------------------------------------------------------------------------------- /Resources/Icons/Warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kaisellgren/Git-GUI/c8d19d333f7533d76470be22153387440c139601/Resources/Icons/Warning.png -------------------------------------------------------------------------------- /Styles/Border.xaml: -------------------------------------------------------------------------------- 1 |  3 | 7 | -------------------------------------------------------------------------------- /Styles/Colors.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Styles/DisplayTags.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 11 | 12 | 27 | 28 | 50 | 51 | 52 | 53 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Styles/GridSplitter.xaml: -------------------------------------------------------------------------------- 1 |  3 | 42 | 43 | 82 | -------------------------------------------------------------------------------- /Styles/LeftToolbar.xaml: -------------------------------------------------------------------------------- 1 |  2 | 14 | 15 | 18 | 19 | 27 | -------------------------------------------------------------------------------- /Styles/Panel.xaml: -------------------------------------------------------------------------------- 1 |  3 | 16 | 17 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /Styles/Scrollbar.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 22 | 23 | 24 | 92 | -------------------------------------------------------------------------------- /Styles/Separator.xaml: -------------------------------------------------------------------------------- 1 |  3 | 17 | -------------------------------------------------------------------------------- /Styles/TextBlock.xaml: -------------------------------------------------------------------------------- 1 |  3 | 8 | -------------------------------------------------------------------------------- /Styles/TextBox.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 55 | -------------------------------------------------------------------------------- /Styles/Window.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 31 | -------------------------------------------------------------------------------- /TemplateSelectors/RepoTabContentTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Threading.Tasks; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using System.Windows.Data; 7 | 8 | namespace GG 9 | { 10 | class RepoTabContentTemplateSelector : DataTemplateSelector 11 | { 12 | /// 13 | /// This method determines what template to use for tab's content. 14 | /// 15 | /// For example, if repo is not opened, it shows New Tab template, otherwise it shows the repository template. 16 | /// 17 | /// 18 | /// 19 | /// 20 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 21 | { 22 | string templateName; 23 | 24 | if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) 25 | { 26 | templateName = "repoTabContentTemplate"; 27 | } 28 | else if (item == CollectionView.NewItemPlaceholder) 29 | { 30 | templateName = "repoTabDashboardContentTemplate"; 31 | } 32 | else 33 | { 34 | RepositoryViewModel repository = item as RepositoryViewModel; 35 | 36 | templateName = repository.NotOpened ? "repoTabDashboardContentTemplate" : "repoTabContentTemplate"; 37 | } 38 | 39 | FrameworkElement element = container as FrameworkElement; 40 | var template = element.TryFindResource(templateName) as DataTemplate; 41 | if (template != null) 42 | { 43 | return template; 44 | } 45 | 46 | return base.SelectTemplate(item, container); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /TemplateSelectors/TabTemplateSelector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | 10 | namespace GG 11 | { 12 | public class TabTemplateSelector : DataTemplateSelector 13 | { 14 | public DataTemplate NormalTabTemplate { get; set; } 15 | public DataTemplate NewTabTemplate { get; set; } 16 | 17 | public override DataTemplate SelectTemplate(object item, DependencyObject container) 18 | { 19 | if (item == CollectionView.NewItemPlaceholder) 20 | { 21 | return NewTabTemplate; 22 | } 23 | else 24 | { 25 | return NormalTabTemplate; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Templates/RepoTabContentTemplate.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Templates/RepoTabDashboardContentTemplate.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Templates/RepoTabNewTemplate.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | 16 | 17 | -------------------------------------------------------------------------------- /Templates/RepoTabTemplate.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /UserControls/CenterArea.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /UserControls/CenterArea.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Controls.Primitives; 5 | using GG.Libraries; 6 | 7 | namespace GG.UserControls 8 | { 9 | /// 10 | /// Interaction logic for CenterArea.xaml 11 | /// 12 | public partial class CenterArea : UserControl 13 | { 14 | public CenterArea() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private void GridSplitterDragCompleted(object sender, DragCompletedEventArgs e) 20 | { 21 | MakeGridSplitterToSnapToGrid(); 22 | } 23 | 24 | private void MakeGridSplitterToSnapToGrid() 25 | { 26 | // We want the grid splitter to snap in grid of 24 units. 27 | var excess = (int) ChangesetHistoryRowDefinition.Height.Value % 24; 28 | 29 | if (excess == 0) 30 | return; 31 | 32 | ChangesetHistoryRowDefinition.Height = new GridLength(ChangesetHistoryRowDefinition.Height.Value - excess); 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /UserControls/ChangesetHistory.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using GG.Libraries; 6 | 7 | namespace GG.UserControls 8 | { 9 | /// 10 | /// Interaction logic for ChangesetHistory.xaml 11 | /// 12 | public partial class ChangesetHistory : UserControl 13 | { 14 | public ChangesetHistory() 15 | { 16 | InitializeComponent(); 17 | 18 | ChangesetHistoryGrid.Loaded += (sender, args) => RedrawGraph(); 19 | } 20 | 21 | /// 22 | /// Recalculates the height for the graph and draws it. 23 | /// 24 | public void RedrawGraph() 25 | { 26 | // Redraw the graph. 27 | var changesetGraph = new ChangesetGraph((RepositoryViewModel) DataContext, Graph); 28 | changesetGraph.Draw(ChangesetHistoryGrid.Items); 29 | 30 | // Update the height for the Graph element. 31 | Graph.Height = changesetGraph.TotalHeight; 32 | 33 | // TODO: Set width also, and for the datagrid as well! 34 | } 35 | 36 | private void ChangesetHistoryGrid_ScrollChanged(object sender, ScrollChangedEventArgs e) 37 | { 38 | var scrollViewer = UIHelper.FindChild(this, "GraphScrollViewer"); 39 | scrollViewer.ScrollToVerticalOffset(Math.Floor(e.VerticalOffset) * 24); 40 | 41 | var dataGrid = UIHelper.FindChild(this, "ChangesetHistoryGrid"); 42 | scrollViewer.Height = Math.Abs(dataGrid.ActualHeight - 24); 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /UserControls/CommitPanel.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 44 | 45 | 46 | 47 | 48 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /UserControls/CommitPanel.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using System.Windows.Data; 5 | using System.Windows.Input; 6 | using GG.Libraries; 7 | using GG.Models; 8 | 9 | namespace GG.UserControls 10 | { 11 | /// 12 | /// Interaction logic for CommitPanel.xaml 13 | /// 14 | public partial class CommitPanel : UserControl 15 | { 16 | public CommitPanel() 17 | { 18 | InitializeComponent(); 19 | } 20 | 21 | private void OnRecentCommitMessagesSelectionChanged(object sender, SelectionChangedEventArgs e) 22 | { 23 | // Retrieve elements. 24 | var recentCommitMessages = UIHelper.FindChild(this, "RecentCommitMessages"); 25 | var commitMessageBox = UIHelper.FindChild(this, "CommitMessageTextBox"); 26 | 27 | var selectedRecentCommitMessage = recentCommitMessages.SelectedItem as RecentCommitMessage; 28 | 29 | if (selectedRecentCommitMessage == null) 30 | return; 31 | 32 | // Set the commit text box value. 33 | commitMessageBox.Text = selectedRecentCommitMessage.FullMessage; 34 | commitMessageBox.Focus(); 35 | 36 | // Reset the drop down menu. 37 | recentCommitMessages.SelectedIndex = -1; 38 | } 39 | 40 | private void CommitMessageLostFocus(object sender, RoutedEventArgs e) 41 | { 42 | 43 | } 44 | 45 | private void CommitMessageGotFocus(object sender, RoutedEventArgs e) 46 | { 47 | 48 | } 49 | 50 | private void CommitPanelLoaded(object sender, RoutedEventArgs e) 51 | { 52 | // Find elements. 53 | var commitButton = UIHelper.FindChild 73 | 74 | 75 | 76 | 77 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /UserControls/Dialogs/ConfirmDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Collections.ObjectModel; 4 | using System.ComponentModel; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Input; 8 | using System.Windows.Media.Effects; 9 | using System.Windows.Threading; 10 | 11 | namespace GG.UserControls.Dialogs 12 | { 13 | /// 14 | /// Interaction logic for ConfirmDialog.xaml 15 | /// 16 | public partial class ConfirmDialog : Window 17 | { 18 | public struct ButtonsSet 19 | { 20 | /// 21 | /// The OK-Cancel button set. 22 | /// 23 | public const int OK_CANCEL = 1; 24 | 25 | public const int OK = 2; 26 | }; 27 | 28 | public ConfirmDialog() : base() 29 | { 30 | InitializeComponent(); 31 | 32 | Application.Current.MainWindow.Effect = new BlurEffect 33 | { 34 | Radius = 3 35 | }; 36 | 37 | Closing += OnClosing; 38 | 39 | Application.Current.Dispatcher.BeginInvoke( 40 | DispatcherPriority.Loaded, 41 | (Action) (InvalidateVisual) 42 | ); 43 | 44 | DataContext = this; 45 | 46 | if (Buttons == null) 47 | ButtonSet = ButtonsSet.OK_CANCEL; 48 | } 49 | 50 | /// 51 | /// List of buttons to display to the user. 52 | /// 53 | /// After the dialog has closed, the pressed button can be retrieved from PressedButton. 54 | /// 55 | private ObservableCollection 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 77 | 78 | 79 | 80 | 81 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /UserControls/Dialogs/PromptDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Effects; 14 | using System.Windows.Media.Imaging; 15 | using System.Windows.Navigation; 16 | using System.Windows.Shapes; 17 | using System.Windows.Threading; 18 | 19 | namespace GG.UserControls.Dialogs 20 | { 21 | /// 22 | /// Interaction logic for PromptDialog.xaml 23 | /// 24 | public partial class PromptDialog : Window 25 | { 26 | public PromptDialog() : base() 27 | { 28 | InitializeComponent(); 29 | 30 | Application.Current.MainWindow.Effect = new BlurEffect 31 | { 32 | Radius = 3 33 | }; 34 | 35 | Closing += OnClosing; 36 | 37 | ResponseTextBox.Focus(); 38 | 39 | Application.Current.Dispatcher.BeginInvoke( 40 | DispatcherPriority.Loaded, 41 | (Action) (InvalidateVisual) 42 | ); 43 | } 44 | 45 | public string ResponseText 46 | { 47 | get { return ResponseTextBox.Text; } 48 | set { ResponseTextBox.Text = value; } 49 | } 50 | 51 | public string Message 52 | { 53 | get { return MessageBlock.Text; } 54 | set { MessageBlock.Text = value; } 55 | } 56 | 57 | private void CloseSuccessfully() 58 | { 59 | DialogResult = true; 60 | Close(); 61 | } 62 | 63 | private void Ok_Click(object sender, RoutedEventArgs e) 64 | { 65 | CloseSuccessfully(); 66 | } 67 | 68 | private void Close_Click(object sender, RoutedEventArgs e) 69 | { 70 | Close(); 71 | } 72 | 73 | /// 74 | /// Fired upon window closing. 75 | /// 76 | /// 77 | /// 78 | void OnClosing(object sender, CancelEventArgs e) 79 | { 80 | Application.Current.MainWindow.Effect = null; 81 | } 82 | 83 | private void ResponseTextBox_PreviewKeyDown(object sender, KeyEventArgs e) 84 | { 85 | if (e.Key == Key.Enter) 86 | { 87 | e.Handled = true; 88 | CloseSuccessfully(); 89 | } 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /UserControls/DiffPanel.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 18 | 19 | -------------------------------------------------------------------------------- /UserControls/DiffPanel.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Controls; 3 | 4 | namespace GG.UserControls 5 | { 6 | /// 7 | /// Interaction logic for DiffPanel.xaml 8 | /// 9 | public partial class DiffPanel : UserControl 10 | { 11 | public DiffPanel() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /UserControls/LeftToolbar.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | BRANCHES 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 41 | 42 | 43 | TAGS 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | REMOTES 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | STASHES 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | SUBMODULES 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /UserControls/LeftToolbar.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using System.Windows.Input; 4 | using System.Windows.Media; 5 | 6 | namespace GG.UserControls 7 | { 8 | /// 9 | /// Interaction logic for LeftToolbar.xaml 10 | /// 11 | public partial class LeftToolbar : UserControl 12 | { 13 | public LeftToolbar() 14 | { 15 | InitializeComponent(); 16 | } 17 | 18 | private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) 19 | { 20 | var treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); 21 | 22 | if (treeViewItem != null) 23 | { 24 | treeViewItem.Focus(); 25 | e.Handled = true; 26 | } 27 | } 28 | 29 | static TreeViewItem VisualUpwardSearch(DependencyObject source) 30 | { 31 | while (source != null && !(source is TreeViewItem)) 32 | source = VisualTreeHelper.GetParent(source); 33 | 34 | return source as TreeViewItem; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /UserControls/LeftToolbarContextMenus/TagContextMenu.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /UserControls/LeftToolbarContextMenus/TagContextMenu.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | using GG.Models; 3 | 4 | namespace GG.UserControls.LeftToolbarContextMenus 5 | { 6 | /// 7 | /// Interaction logic for ChangesetHistoryContextMenu.xaml 8 | /// 9 | public partial class TagContextMenu : ContextMenu 10 | { 11 | public TagContextMenu() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | /// 17 | /// Returns the current repository view model instance being used. 18 | /// 19 | /// 20 | private RepositoryViewModel GetRepositoryViewModel() 21 | { 22 | return ((DataGrid) PlacementTarget).DataContext as RepositoryViewModel; 23 | } 24 | 25 | /// 26 | /// Preprocessing prior to menu opening. 27 | /// 28 | /// 29 | /// 30 | private void OnOpened(object sender, System.Windows.RoutedEventArgs e) 31 | { 32 | } 33 | 34 | private void OnContextMenuOpening(object sender, ContextMenuEventArgs e) 35 | { 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /UserControls/MainMenu.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /UserControls/MainMenu.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using GG.Libraries; 4 | 5 | namespace GG.UserControls 6 | { 7 | /// 8 | /// Interaction logic for MainMenu.xaml 9 | /// 10 | public partial class MainMenu : UserControl 11 | { 12 | public MainMenu() 13 | { 14 | InitializeComponent(); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /UserControls/MenuButton.cs: -------------------------------------------------------------------------------- 1 | namespace GG.UserControls 2 | { 3 | /// 4 | /// Implements a "menu button" for WPF. 5 | /// 6 | public class MenuButton : SplitButton 7 | { 8 | /// 9 | /// Initializes a new instance of the MenuButton class. 10 | /// 11 | public MenuButton() 12 | { 13 | DefaultStyleKey = typeof(MenuButton); 14 | } 15 | 16 | /// 17 | /// Called when the button is clicked. 18 | /// 19 | protected override void OnClick() 20 | { 21 | OpenButtonMenu(); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /UserControls/NewTabPage.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | Recent repositories: 14 | 15 | 16 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 46 | 47 | 48 | 54 | 60 | 66 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /UserControls/NewTabPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Windows; 4 | using System.Windows.Controls; 5 | using WinForms = System.Windows.Forms; 6 | using System.Windows.Input; 7 | using GG.Libraries; 8 | using GG.UserControls.Dialogs; 9 | 10 | namespace GG.UserControls 11 | { 12 | /// 13 | /// Interaction logic for NewTabPage.xaml 14 | /// 15 | public partial class NewTabPage : UserControl 16 | { 17 | public NewTabPage() 18 | { 19 | InitializeComponent(); 20 | } 21 | 22 | /// 23 | /// Fired upon double clicking the list view. 24 | /// 25 | /// 26 | /// 27 | void OnMouseDoubleClick(object sender, MouseButtonEventArgs e) 28 | { 29 | var item = (RepositoryViewModel) ((FrameworkElement) e.OriginalSource).DataContext; 30 | 31 | if (item == null) 32 | return; 33 | 34 | // Find the tab contrl. 35 | var repositoryTabs = UIHelper.FindChild(Application.Current.MainWindow, "RepositoryTabs"); 36 | 37 | // The user double clicked one of the recent repositories. 38 | var mainWindowViewModel = (MainWindowViewModel) Application.Current.MainWindow.DataContext; 39 | 40 | // Skip if the repository is already opened. 41 | if (mainWindowViewModel.RepositoryViewModels.Contains(item)) 42 | { 43 | repositoryTabs.SelectedItem = item; 44 | return; 45 | } 46 | 47 | // Load the repository. 48 | item.NotOpened = false; 49 | item.Init(); 50 | 51 | // Open the tab. 52 | mainWindowViewModel.RepositoryViewModels.Add(item); 53 | repositoryTabs.SelectedItem = item; 54 | } 55 | 56 | /// 57 | /// Fired upon pressing Open Local Repository. 58 | /// 59 | /// 60 | /// 61 | private void OnOpenLocalRepository(object sender, RoutedEventArgs e) 62 | { 63 | var dialog = new WinForms.FolderBrowserDialog 64 | { 65 | ShowNewFolderButton = false 66 | }; 67 | 68 | dialog.ShowDialog(); 69 | 70 | // Open the selected repository, if possible. 71 | if (!String.IsNullOrEmpty(dialog.SelectedPath)) 72 | { 73 | if (OpenNewRepository(dialog.SelectedPath) == false) 74 | MessageBox.Show(String.Format("Could not open \"{0}\". Are you sure it is an existing Git repository?", dialog.SelectedPath)); 75 | } 76 | 77 | dialog.Dispose(); 78 | } 79 | 80 | /// 81 | /// Fired upon pressing Create Local Repository. 82 | /// 83 | /// 84 | /// 85 | private void OnCreateLocalRepository(object sender, RoutedEventArgs e) 86 | { 87 | var dialog = new WinForms.FolderBrowserDialog 88 | { 89 | Description = "Create and choose the folder for your new repository." 90 | }; 91 | 92 | dialog.ShowDialog(); 93 | 94 | // Open the selected folder if possible. 95 | if (!String.IsNullOrEmpty(dialog.SelectedPath)) 96 | { 97 | LibGit2Sharp.Repository.Init(dialog.SelectedPath).Dispose(); 98 | 99 | if (OpenNewRepository(dialog.SelectedPath) == false) 100 | MessageBox.Show(String.Format("Something went wrong with the creation of the new repository. Try again.")); 101 | } 102 | 103 | dialog.Dispose(); 104 | } 105 | 106 | /// 107 | /// A helper method for opening a new repository for the given path. 108 | /// 109 | /// This will bring up a question regarding the name to use and initialize the repository view model and load it up in the tab control. 110 | /// 111 | /// 112 | /// 113 | private bool OpenNewRepository(string path) 114 | { 115 | var repository = new RepositoryViewModel 116 | { 117 | NotOpened = false, 118 | RepositoryFullPath = path 119 | }; 120 | 121 | // Try loading the repository information and see if it worked. 122 | var result = repository.Init(); 123 | if (result) 124 | { 125 | var mainWindowViewModel = (MainWindowViewModel) Application.Current.MainWindow.DataContext; 126 | 127 | // Ask the user for the Name. 128 | var nameDialog = new PromptDialog 129 | { 130 | ResponseText = repository.RepositoryFullPath.Split(System.IO.Path.DirectorySeparatorChar).Last(), 131 | Message = "Give a name for this repository:", 132 | Title = "Information needed" 133 | }; 134 | 135 | repository.Name = nameDialog.ShowDialog() == true ? nameDialog.ResponseText : repository.RepositoryFullPath; 136 | 137 | // Open the repository and display it visually. 138 | mainWindowViewModel.RepositoryViewModels.Add(repository); 139 | mainWindowViewModel.RecentRepositories.Add(repository); 140 | 141 | repository.SetThisRepositoryAsTheActiveTab(); 142 | } 143 | else 144 | { 145 | return false; 146 | } 147 | 148 | return true; 149 | } 150 | 151 | private void NewTabPageLoaded(object sender, RoutedEventArgs e) 152 | { 153 | RecentRepositoriesList.Focus(); 154 | } 155 | } 156 | } -------------------------------------------------------------------------------- /UserControls/Panel.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /UserControls/Panel.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | 4 | namespace GG.UserControls 5 | { 6 | /// 7 | /// Interaction logic for Panel.xaml 8 | /// 9 | public partial class Panel : UserControl 10 | { 11 | #region Header property. 12 | /// 13 | /// The text or content to use for the header. 14 | /// 15 | public object Header 16 | { 17 | get { return (object) GetValue(HeaderProperty); } 18 | set { SetValue(HeaderProperty, value); } 19 | } 20 | 21 | public static DependencyProperty HeaderProperty = DependencyProperty.Register("Header", 22 | typeof(object), 23 | typeof(Panel), 24 | new PropertyMetadata(null)); 25 | 26 | private static void HeaderPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 27 | { 28 | var control = d as Panel; 29 | if (control != null) 30 | { 31 | control.Header = (object) e.NewValue; 32 | } 33 | } 34 | #endregion 35 | 36 | #region Body property. 37 | /// 38 | /// The text or content to use for the body. 39 | /// 40 | public object Body 41 | { 42 | get { return (object) GetValue(BodyProperty); } 43 | set { SetValue(BodyProperty, value); } 44 | } 45 | 46 | public static DependencyProperty BodyProperty = DependencyProperty.Register("Body", 47 | typeof(object), 48 | typeof(Panel), 49 | new PropertyMetadata(null)); 50 | 51 | private static void BodyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 52 | { 53 | var control = d as Panel; 54 | if (control != null) 55 | { 56 | control.Body = (object) e.NewValue; 57 | } 58 | } 59 | #endregion 60 | 61 | #region Header buttons property. 62 | /// 63 | /// The text or content to use for the header buttons. 64 | /// 65 | public object HeaderButtons 66 | { 67 | get { return (object) GetValue(HeaderButtonsProperty); } 68 | set { SetValue(HeaderButtonsProperty, value); } 69 | } 70 | 71 | public static DependencyProperty HeaderButtonsProperty = DependencyProperty.Register("HeaderButtons", 72 | typeof(object), 73 | typeof(Panel), 74 | new PropertyMetadata(null)); 75 | 76 | private static void HeaderButtonsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) 77 | { 78 | var control = d as Panel; 79 | if (control != null) 80 | { 81 | control.HeaderButtons = (object) e.NewValue; 82 | } 83 | } 84 | #endregion 85 | 86 | public Panel() 87 | { 88 | InitializeComponent(); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /UserControls/StatusGrid.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using System.Windows.Controls; 3 | using GG.Libraries; 4 | 5 | namespace GG.UserControls 6 | { 7 | /// 8 | /// Interaction logic for StatusGrid.xaml 9 | /// 10 | public partial class StatusGrid : UserControl 11 | { 12 | public StatusGrid() 13 | { 14 | InitializeComponent(); 15 | } 16 | 17 | private void StatusGridSelectionChanged(object sender, SelectionChangedEventArgs e) 18 | { 19 | // Retrieve repository view model. 20 | var repositoryTabs = UIHelper.FindChild(Application.Current.MainWindow, "RepositoryTabs"); 21 | var repositoryViewModel = repositoryTabs.SelectedItem as RepositoryViewModel; 22 | var dataGrid = (DataGrid) sender; 23 | 24 | // Tell repository view model to update status item diff. 25 | if (repositoryViewModel != null) 26 | repositoryViewModel.UpdateStatusItemDiff(dataGrid.SelectedItems); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /UserControls/StatusGridContextMenu.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 121 | 122 | 123 | 124 | 125 | 126 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /UserControls/StatusGridContextMenu.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Windows; 4 | using System.Collections; 5 | using System.Linq; 6 | using System.Windows.Controls; 7 | using GG.Libraries; 8 | using GG.Models; 9 | using System.Collections.Generic; 10 | 11 | namespace GG.UserControls 12 | { 13 | /// 14 | /// Interaction logic for StatusGridContextMenu.xaml 15 | /// 16 | public partial class StatusGridContextMenu : ContextMenu 17 | { 18 | public StatusGridContextMenu() 19 | { 20 | InitializeComponent(); 21 | } 22 | 23 | /// 24 | /// Preprocessing prior to menu opening. 25 | /// 26 | /// 27 | /// 28 | private void OnOpened(object sender, System.Windows.RoutedEventArgs e) 29 | { 30 | HandleStageUnstageMenuItems(); 31 | HandleDeleteMenuItem(); 32 | } 33 | 34 | /// 35 | /// Shows and hides Stage and Unstage menu items accordingly to what has been selected. 36 | /// 37 | private void HandleStageUnstageMenuItems() 38 | { 39 | MenuItem stage = UIHelper.FindChild(this, "Stage"); 40 | MenuItem unstage = UIHelper.FindChild(this, "Unstage"); 41 | Separator stageSeparator = UIHelper.FindChild(this, "StageSeparator"); 42 | 43 | // Retrieve some info regarding what is selected on the grid. 44 | DataGrid statusGrid = PlacementTarget as DataGrid; 45 | 46 | bool hasStagedItems = statusGrid.SelectedItems.OfType().Any(i => ((StatusItem) i).IsStaged); 47 | bool hasUnstagedItems = statusGrid.SelectedItems.OfType().Any(i => ((StatusItem) i).IsStaged == false); 48 | 49 | // Hide/show stage and unstage menu items accordingly. 50 | if (hasStagedItems && hasUnstagedItems) 51 | { 52 | stage.Visibility = Visibility.Collapsed; 53 | unstage.Visibility = Visibility.Collapsed; 54 | stageSeparator.Visibility = Visibility.Collapsed; 55 | } 56 | else 57 | { 58 | stage.Visibility = !hasStagedItems ? Visibility.Visible : Visibility.Collapsed; 59 | unstage.Visibility = hasStagedItems ? Visibility.Visible : Visibility.Collapsed; 60 | stageSeparator.Visibility = Visibility.Visible; 61 | } 62 | } 63 | 64 | /// 65 | /// Handles the disabling/enabling of the Delete menu item. 66 | /// 67 | private void HandleDeleteMenuItem() 68 | { 69 | MenuItem delete = UIHelper.FindChild(this, "Delete"); 70 | DataGrid statusGrid = PlacementTarget as DataGrid; 71 | string repositoryFullPath = ((RepositoryViewModel) statusGrid.DataContext).RepositoryFullPath; 72 | 73 | bool hasPhysicallyExistingFiles = statusGrid.SelectedItems.OfType().Any(i => File.Exists(repositoryFullPath + "/" + ((StatusItem) i).Filename)); 74 | 75 | delete.Visibility = hasPhysicallyExistingFiles ? Visibility.Visible : Visibility.Collapsed; 76 | } 77 | } 78 | } -------------------------------------------------------------------------------- /UserControls/TopToolbar.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 | 21 | 27 | 33 | 39 | 45 | 46 | 47 | 48 | 54 | 60 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /UserControls/TopToolbar.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | using GG.UserControls.Dialogs; 16 | 17 | namespace GG.UserControls 18 | { 19 | /// 20 | /// Interaction logic for TopToolbar.xaml 21 | /// 22 | public partial class TopToolbar : UserControl 23 | { 24 | public TopToolbar() 25 | { 26 | InitializeComponent(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /ViewModels/BaseViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace GG.ViewModels 5 | { 6 | /// 7 | /// A base view model that implements INotifyPropertyChanged. 8 | /// 9 | public class BaseViewModel : INotifyPropertyChanged 10 | { 11 | public event PropertyChangedEventHandler PropertyChanged; 12 | 13 | protected void RaisePropertyChanged(string propertyName) 14 | { 15 | // Take a copy to prevent thread issues. 16 | PropertyChangedEventHandler handler = PropertyChanged; 17 | if (handler != null) 18 | { 19 | handler(this, new PropertyChangedEventArgs(propertyName)); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Views/About.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 13 | 14 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Git-GUI 37 | 38 | Git-GUI is Windows only graphical user interface for Git source code management. 39 | 40 | Credits: 41 | 42 | 43 | Kai Sellgren - Author 44 | Stanislav Palatnik - Contributor 45 | 46 | 47 | Libraries used: 48 | 49 | 50 | LibGit2 51 | LibGit2Sharp 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /Views/About.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Shapes; 14 | 15 | namespace GG 16 | { 17 | /// 18 | /// Interaction logic for About.xaml 19 | /// 20 | public partial class About : Window 21 | { 22 | public About() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void CloseWindow(object sender, RoutedEventArgs e) 28 | { 29 | Close(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Views/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 35 | 36 | 37 | 38 | 39 | 40 | 43 | 46 | 49 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Views/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Windows; 5 | using System.Windows.Controls; 6 | using GG.Libraries; 7 | 8 | namespace GG 9 | { 10 | /// 11 | /// Interaction logic for MainWindow.xaml 12 | /// 13 | public partial class MainWindow : Window 14 | { 15 | public MainWindow() 16 | { 17 | InitializeComponent(); 18 | } 19 | 20 | void OnLoad(object sender, RoutedEventArgs e) 21 | { 22 | var vm = DataContext as MainWindowViewModel; 23 | Debug.Assert(vm != null, "vm != null"); 24 | vm.Load(); 25 | 26 | if (Application.Current.MainWindow.WindowState == WindowState.Maximized) 27 | HideMaximizeRestoreApplicationButton(true, false); 28 | else 29 | HideMaximizeRestoreApplicationButton(false, true); 30 | } 31 | 32 | #region Application maximize, minimize, restore and close. 33 | 34 | /// 35 | /// A helper method for showing/hiding maximize and restore buttons. 36 | /// 37 | /// 38 | /// 39 | private void HideMaximizeRestoreApplicationButton(bool hideMaximize, bool hideRestore) 40 | { 41 | var maximize = UIHelper.FindChild