/// <summary> /// Open the Shortn dialog window. Used internally after the Shortn button is pressed, and by Ribbon for the debugging /// </summary> /// <param name="data"></param> public void insertTrackChanges() { data.prepareRanges(); HumanMacroData.ReturnType type = data.type; Globals.Soylent.Application.ActiveDocument.TrackRevisions = true; Globals.Soylent.Application.ActiveDocument.ShowRevisions = true; Microsoft.Office.Core.DocumentProperties properties; properties = (Microsoft.Office.Core.DocumentProperties)Globals.Soylent.Application.ActiveDocument.BuiltInDocumentProperties; string defaultAuthor = properties["Author"].Value as string; /* * if (defaultAuthor == turkerName) * { * turkerName = turkerName + "B"; * }*/ foreach (Patch patch in data.patches) { string comment = ""; foreach (string suggestion in patch.replacements) { if (patch.replacements.IndexOf(suggestion) == 0) { if (type == HumanMacroData.ReturnType.Comment) { comment += suggestion; if (patch.replacements.Count > 1) { comment += "\n\nOther Suggestions:"; } } else { if (patch.replacements.Count > 1) { comment += "Other Suggestions:"; } } } else { comment += "\n - "; comment += suggestion; } } object commentText = comment; if (comment != "") { Microsoft.Office.Interop.Word.Comment c = Globals.Soylent.Application.ActiveDocument.Comments.Add(patch.range, commentText); c.Author = jobTurkerName; } if (type == HumanMacroData.ReturnType.SmartTag) { Globals.Soylent.Application.UserName = jobTurkerName; if (patch.replacements.Count > 0) { patch.range.Text = patch.replacements[0]; } Globals.Soylent.Application.UserName = defaultAuthor; } } /* * foreach (Microsoft.Office.Interop.Word.Comment c in Globals.Soylent.Application.ActiveDocument.Comments) * { * c.Author = jobTurkerName; * c.Initial = jobTurkerName; * } */ //this.AcceptRevisions.IsEnabled = true; //this.stages.Children.Remove(CrowdproofButton); //this.stages.Children.Add(buttons); AcceptRevisions.IsEnabled = true; RejectRevisions.IsEnabled = true; HumanMacroButton.IsEnabled = false; stub.AcceptRevisions.IsEnabled = true; stub.RejectRevisions.IsEnabled = true; stub.CrowdproofButton.IsEnabled = false; Globals.Soylent.Application.ActiveDocument.TrackRevisions = false; }
/// <summary> /// Open the Shortn dialog window. Used internally after the Shortn button is pressed, and by Ribbon for the debugging /// </summary> /// <param name="data"></param> public void insertTrackChanges(CrowdproofData data) { Globals.Soylent.Application.ActiveDocument.TrackRevisions = true; Globals.Soylent.Application.ActiveDocument.ShowRevisions = true; Microsoft.Office.Core.DocumentProperties properties; properties = (Microsoft.Office.Core.DocumentProperties)Globals.Soylent.Application.ActiveDocument.BuiltInDocumentProperties; string defaultAuthor = properties["Author"].Value as string; if (defaultAuthor == turkerName) { turkerName = turkerName + "B"; } foreach (CrowdproofPatch patch in data.patches) { string comment = ""; foreach (string reason in patch.reasons) { if (patch.reasons.IndexOf(reason) == 0) { comment += reason; } else if (patch.reasons.IndexOf(reason) == 1) { comment += "\n\nOther Explanations:"; comment += "\n - "; comment += reason; } else { comment += "\n - "; comment += reason; } } foreach (string suggestion in patch.replacements) { if (patch.replacements.IndexOf(suggestion) == 0) { if (patch.replacements.Count > 1) { comment += "\n\nOther Suggestions:"; } } else { comment += "\n - "; comment += suggestion; } } object commentText = comment; Microsoft.Office.Interop.Word.Comment c = Globals.Soylent.Application.ActiveDocument.Comments.Add(patch.range, commentText); c.Author = jobTurkerName; Globals.Soylent.Application.UserName = jobTurkerName; patch.range.Text = patch.replacements[0]; Globals.Soylent.Application.UserName = defaultAuthor; } /* * foreach (Microsoft.Office.Interop.Word.Comment c in Globals.Soylent.Application.ActiveDocument.Comments) * { * c.Author = jobTurkerName; * c.Initial = jobTurkerName; * } */ //this.AcceptRevisions.IsEnabled = true; //this.stages.Children.Remove(CrowdproofButton); //this.stages.Children.Add(buttons); AcceptRevisions.IsEnabled = true; RejectRevisions.IsEnabled = true; CrowdproofButton.IsEnabled = false; stub.AcceptRevisions.IsEnabled = true; stub.RejectRevisions.IsEnabled = true; stub.CrowdproofButton.IsEnabled = false; Globals.Soylent.Application.ActiveDocument.TrackRevisions = false; }