Example #1
0
        private void btnTinyPicLogin_Click(object sender, EventArgs e)
        {
            string username = txtTinyPicUsername.Text;
            string password = txtTinyPicPassword.Text;

            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                try
                {
                    TinyPicUploader tpu = new TinyPicUploader(APIKeys.TinyPicID, APIKeys.TinyPicKey);
                    string          registrationCode = tpu.UserAuth(username, password);

                    if (!string.IsNullOrEmpty(registrationCode))
                    {
                        Config.TinyPicRegistrationCode = registrationCode;
                        MessageBox.Show("Login successful.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Login failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    DebugHelper.WriteException(ex);
                    MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
 public static void UpdateTinyPicRegCode()
 {
     if (Uploader.ProxySettings != null && Engine.ConfigWorkflow != null)
     {
         try
         {
             if (Engine.ConfigUploaders.TinyPicRememberUserPass &&
                 !string.IsNullOrEmpty(Engine.ConfigUploaders.TinyPicUsername) &&
                 !string.IsNullOrEmpty(Engine.ConfigUploaders.TinyPicPassword))
             {
                 var tpu     = new TinyPicUploader(Engine.ConfigUI.ApiKeysConfig.TinyPicID, Engine.ConfigUI.ApiKeysConfig.TinyPicKey, AccountType.User);
                 var regCode = tpu.UserAuth(Engine.ConfigUploaders.TinyPicUsername,
                                            Engine.ConfigUploaders.TinyPicPassword);
                 if (Engine.ConfigUploaders.TinyPicRegistrationCode != regCode)
                 {
                     DebugHelper.WriteLine(string.Format("Updated TinyPic Shuk from {0} to {1}", Engine.ConfigUploaders.TinyPicRegistrationCode, regCode));
                     Engine.ConfigUploaders.TinyPicRegistrationCode = regCode;
                 }
             }
         }
         catch (Exception ex)
         {
             DebugHelper.WriteException(ex, "error while trying to update TinyPic registration code.");
         }
     }
 }
 /// <summary>
 /// Method to update TinyPic Shuk; Run periodically
 /// </summary>
 public static void UpdateTinyPicShuk()
 {
     if (Engine.conf.RememberTinyPicUserPass && !string.IsNullOrEmpty(Engine.conf.TinyPicUserName) &&
         !string.IsNullOrEmpty(Engine.conf.TinyPicPassword))
     {
         TinyPicUploader tpu  = new TinyPicUploader(Engine.TINYPIC_ID, Engine.TINYPIC_KEY);
         string          shuk = tpu.UserAuth(Engine.conf.TinyPicUserName, Engine.conf.TinyPicPassword);
         if (!string.IsNullOrEmpty(shuk))
         {
             if (Engine.conf.TinyPicShuk != shuk)
             {
                 FileSystem.AppendDebug(string.Format("Updated TinyPic Shuk from {0} to {1}", Engine.conf.TinyPicShuk, shuk));
             }
             Engine.conf.TinyPicShuk = shuk;
         }
     }
 }
        public static string GetTinyPicShuk()
        {
            UserPassBox ub = new UserPassBox("Enter TinyPic Email Address and Password", string.IsNullOrEmpty(Engine.conf.TinyPicUserName) ? "*****@*****.**" : Engine.conf.TinyPicUserName, Engine.conf.TinyPicPassword)
            {
                Icon = Resources.zss_main
            };

            ub.ShowDialog();
            if (ub.DialogResult == DialogResult.OK)
            {
                TinyPicUploader tpu = new TinyPicUploader(Engine.TINYPIC_ID, Engine.TINYPIC_KEY);
                if (Engine.conf.RememberTinyPicUserPass)
                {
                    Engine.conf.TinyPicUserName = ub.UserName;
                    Engine.conf.TinyPicPassword = ub.Password;
                }
                return(tpu.UserAuth(ub.UserName, ub.Password));
            }
            return(null);
        }
Example #5
0
        private void btnTinyPicLogin_Click(object sender, EventArgs e)
        {
            string username = txtTinyPicUsername.Text;
            string password = txtTinyPicPassword.Text;

            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                try
                {
                    TinyPicUploader tpu = new TinyPicUploader(APIKeys.TinyPicID, APIKeys.TinyPicKey);
                    string          registrationCode = tpu.UserAuth(username, password);

                    if (!string.IsNullOrEmpty(registrationCode))
                    {
                        Config.TinyPicRegistrationCode  = registrationCode;
                        txtTinyPicRegistrationCode.Text = registrationCode;
                    }
                }
                catch (Exception ex)
                {
                    DebugHelper.WriteException(ex);
                }
            }
        }