Beispiel #1
0
        /// <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();
        }
Beispiel #2
0
 private void hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
 {
     Amazon.NavigateToUrl(((Hyperlink)sender).NavigateUri.ToString());
     e.Handled = true;
 }