private void GitCommitDialog_Loaded(object sender, RoutedEventArgs e) { string defaultText = null; if (AppModel.Configuration.Git.GitCommitBehavior == GitCommitBehaviors.CommitAndPush) { ButtonCommitAndPush.IsDefault = true; ButtonCommitAndPush.FontWeight = FontWeight.FromOpenTypeWeight(600); ButtonCommit.Opacity = 0.6; defaultText = "commit and push"; } else { ButtonCommit.IsDefault = true; ButtonCommit.FontWeight = FontWeight.FromOpenTypeWeight(600); ButtonCommitAndPush.Opacity = 0.6; defaultText = "commit"; } CommitModel.GetRepositoryChanges(); DataContext = CommitModel; ShowStatus($"Press Ctrl-Enter to quickly {defaultText}.", 8000); TextCommitMessage.Focus(); }
private void GitCommitDialog_Loaded(object sender, RoutedEventArgs e) { CommitModel.GitHelper.OpenRepository(CommitModel.Filename); CommitModel.Repository = CommitModel.GitHelper.Repository; // Check if a remote exists and disable push if not CommitModel.Remote = CommitModel.GitHelper.Repository.Network.Remotes?.FirstOrDefault()?.Name; if (CommitModel.Remote == null) { ButtonCommitAndPush.IsEnabled = false; ButtonOpenRemote.IsEnabled = false; AppModel.Configuration.Git.GitCommitBehavior = GitCommitBehaviors.Commit; } // get the main branch CommitModel.Branch = CommitModel.GitHelper.Repository?.Head?.FriendlyName; string defaultText = null; if (AppModel.Configuration.Git.GitCommitBehavior == GitCommitBehaviors.CommitAndPush) { ButtonCommitAndPush.IsDefault = true; ButtonCommitAndPush.FontWeight = FontWeight.FromOpenTypeWeight(600); defaultText = "commit and push"; var panel = ButtonCommitAndPush.Parent as ToolBar; // move to first position panel.Items.Remove(ButtonCommitAndPush); panel.Items.Insert(0, ButtonCommitAndPush); } else { ButtonCommit.IsDefault = true; ButtonCommit.FontWeight = FontWeight.FromOpenTypeWeight(600); defaultText = "commit"; } CommitModel.GetRepositoryChanges(); DataContext = CommitModel; StatusBar.ShowStatus($"Press Ctrl-Enter to quickly {defaultText}.", 8000); TextCommitMessage.Focus(); }