Example #1
0
        /// <summary>
        /// FormOptions constructor
        /// </summary>
        public FormOptions()
        {
            //Initialise form components
            InitializeComponent();

            //Load options from file and assign to controls
            ApiCredentials credentials = ApiCredentials.LoadFromFile();

            if (credentials != null)
            {
                _apiCredentials       = credentials;
                txtSparkUsername.Text = credentials.Username;
                txtSparkPassword.Text = credentials.Password;
            }
        }
Example #2
0
        /// <summary>
        /// Display live market security form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void securityLiveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Check that user has setup Spark credentials
            ApiCredentials credentials = ApiCredentials.LoadFromFile();

            if ((credentials == null) || (!credentials.Validate()))
            {
                MessageBox.Show(this, "Connection to live market feed via the Spark API requires a valid username and password. " +
                                "Please enter security credentials in the appliction options.",
                                "Authorisation", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                optionsToolStripMenuItem_Click(this, null);
                return;
            }

            //Display live market security form
            FormSecurity securityForm = new FormSecurity();

            securityForm.Show();
        }