00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 using System;
00013 using System.Windows.Forms;
00014 using Mcs.Epm.MicrosoftProject.mpFx.Client.Plugins.PluginPlublisher.Properties;
00015
00016 namespace Mcs.Epm.MicrosoftProject.mpFx.Client.Plugins.PluginPlublisher.Forms
00017 {
00018
00019
00020
00021 public partial class GalleryLoginForm : Form
00022 {
00023 #region Public Properties
00024
00025 public string GalleryLocation
00026 {
00027 get
00028 {
00029 return galleryLocationTextBox.Text;
00030 }
00031 }
00032
00033 public string UserName
00034 {
00035 get
00036 {
00037 return userNameTextBox.Text;
00038 }
00039 }
00040
00041 public string Password
00042 {
00043 get
00044 {
00045 return passwordTextBox.Text;
00046 }
00047 }
00048
00049 public bool DisplayLoginFailure { get; set; }
00050
00051 #endregion
00052
00053 #region Constructors
00054
00055 public GalleryLoginForm()
00056 {
00057 InitializeComponent();
00058 galleryLocationTextBox.Text = Settings.Default.GalleryLocation;
00059 userNameTextBox.Text = Settings.Default.LastUserName;
00060
00061 if (string.IsNullOrEmpty(userNameTextBox.Text))
00062 {
00063 userNameTextBox.Select();
00064 }
00065 else
00066 {
00067 passwordTextBox.Select();
00068 }
00069 }
00070
00071 #endregion
00072
00073 #region Event Handlers
00074
00075 private void GalleryLoginForm_FormClosed(object sender, FormClosedEventArgs e)
00076 {
00077 Settings.Default.GalleryLocation = galleryLocationTextBox.Text;
00078 Settings.Default.LastUserName = userNameTextBox.Text;
00079 Settings.Default.Save();
00080 }
00081
00082 private void galleryLocationTextBox_TextChanged(object sender, EventArgs e)
00083 {
00084 Uri result;
00085
00086 okButton.Enabled = !string.IsNullOrEmpty(userNameTextBox.Text) &&
00087 Uri.TryCreate(galleryLocationTextBox.Text, UriKind.Absolute, out result);
00088 }
00089
00090 private void GalleryLoginForm_Shown(object sender, EventArgs e)
00091 {
00092 if (DisplayLoginFailure)
00093 {
00094 if (MessageBox.Show(this, Resources.LoginFailure , Resources.PluginName, MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.Cancel)
00095 {
00096 DialogResult = DialogResult.Cancel;
00097 Close();
00098 }
00099 }
00100 }
00101
00102 #endregion
00103 }
00104 }