private void FormsTrayApp_Load(object sender, System.EventArgs e) { if (shutdown) { this.Close(); } else { try { Environment.CurrentDirectory = Application.StartupPath; simiasManager.Start(); SetWebServiceInformation(simiasManager.WebServiceUri, simiasManager.DataPath); ifWebService = new iFolderWebService(); ifWebService.Url = simiasManager.WebServiceUri + "/iFolder.asmx"; simiasWebService = new SimiasWebService(); simiasWebService.Url = simiasManager.WebServiceUri + "/Simias.asmx"; eventQueue = new Queue(); workEvent = new AutoResetEvent(false); eventClient = new IProcEventClient(new IProcEventError(errorHandler), null); eventClient.Register(); if (!eventError) { eventClient.SetEvent(IProcEventAction.AddNodeChanged, new IProcEventHandler(trayApp_nodeEventHandler)); eventClient.SetEvent(IProcEventAction.AddNodeCreated, new IProcEventHandler(trayApp_nodeEventHandler)); eventClient.SetEvent(IProcEventAction.AddNodeDeleted, new IProcEventHandler(trayApp_nodeEventHandler)); eventClient.SetEvent(IProcEventAction.AddCollectionSync, new IProcEventHandler(trayApp_collectionSyncHandler)); eventClient.SetEvent(IProcEventAction.AddFileSync, new IProcEventHandler(trayApp_fileSyncHandler)); eventClient.SetEvent(IProcEventAction.AddNotifyMessage, new IProcEventHandler(trayApp_notifyMessageHandler)); } preferences = new Preferences(ifWebService, simiasWebService, simiasManager); preferences.EnterpriseConnect += new Novell.FormsTrayApp.Preferences.EnterpriseConnectDelegate(preferences_EnterpriseConnect); preferences.ChangeDefaultDomain += new Novell.FormsTrayApp.Preferences.ChangeDefaultDomainDelegate(preferences_EnterpriseConnect); preferences.RemoveDomain += new Novell.FormsTrayApp.Preferences.RemoveDomainDelegate(preferences_RemoveDomain); preferences.ShutdownTrayApp += new Novell.FormsTrayApp.Preferences.ShutdownTrayAppDelegate(preferences_ShutdownTrayApp); preferences.UpdateDomain += new Novell.FormsTrayApp.Preferences.UpdateDomainDelegate(preferences_UpdateDomain); preferences.CreateControl(); IntPtr handle = preferences.Handle; syncLog = new SyncLog(); syncLog.CreateControl(); handle = syncLog.Handle; LocalService.Start(simiasWebService, simiasManager.WebServiceUri, simiasManager.DataPath); LocalService.Start(ifWebService, simiasManager.WebServiceUri, simiasManager.DataPath); simiasRunning = true; globalProperties = new GlobalProperties(ifWebService, simiasWebService, eventClient); globalProperties.RemoveDomain += new Novell.FormsTrayApp.GlobalProperties.RemoveDomainDelegate(globalProperties_RemoveDomain); globalProperties.PreferenceDialog = preferences; globalProperties.SyncLogDialog = syncLog; globalProperties.CreateControl(); handle = globalProperties.Handle; bool accountPrompt = false; try { globalProperties.InitializeServerList(); DomainInformation[] domains; domains = this.simiasWebService.GetDomains(false); foreach(DomainInformation dw in domains) { try { if (dw.IsSlave) { preferences.AddDomainToList(dw); } globalProperties.AddDomainToList(dw); preferences.SetProxyForDomain( dw.HostUrl, false ); } catch {} } if (domains.Length.Equals(0)) { accountPrompt = true; } } catch {} if (worker == null) { worker = new Thread(new ThreadStart(eventThreadProc)); worker.Start(); } shellNotifyIcon.Text = resourceManager.GetString("iFolderServices"); shellNotifyIcon.Icon = trayIcon; updateOverlayIcons(); if (accountPrompt) { notifyType = NotifyType.CreateAccount; shellNotifyIcon.DisplayBalloonTooltip(resourceManager.GetString("createAccountTitle"), resourceManager.GetString("createAccount"), BalloonType.Info); } } catch (Exception ex) { ShutdownTrayApp(ex); } } }