00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 using System;
00013 using System.Windows.Forms;
00014
00015 namespace Mcs.Epm.MicrosoftProject.mpFx.WinForms
00016 {
00017
00018
00019
00020 public partial class ProfileForm : Form
00021 {
00022 #region Public Properties
00023
00024 public ProjectProfiles.ProjectProfile Profile { get; private set; }
00025
00026 #endregion
00027
00028 #region Constructors
00029
00030 public ProfileForm(ProjectProfiles.ProjectProfile profile)
00031 {
00032 InitializeComponent();
00033
00034 Profile = profile;
00035 if (profile != null)
00036 {
00037 nameTextBox.Text = profile.Name;
00038 pwaUrlTextBox.Text = profile.Url;
00039 }
00040 }
00041
00042 #endregion
00043
00044 #region Event Handlers
00045
00046 private void okButton_Click(object sender, EventArgs e)
00047 {
00048 if (nameTextBox.Text == string.Empty)
00049 {
00050 MessageBox.Show(this,
00051 "Please provide a name.",
00052 Text,
00053 MessageBoxButtons.OK,
00054 MessageBoxIcon.Information);
00055
00056 nameTextBox.Select();
00057 DialogResult = DialogResult.None;
00058 return;
00059 }
00060
00061 Uri testUri;
00062
00063 if (pwaUrlTextBox.Text == string.Empty || !Uri.TryCreate(pwaUrlTextBox.Text, UriKind.Absolute, out testUri))
00064 {
00065 MessageBox.Show(this,
00066 "Please provide a valid PWA URL.",
00067 Text,
00068 MessageBoxButtons.OK,
00069 MessageBoxIcon.Information);
00070
00071 pwaUrlTextBox.Select();
00072 DialogResult = DialogResult.None;
00073 return;
00074 }
00075
00076 Profile.Name = nameTextBox.Text;
00077 Profile.Url = pwaUrlTextBox.Text;
00078 }
00079
00080 #endregion
00081
00082 }
00083 }