/// <summary> /// Setting all relevant information for a PTV xServer, consisting of an URL and, in case of an on-premise xServer installation, /// an customer-provided xToken. The internally available user-password-pair is not used due to its visibility during sending /// requests to the xServer. /// </summary> /// <param name="url">URL of the xServer installation.</param> /// <param name="xToken">Value provided to the customer, which grants access only to the xServer API, and no further /// rights in the context of the internal user management.</param> /// <returns>False if the settings denied access due to a wrong URL address or authentication data, otherwise true.</returns> public static bool Set(string url, string xToken) { try { #region doc:CheckConnection var newXMapMetaInfo = new XMapMetaInfo(url); newXMapMetaInfo.SetCredentials("xtok", xToken); newXMapMetaInfo.CheckCredentials("xtok", xToken); // causes an exception if something goes wrong #endregion XMapMetaInfo = newXMapMetaInfo; IsOk = true; ErrorMessage = string.Empty; // Save settings for the next session Properties.Settings.Default.XUrl = url; Properties.Settings.Default.XToken = xToken; Properties.Settings.Default.Save(); } catch (Exception exception) { IsOk = false; ErrorMessage = exception.Message; } return(IsOk); }