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 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; } } }