private void serverInfo_Closed(object sender, EventArgs e) { if (serverInfo != null) { if (serverInfo.Cancelled) { simiasWebService.DisableDomainAutoLogin(serverInfo.DomainInfo.ID); } else { preferences.UpdateDomainStatus(new Domain(serverInfo.DomainInfo)); } bool update = serverInfo.UpdateStarted; serverInfo.Dispose(); serverInfo = null; if (update) { ShutdownTrayApp(null); } } }
private void notifyMessage(NotifyEventArgs notifyEventArgs) { switch (notifyEventArgs.EventData) { case "Domain-Up": { if ( !isConnecting && serverInfo == null ) { isConnecting = true; try { DomainInformation domainInfo = simiasWebService.GetDomainInformation(notifyEventArgs.Message); Connecting connecting = new Connecting( this.ifWebService, simiasWebService, simiasManager, domainInfo ); connecting.StartPosition = FormStartPosition.CenterScreen; if ( connecting.ShowDialog() != DialogResult.OK ) { serverInfo = new ServerInfo(this.ifWebService, simiasManager, domainInfo, connecting.Password); serverInfo.Closed += new EventHandler(serverInfo_Closed); serverInfo.Show(); ShellNotifyIcon.SetForegroundWindow(serverInfo.Handle); } else { try { bool update = CheckForClientUpdate(domainInfo.ID); if (update) { ShutdownTrayApp(null); } } catch { } domainInfo.Authenticated = true; preferences.UpdateDomainStatus(new Domain(domainInfo)); globalProperties.AddDomainToUIList(domainInfo); globalProperties.updateifListViewDomainStatus(domainInfo.ID, true); } } catch (Exception ex) { MessageBox.Show(string.Format("Exception here: {0}--{1}", ex.Message, ex.StackTrace)); } isConnecting = false; } break; } } }
private bool login(int itemIndex) { bool result = false; ListViewItem lvi = accounts.Items[itemIndex]; Domain domain = (Domain)lvi.Tag; if (domain != null) { Connecting connecting = new Connecting(this.ifWebService, simiasWebService, simiasManager, domain.DomainInfo); if (connecting.ShowDialog() == DialogResult.OK) { result = true; } if (!result) { ServerInfo serverInfo = new ServerInfo(this.ifWebService, simiasManager, domain.DomainInfo, connecting.Password); serverInfo.ShowDialog(); result = serverInfo.DomainInfo.Authenticated; serverInfo.Dispose(); } connecting.Dispose(); } if (result) { domain.DomainInfo.Authenticated = true; FormsTrayApp.globalProp().updateifListViewDomainStatus(domain.DomainInfo.ID, true); FormsTrayApp.globalProp().AddDomainToUIList(domain.DomainInfo); lvi.Tag = domain; } return result; }
public bool loginToDomain(Domain domain) { bool result = false; if (domain != null) { Connecting connecting = new Connecting(this.ifWebService, simiasWebService, simiasManager, domain.DomainInfo); if (connecting.ShowDialog() == DialogResult.OK) { result = true; } if (!result) { ServerInfo serverInfo = new ServerInfo(this.ifWebService, simiasManager, domain.DomainInfo, connecting.Password); serverInfo.ShowDialog(); result = serverInfo.DomainInfo.Authenticated; serverInfo.Dispose(); } connecting.Dispose(); } if (result) { domain.DomainInfo.Authenticated = true; FormsTrayApp.globalProp().updateifListViewDomainStatus(domain.DomainInfo.ID, true); FormsTrayApp.globalProp().AddDomainToUIList(domain.DomainInfo); FormsTrayApp.globalProp().UpdateiFolderStatus(domain.DomainInfo.Authenticated, domain.DomainInfo.ID); } return result; }
private void notifyMessage(NotifyEventArgs notifyEventArgs) { switch (notifyEventArgs.EventData) { case "Domain-Up": { try { DomainInformation domainInfo = simiasWebService.GetDomainInformation(notifyEventArgs.Message); string credentials; if (!authenticate(domainInfo, out credentials)) { if (serverInfo == null) { serverInfo = new ServerInfo(simiasManager, domainInfo, credentials); serverInfo.Closed += new EventHandler(serverInfo_Closed); serverInfo.Show(); ShellNotifyIcon.SetForegroundWindow(serverInfo.Handle); } } else { try { bool update = CheckForClientUpdate(domainInfo.ID); if (update) { ShutdownTrayApp(null); } } catch { } domainInfo.Authenticated = true; preferences.UpdateDomainStatus(new Domain(domainInfo)); } } catch { } break; } } }