public void Prepare(Function fn, ClassRemotes.Remote remote) { remoteDisplay.Clear(); remoteDisplay.AnyTextChanged += SomeTextChanged; // Do things differently basen on whether we are using this // form to add a new remote repo, rename it or we are editing // an existing remote repo switch (fn) { case Function.Add: remoteDisplay.Enable(true, true); remote.Name = "origin"; remote.PushCmd = ""; remoteDisplay.Set(remote); Text = "Add a new remote repository"; btOK.Enabled = false; break; case Function.Edit: Text = "Edit remote repository '" + remote.Name + "'"; remoteDisplay.Enable(false, true); remoteDisplay.Set(remote); break; case Function.Rename: Text = "Rename remote repository '" + remote.Name + "'"; remoteDisplay.Enable(true, false); remoteDisplay.Set(remote); break; } }
/// <summary> /// Set all input fields to parameter values /// </summary> /// <param name="repo">Values to set</param> public void Set(ClassRemotes.Remote repo) { textName.Text = repo.Name; textUrlFetch.Text = repo.UrlFetch; textUrlPush.Text = repo.UrlPush; textPushCmd.Text = repo.PushCmd; btWWW1.Enabled = isValidUrl(textUrlFetch.Text); btWWW2.Enabled = isValidUrl(textUrlPush.Text); textPassword.Text = repo.Password; // Rebuild the state variables _after_ all the URLs have been inserted SomeTextChanged(null, null); }
/// <summary> /// Set all input fields to parameter values /// </summary> /// <param name="repo">Values to set</param> public void Set(ClassRemotes.Remote repo) { textName.Text = repo.Name; textUrlFetch.Text = repo.UrlFetch; textUrlPush.Text = repo.UrlPush; textPushCmd.Text = repo.PushCmd; textPassword.Text = repo.Password; }
/// <summary> /// Call this method to properly set the remote structure that is going to be used by this dialog /// </summary> public void SetRemote(ClassRemotes.Remote remote) { Remote = remote; remoteDisplay.Set(Remote); }