/// <summary> /// This constructor used only when recreating a job from XML saved with a document /// </summary> /// <param name="data"></param> /// <param name="jobNumber"></param> public HumanMacroJob(HumanMacroData data, int jobNumber, bool startTurk) { this.data = data; this.jobNumber = jobNumber; HITView hit = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].addHIT(HIT_TYPE, data, jobNumber); hit.addStage(1, HITData.ResultType.Macro, data.macroStageData, "Running Macro", 10, 0.10, jobNumber); if (startTurk) { data.startTask(); } }
/// <summary> /// This constructor used only when recreating a job from XML saved with a document /// </summary> /// <param name="data"></param> /// <param name="jobNumber"></param> public HumanMacroJob(HumanMacroData data, int jobNumber, bool startTurk) { this.data = data; this.jobNumber = jobNumber; HITView hit = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].addHIT(HIT_TYPE, data, jobNumber); hit.addStage(1, HITData.ResultType.Macro, data.macroStageData, "Running Macro", 10, 0.10, jobNumber); if (startTurk) { data.startTask(); } }
/// <summary> /// The Model for a Crowdproof job. This creates the View elements for this task /// </summary> /// <param name="data">The CrowdproofData instance for this job</param> /// <param name="jobNumber">The unique job number</param> //public HumanMacroJob(HumanMacroData data, int jobNumber) //public HumanMacroJob(int jobNumber, Microsoft.Office.Interop.Word.Range range) public HumanMacroJob(Microsoft.Office.Interop.Word.Range toShorten, int job, HumanMacroData.Separator separator, double reward, int redundancy, string title, string subtitle, string instructions, HumanMacroData.ReturnType type, HumanMacroData.TestOrReal test) { //this.data = data; this.jobNumber = job; Globals.Soylent.jobToDoc[jobNumber] = Globals.Soylent.Application.ActiveDocument; this.data = new HumanMacroData(toShorten, job, separator, reward, redundancy, title, subtitle, instructions, type, test); HITView hit = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].addHIT(HIT_TYPE, data, jobNumber); hit.addStage(1, HITData.ResultType.Macro, data.macroStageData, "Running Macro", 10, 0.10, jobNumber); //hit.addStage(2, HITData.ResultType.Fix, "Fix Errors", 5, 0.05); //hit.addStage(3, HITData.ResultType.Verify, "Quality Control", 5, 0.05); data.startTask(); }
/// <summary> /// The Model for a Crowdproof job. This creates the View elements for this task /// </summary> /// <param name="data">The CrowdproofData instance for this job</param> /// <param name="jobNumber">The unique job number</param> //public HumanMacroJob(HumanMacroData data, int jobNumber) //public HumanMacroJob(int jobNumber, Microsoft.Office.Interop.Word.Range range) public HumanMacroJob(Microsoft.Office.Interop.Word.Range toShorten, int job, HumanMacroData.Separator separator, double reward, int redundancy, string title, string subtitle, string instructions, HumanMacroData.ReturnType type, HumanMacroData.TestOrReal test) { //this.data = data; this.jobNumber = job; Globals.Soylent.jobToDoc[jobNumber] = Globals.Soylent.Application.ActiveDocument; this.data = new HumanMacroData(toShorten, job, separator, reward, redundancy, title, subtitle, instructions, type, test); HITView hit = Globals.Soylent.soylentMap[Globals.Soylent.Application.ActiveDocument].addHIT(HIT_TYPE, data, jobNumber); hit.addStage(1, HITData.ResultType.Macro, data.macroStageData, "Running Macro", 10, 0.10, jobNumber); //hit.addStage(2, HITData.ResultType.Fix, "Fix Errors", 5, 0.05); //hit.addStage(3, HITData.ResultType.Verify, "Quality Control", 5, 0.05); data.startTask(); }
/// <summary> /// HITView subclass specific to Shortn tasks. This adds the Shortn button and additional necessary functionality. /// </summary> /// <param name="workType"></param> /// <param name="data"></param> public HumanMacroView(string workType, HumanMacroData data, int job) : base(workType, data, job) { //Globals.Soylent.soylent.Controls.Add(new System.Windows.Forms.Button()); HumanMacroButton = new Button(); HumanMacroButton.Content = "View Revisions"; HumanMacroButton.Name = "HumanMacro"; HumanMacroButton.Height = 23; //CrowdproofButton.Width = 90; HumanMacroButton.IsEnabled = false; HumanMacroButton.Click += new RoutedEventHandler(HumanMacro_Clicked); AcceptRevisions = new Button(); AcceptRevisions.Content = "Accept All"; AcceptRevisions.Name = "AcceptRevisions"; AcceptRevisions.Height = 23; AcceptRevisions.Width = 100; AcceptRevisions.IsEnabled = false; AcceptRevisions.Click += new RoutedEventHandler(AcceptRevisions_Clicked); RejectRevisions = new Button(); RejectRevisions.Content = "Reject All"; RejectRevisions.Name = "RejectRevisions"; RejectRevisions.Height = 23; RejectRevisions.Width = 100; RejectRevisions.IsEnabled = false; RejectRevisions.Click += new RoutedEventHandler(RejectRevisions_Clicked); buttons = new StackPanel(); buttons.Orientation = System.Windows.Controls.Orientation.Horizontal; buttons.Children.Add(AcceptRevisions); buttons.Children.Add(RejectRevisions); stages.Children.Add(HumanMacroButton); stages.Children.Add(buttons); this.data = data; data.register(this); jobTurkerName = turkerName + job; }
private void button5_Click(object sender, RibbonControlEventArgs e) { //fake p = new fake(); //HITData p = new HITData(); //ShortnData p = ShortnData.getCannedData(); /* TurKitSocKit.TurKitFindFixVerify tks = new TurKitSocKit.TurKitFindFixVerify(); //TurKitSocKit.TurKitFindFixVerifyOption tks = new TurKitSocKit.TurKitFindFixVerifyOption(); tks.job = 3; tks.paragraph = 2; tks.patches = new List<TurKitSocKit.TurKitFindFixVerifyPatch>(); */ //Sample tks = new Sample(); //tks.list.Add(2); //tks.list.Add(3); HumanMacroData tks = new HumanMacroData(); XmlSerializer x = new XmlSerializer(tks.GetType()); StringWriter sw = new StringWriter(); x.Serialize(sw, tks); string a = sw.ToString(); Debug.Write(a); /* CrowdproofData p = CrowdproofData.getCannedData(); XmlSerializer x = new XmlSerializer(p.GetType()); StringWriter sw = new StringWriter(); x.Serialize(sw, p); string a = sw.ToString(); Debug.Write(a); Microsoft.Office.Core.CustomXMLPart employeeXMLPart = Globals.Soylent.Application.ActiveDocument.CustomXMLParts.Add(a); */ /* string s = ""; foreach (Microsoft.Office.Core.CustomXMLPart cus in Globals.Soylent.Application.ActiveDocument.CustomXMLParts) { s = cus.XML; } XmlSerializer y = new XmlSerializer(p.GetType()); //StringReader sr = new StringReader(a); StringReader sr = new StringReader(s); XmlReader z = XmlReader.Create(sr); object obj = y.Deserialize(z); CrowdproofData q = obj as CrowdproofData; Word.Bookmark b = Globals.Soylent.Application.ActiveDocument.Bookmarks["Soylent" + q.job]; q.range = b.Range; */ }