/// <summary> /// Prompt for the Amazon Keys /// </summary> /// <param name="callback">A callback if we got keys</param> /// <param name="cancel">A callback if the user didn't provide keys</param> public void AskForKeys(TurKit.startTaskDelegate callback, TurKit.noKeysDelegate cancel) { Amazon amazon = new Amazon(); Window amazonWindow = new Window { Title = "Amazon Keys", Content = amazon, SizeToContent = SizeToContent.WidthAndHeight, ResizeMode = ResizeMode.NoResize }; amazon.okButton.Click += (sender, e) => { AmazonKeys keys = new AmazonKeys(); keys.amazonID = amazon.accessKey.Text; keys.secretKey = amazon.secretKey.Text; if (callback != null) { callback(keys); } amazonWindow.Close(); }; amazon.cancelButton.Click += (sender, e) => { if (cancel != null) { cancel(); } }; amazonWindow.ShowDialog(); }
/// <summary> /// Start the task on the TurKit isntance tied to this job /// </summary> public void startTask() { TurKit.noKeysDelegate cancel = () => { this.view.RemoveHITVIew(); }; tk.startTask(cancel); }
/// <summary> /// Reads in the AMT secret and key from the amazon.xml file so that HITs can be submitted. /// </summary> public static void AskForAmazonKeys(TurKit.startTaskDelegate success, TurKit.noKeysDelegate cancel) { AmazonKeys keys = LoadAmazonKeys(); if (keys == null) { Globals.Ribbons.Ribbon.AskForKeys(success, cancel); } else { success(keys); } }