示例#1
0
        /// <summary>
        /// Handles the Click event of the LoginToAzure control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void LoginToAzure_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Logger.LogInfo(CallInfo.Site(), "Starting Azure login.");

                var userAuthDetails = new UserAuthenticator();

                // Raise Authentication prompt and log the user in.
                userAuthDetails.AuthenticateUser();
                Logger.LogInfo(CallInfo.Site(), "Token acquire complete.");

                SelectServiceBus selectServiceBus = new SelectServiceBus(userAuthDetails);
                selectServiceBus.Left = this.Left;
                selectServiceBus.Top  = this.Top;

                selectServiceBus.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                Logger.LogError(CallInfo.Site(), ex, "Failed to Login into Azure");
                MessageBox.Show("Failed to log you in!!", "Login failure", MessageBoxButton.OKCancel, MessageBoxImage.Error);
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SelectServiceBus"/> class.
        /// </summary>
        /// <param name="authenticationDetails">The authentication details for the user.</param>
        public SelectServiceBus(UserAuthenticator authenticationDetails)
        {
            this.ContentRendered += this.Window_ContentRendered;
            this.InitializeComponent();
            this.userAuthenticator = authenticationDetails;
            this.comboSubscriptionList.ItemsSource = this.subscriptions;
            this.comboServiceBusList.ItemsSource   = this.serviceBuses;

            // Disable controls to begin with.
            this.comboSubscriptionList.IsEnabled = false;
            this.comboServiceBusList.IsEnabled   = false;
        }