/// <summary> /// Performs adding documents to source control</summary> /// <param name="doing">True iff doing the command</param> /// <returns>True iff any documents added or can be added</returns> protected virtual bool DoAdd(bool doing) { if (SourceControlService == null || !SourceControlService.Enabled || SourceControlContext == null) { return(false); } int addedCount = 0; foreach (IResource resource in SourceControlContext.Resources) { SourceControlStatus status = GetStatus(resource); if (status != SourceControlStatus.NotControlled && status != SourceControlStatus.FileDoesNotExist) { return(false); } addedCount++; if (doing) { SourceControlService.Add(resource.Uri); } } return(addedCount != 0); }
private void documentService_DocumentSaved(object sender, DocumentEventArgs e) { if (SourceControlService == null) { return; } if (RefreshStatusOnSave) { SourceControlService.RefreshStatus(e.Document.Uri); } if (e.Kind != DocumentEventType.SavedAs) { return; } if (SourceControlService.GetStatus(e.Document.Uri) == SourceControlStatus.NotControlled) { string message = string.Format("Add document {0} to version control?".Localize(), e.Document.Uri.AbsolutePath); DialogResult result = MessageBox.Show(GetDialogOwner(), message, "Add document to Version Control".Localize(), MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { SourceControlService.Add(e.Document.Uri); } } }
private void documentService_DocumentSaved(object sender, DocumentEventArgs e) { if (e.Kind != DocumentEventType.SavedAs || SourceControlService == null) { return; } if (SourceControlService.GetStatus(e.Document.Uri) == SourceControlStatus.NotControlled) { string message = "Add document ".Localize() + e.Document.Uri.AbsolutePath + " to version control?".Localize(); var result = MessageBoxes.Show(message, " Add document to Version Control".Localize(), MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { SourceControlService.Add(e.Document.Uri); } } }
private void documentService_DocumentSaved(object sender, DocumentEventArgs e) { if (e.Kind != DocumentEventType.SavedAs || SourceControlService == null) { return; } if (SourceControlService.GetStatus(e.Document.Uri) == SourceControlStatus.NotControlled) { string message = string.Format("Add document {0} to version control?".Localize(), e.Document.Uri.AbsolutePath); var result = MessageBoxes.Show(message, "Add Document to Version Control".Localize("this is the title of a dialog box that is asking a question"), MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { SourceControlService.Add(e.Document.Uri); } } }