static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var args = Environment.GetCommandLineArgs(); string fileToEdit; if (args.Length > 1) { fileToEdit = args[1]; } else { var dialog = new OpenFileDialog(); var result = dialog.ShowDialog(); if (result == DialogResult.OK) { fileToEdit = dialog.FileName; } else { return; } } var masterCommit = new VCSCommit(); Application.Run(new TextTableEditor(new NDSExternalFile(null, 0, fileToEdit, fileToEdit), masterCommit)); }
public CreateCommitForm(VCSCommit commit, CommitFormMode mode) { CommitViewing = commit; InitializeComponent(); foreach (var change in commit.Changes) { changedFilesListBox.Items.Add(change); } commitNameTextBox.Text = commit.Name; commitDescriptionTextBox.Text = commit.Description; createCommitButton.Text = mode switch { CommitFormMode.CreateCommit => "Accept And Create Commit", CommitFormMode.EditCommit => "Accept And Edit Commit", _ => throw new System.NotImplementedException() }; this.Text = mode switch { CommitFormMode.CreateCommit => "Create New Commit...", CommitFormMode.EditCommit => "Edit Commit...", _ => throw new System.NotImplementedException() }; AcceptButton = createCommitButton; commitTimeLabel.Text = commit.Time switch { null => "Not yet committed", _ => $"{commit.Time?.ToLongTimeString()} - {commit.Time?.ToLongDateString()}" }; }