/// <summary> /// Called by our worker thread to avoid inordinate pauses in the UI while checking the /// Shared Network Folder to determine its status. /// </summary> private void CheckNetworkStatusAndUpdateUI() { // Check network Shared Folder status string message, tooltip, diagnostics; message = tooltip = diagnostics = ""; bool isReady = false; _lanMode = LANMode.ChorusHub; if (Properties.Settings.Default.ShowChorusHubInSendReceive) { try { if (_chorusHubClient == null) { _chorusHubServerInfo = ChorusHubServerInfo.FindServerInformation(); if (_chorusHubServerInfo != null) { _chorusHubClient = new ChorusHubClient(_chorusHubServerInfo); } } } catch (Exception) { //not worth complaining about #if DEBUG throw; #endif } } if (_chorusHubServerInfo == null) { message = LocalizationManager.GetString("GetChorusHubStatus.NoChorusHubFound", "No Chorus Hub found on local network."); } else if (!_chorusHubServerInfo.ServerIsCompatibleWithThisClient) { message = string.Format(LocalizationManager.GetString("GetChorusHubStatus.FoundButNotCompatible", "Found Chorus Hub, but it is not compatible with this version of {0}."), Application.ProductName); } else { isReady = true; message = string.Format(LocalizationManager.GetString("GetChorusHubStatus.FoundChorusHubAt", "Found Chorus Hub at {0}"), _chorusHubServerInfo.HostName); tooltip = _chorusHubServerInfo.GetHgHttpUri(Path.GetFileName(_repository.PathToRepo)); } Monitor.Enter(this); // Using a callback and Invoke ensures that we avoid cross-threading updates. if (!_exiting) { var callback = new UpdateNetworkUICallback(UpdateNetworkUI); Invoke(callback, new object[] { isReady, message, tooltip, diagnostics }); } Monitor.Exit(this); }
/// <summary> /// Called by our worker thread to avoid inordinate pauses in the UI while checking the /// Shared Network Folder to determine its status. /// </summary> private void CheckNetworkStatusAndUpdateUI() { // Check network Shared Folder status string message, tooltip, diagnostics; message = tooltip = diagnostics = ""; bool isReady=false; _lanMode = LANMode.ChorusHub; if (Properties.Settings.Default.ShowChorusHubInSendReceive) { try { if (_chorusHubClient == null) { _chorusHubServerInfo = ChorusHubServerInfo.FindServerInformation(); if (_chorusHubServerInfo != null) _chorusHubClient = new ChorusHubClient(_chorusHubServerInfo); } } catch (Exception) { //not worth complaining about #if DEBUG throw; #endif } } if(_chorusHubServerInfo==null) { message = "No Chorus Hub found on local network."; } else if (!_chorusHubServerInfo.ServerIsCompatibleWithThisClient) { message = "Found Chorus Hub but it is not compatible with this version of "+Application.ProductName; } else { isReady = true; message = string.Format("Found Chorus Hub at {0}", _chorusHubServerInfo.HostName); tooltip = _chorusHubServerInfo.GetHgHttpUri(Path.GetFileName(_repository.PathToRepo)); } Monitor.Enter(this); // Using a callback and Invoke ensures that we avoid cross-threading updates. if (!_exiting) { var callback = new UpdateNetworkUICallback(UpdateNetworkUI); Invoke(callback, new object[] { isReady, message, tooltip, diagnostics }); } Monitor.Exit(this); }