private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.Style = (Style)Resources["GradientStyle"];
GitBash.GitExePath = GitSccOptions.Current.GitBashPath;
GitBash.UseUTF8FileNames = !GitSccOptions.Current.NotUseUTF8FileNames;
if (!GitBash.Exists) GitBash.GitExePath = TryFindFile(new string[] {
@"C:\Program Files\Git\bin\sh.exe",
@"C:\Program Files (x86)\Git\bin\sh.exe",
});
//this.gitConsole.GitExePath = GitBash.GitExePath;
//this.rootGrid.RowDefinitions[0].Height = new GridLength(this.ActualHeight - 60);
this.gitViewModel = GitViewModel.Current;
//this.bottomToolBar.GitViewModel = GitViewModel.Current;
if (gitViewModel.Tracker.HasGitRepository)
this.Title = gitViewModel.Tracker.GitWorkingDirectory;
this.gitViewModel.GraphChanged += (o, reload) =>
{
// show loading sign immediately
////Action a = () => loading.Visibility = Visibility.Visible;
////this.Dispatcher.BeginInvoke(a, DispatcherPriority.Render);
loading.Visibility = Visibility.Visible;
Action act = () =>
{
if (gitViewModel.Tracker.HasGitRepository)
{
this.txtRepo.Text = gitViewModel.Tracker.GitWorkingDirectory;
this.txtPrompt.Text = GitIntellisenseHelper.GetPrompt();
}
this.graph.Show(gitViewModel.Tracker, reload != null);
this.pendingChanges.Refresh(gitViewModel.Tracker);
};
this.Dispatcher.BeginInvoke(act, DispatcherPriority.ApplicationIdle);
};
this.gitViewModel.Refresh(true);
Action a1 = () => this.WindowState = WindowState.Maximized;
this.Dispatcher.BeginInvoke(a1, DispatcherPriority.ApplicationIdle);
var optionSet = new OptionSet()
{
{"c|commit", "show commit UI", v => {
if (!string.IsNullOrWhiteSpace(v))
{
Action act = () => HistoryViewCommands.PendingChanges.Execute(null, this);
this.Dispatcher.BeginInvoke(act, DispatcherPriority.ApplicationIdle);
}
} },
};
optionSet.Parse(Environment.GetCommandLineArgs());
}