зеркало из https://github.com/microsoft/2LCS.git
Controlling the exception thrown when trying to do operations on CHE and opening the login window when the cookie is expired.
This commit is contained in:
Родитель
c86927066d
Коммит
d5dbfdfe6f
|
@ -1419,6 +1419,32 @@ namespace LCS.Forms
|
|||
ChangeProjectMenuItem_Click(null, null);
|
||||
}
|
||||
|
||||
public void LoginToLCS()
|
||||
{
|
||||
WebBrowserHelper.FixBrowserVersion();
|
||||
using var form = new Login();
|
||||
form.ShowDialog();
|
||||
if (form.Cancelled) return;
|
||||
_cookies = GetUriCookieContainer();
|
||||
if (_cookies == null) return;
|
||||
_httpClientHelper = new HttpClientHelper(_cookies)
|
||||
{
|
||||
LcsUrl = _lcsUrl,
|
||||
LcsUpdateUrl = _lcsUpdateUrl,
|
||||
LcsDiagUrl = _lcsDiagUrl
|
||||
};
|
||||
if (_selectedProject != null)
|
||||
{
|
||||
_httpClientHelper.ChangeLcsProjectId(_selectedProject.Id.ToString());
|
||||
_httpClientHelper.LcsProjectTypeId = _selectedProject.ProjectTypeId;
|
||||
}
|
||||
changeProjectMenuItem.Enabled = true;
|
||||
cheInstanceContextMenu.Enabled = true;
|
||||
saasInstanceContextMenu.Enabled = true;
|
||||
logoutToolStripMenuItem.Enabled = true;
|
||||
loginToLcsMenuItem.Enabled = false;
|
||||
}
|
||||
|
||||
private void LogonToApplicationToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Cursor = Cursors.WaitCursor;
|
||||
|
|
|
@ -12,10 +12,12 @@ namespace LCS
|
|||
switch (e.Exception.Source)
|
||||
{
|
||||
case "System.Net.Http" when e.Exception.Message == $"Response status code does not indicate success: 498 ().":
|
||||
case "mscorlib" when e.Exception.InnerException.Message == $"Response status code does not indicate success: 498 ().":
|
||||
MessageBox.Show("Please login to LCS again. Your cookie is probably invalid or expired.");
|
||||
var mainForm = GetMainForm();
|
||||
mainForm.Cursor = Cursors.Default;
|
||||
mainForm.SetLoginButtonEnabled();
|
||||
mainForm.LoginToLCS();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Загрузка…
Ссылка в новой задаче