Exemplo n.º 1
0
        /// <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;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Performs the startup operations for the plugin.
        /// </summary>
        public void Execute()
        {
            // Check the correct library to use
            LibQrngCheck();

            // Check if the credentials are null or empty
            QrngWebserviceSettings settings = UserSettings.GetSettings(typeof(QrngWebserviceSettings)) as QrngWebserviceSettings;

            if (string.IsNullOrEmpty(settings.Username) || string.IsNullOrEmpty(settings.Password.Value))
            {
                MessageBox.Show("The credentials for accessing the webservice that retrieves the random numbers are empty." +
                                "\n\rIf you don't have the credentials you can subscribe freely at https://qrng.physik.hu-berlin.de" +
                                "\n\r\n\rYou can enter or change your credentials at any time in Fairmat Settings->Plugins settings",
                                "QRNG");
            }
        }