/// <summary> /// Gets the randomly generated numbers from the webservice and stores it in the array. /// </summary> /// <param name="array">The array used to store the values.</param> /// <returns>true if the value has been generated correctly, false otherwise.</returns> private bool GetRngValues(double[] array) { // If the plugin is not connected to the webservice abort if (!Connected) { return(false); } int doublesGenerated = 0; int errorNo = LibQrng.GetDoubleArray(ref array[0], array.Length, ref doublesGenerated); return(errorNo == LibQrng.SuccessReturnCode); }
/// <summary> /// Disconnect from the Qrng webservice. /// </summary> public void Disconnect() { // If the data is still being loaded on the background thread wait for it to end. if (this.loadingThread != null) { this.loadingThread.Join(); } if (Connected) { LibQrng.Disconnect(); } Connected = false; }
/// <summary> /// Connect to the Qrng webservice using the credentials stored in the user settings. /// </summary> public void Connect() { // If the plugin is already connected a Disconnect has to be performed first in // order to reconnect again so nothing is done if (Connected) { return; } QrngWebserviceSettings settings = UserSettings.GetSettings(typeof(QrngWebserviceSettings)) as QrngWebserviceSettings; int errorNo = LibQrng.Connect(settings.Username, settings.Password.Value); Connected = errorNo == LibQrng.SuccessReturnCode; }