SetText() public static method

public static SetText ( System.Windows.Controls.PasswordBox passwordBox, string text ) : void
passwordBox System.Windows.Controls.PasswordBox
text string
return void
        private void UpdateCustomerComplete(SubmitOperation so)
        {
            if (so.HasError)
            {
                if (!m_customer.HasValidationErrors)
                {
                    // Only display the exception message if it's not already being set in the validation summary.

                    // Remove the error information the RIA domain services framework adds in and that will just confuse things.
                    string errorMessage = Regex.Replace(so.Error.Message, @"Submit operation failed.", "");
                    UIHelper.SetText(m_statusTextBlock, errorMessage);
                }
                else
                {
                    UIHelper.SetText(m_statusTextBlock, "There was a validation error updating your details.");
                }

                so.MarkErrorAsHandled();
            }
            else
            {
                UIHelper.SetText(m_statusTextBlock, "Details successfully updated.");
            }

            SetUpdateButtonsEnabled(true);
        }
 private void UpdatePasswordButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     if (m_oldPasswordTextBox.Password.IsNullOrBlank())
     {
         m_statusTextBlock.Text = "The old password must be specified.";
     }
     else if (m_newPasswordTextBox.Password.IsNullOrBlank())
     {
         m_statusTextBlock.Text = "The new password must be specified.";
     }
     else if (m_retypeNewPasswordTextBox.Password.IsNullOrBlank())
     {
         m_statusTextBlock.Text = "The retyped new password must be specified.";
     }
     else if (m_newPasswordTextBox.Password.Trim() != m_retypeNewPasswordTextBox.Password.Trim())
     {
         m_statusTextBlock.Text = "The new password did not match the retyped password.";
     }
     else
     {
         SetUpdateButtonsEnabled(false);
         UIHelper.SetText(m_statusTextBlock, "Updating password, please wait...");
         m_riaContext.ChangePassword(m_oldPasswordTextBox.Password.Trim(), m_newPasswordTextBox.Password.Trim(), UpdateCustomerPasswordComplete, null);
         ClearPasswordFields();
     }
 }
Example #3
0
        private void UpdateAppStatus()
        {
            if (m_persistorStatus == ServiceConnectionStatesEnum.Error)
            {
                UIHelper.SetFill(m_appStatusIcon, Colors.Red);
                UIHelper.SetText(m_provisioningStatusMessage, m_persistorStatusMessage + " " + m_entitiesServiceURL);

                if (m_userPage != null)
                {
                    m_userPage.SetProvisioningStatusIconColour(Colors.Red);
                    m_userPage.SetProvisioningStatusMessage(m_persistorStatusMessage + " " + m_entitiesServiceURL);
                }
            }
            else if (m_persistorStatus == ServiceConnectionStatesEnum.Ok)
            {
                UIHelper.SetFill(m_appStatusIcon, Colors.Green);
                UIHelper.SetText(m_provisioningStatusMessage, "Provisioning service ok. " + m_entitiesServiceURL);

                if (m_userPage != null)
                {
                    m_userPage.SetProvisioningStatusIconColour(Colors.Green);
                    m_userPage.SetProvisioningStatusMessage("Provisioning service ok. " + m_entitiesServiceURL);
                }

                if (m_loginControl.Visibility == System.Windows.Visibility.Visible)
                {
                    m_loginControl.FocusOnUsername();
                }
            }
        }
Example #4
0
 public void Clear()
 {
     UIHelper.SetText(m_usernameTextBox, String.Empty);
     UIHelper.SetText(m_passwordTextBox, String.Empty);
     UIHelper.SetText(m_loginError, String.Empty);
     UIHelper.SetText(m_impersonateUsernameTextBox, String.Empty);
     UIHelper.SetVisibility(m_impersonateCanvas, Visibility.Collapsed);
 }
        private void EditEnded(object sender, System.Windows.Controls.DataFormEditEndedEventArgs e)
        {
            if (e.EditAction == DataFormEditAction.Commit)
            {
                UIHelper.SetText(m_statusTextBlock, "Attempting to create your account, please wait...");

                Customer customer = (sender as DataForm).CurrentItem as Customer;
                m_riaContext.Customers.Add(customer);
                m_riaContext.SubmitChanges(CreateCustomerComplete, customer);
            }
        }
 private void DeleteComplete(SubmitOperation so)
 {
     if (so.HasError)
     {
         UIHelper.SetText(m_statusTextBlock, "Error deleting account. " + so.Error.Message);
         so.MarkErrorAsHandled();
     }
     else
     {
         Logout_External(false);
     }
 }
Example #7
0
 public void WriteLoginMessage(string message)
 {
     if (message.IsNullOrBlank())
     {
         UIHelper.SetVisibility(m_loginError, Visibility.Collapsed);
     }
     else
     {
         UIHelper.SetVisibility(m_loginError, Visibility.Visible);
         UIHelper.SetText(m_loginError, (message.Length > MAX_STATUS_MESSAGE_LENGTH) ? message.Substring(0, MAX_STATUS_MESSAGE_LENGTH) : message);
     }
 }
Example #8
0
 private void NotificationsServiceStatusChanged(ServiceConnectionStatesEnum serviceStatus, string statusMessage)
 {
     if (serviceStatus == ServiceConnectionStatesEnum.Ok)
     {
         UIHelper.SetFill(m_notificationsStatusIcon, Colors.Green);
         UIHelper.SetText(m_notificationsStatusMessage, "Notifications service ok. " + m_notificationsURL);
     }
     else
     {
         UIHelper.SetFill(m_notificationsStatusIcon, Colors.Red);
         UIHelper.SetText(m_notificationsStatusMessage, statusMessage + " " + m_notificationsURL);
     }
 }
        private void UpdateCustomerPasswordComplete(InvokeOperation io)
        {
            if (io.HasError)
            {
                UIHelper.SetText(m_statusTextBlock, io.Error.Message);
                io.MarkErrorAsHandled();
            }
            else
            {
                UIHelper.SetText(m_statusTextBlock, "Password successfully updated.");
            }

            SetUpdateButtonsEnabled(true);
        }
Example #10
0
        private void Authenticated(string username, string authID)
        {
            UIHelper.SetText(m_provisioningStatusMessage, "Initialising...");
            UIHelper.SetFill(m_appStatusIcon, Colors.Blue);

            m_owner = username;

            m_loginControl.Clear();
            m_createAccountControl.Reset();
            UIHelper.SetVisibility(m_createAccountControl, Visibility.Collapsed);

            m_userPage = new UserPage(LogoutAsync, m_owner, m_notificationsServiceURL, m_riaContext);
            m_mainPageBorder.Content = m_userPage;

            UpdateAppStatus();
        }
        public CustomerSettingsControl(
            ActivityMessageDelegate logActivityMessage,
            LogoutDelegate logout,
            string owner,
            SIPEntitiesDomainContext riaContext)
        {
            InitializeComponent();

            LogActivityMessage_External = logActivityMessage;
            Logout_External             = logout;
            m_owner      = owner;
            m_riaContext = riaContext;
            UIHelper.SetText(m_accountDetailsTextBlock, "Account Details: " + m_owner);
            //m_persistor.GetCustomerComplete += GetCustomerComplete;
            //m_persistor.UpdateCustomerPasswordComplete += UpdateCustomerPasswordComplete;
            //m_persistor.UpdateCustomerComplete += UpdateCustomerComplete;
        }
Example #12
0
        public void SetDisplayedRange(int offset, int count, int total, int displayCount)
        {
            if (total == 0)
            {
                UIHelper.SetText(m_displayedRecordsTextBlock, "No records were found");
                DisablePagingButtons();
            }
            else if (total <= displayCount)
            {
                UIHelper.SetText(m_displayedRecordsTextBlock, "Displaying " + total + " of " + total);
                DisablePagingButtons();
            }
            else
            {
                int start = offset + 1;
                int end   = offset + count;
                UIHelper.SetText(m_displayedRecordsTextBlock, start + " to " + end + " of " + total);

                if (offset > 0)
                {
                    UIHelper.SetIsEnabled(m_pageFirstButton, true);
                    UIHelper.SetIsEnabled(m_pagePreviousButton, true);
                }
                else
                {
                    UIHelper.SetIsEnabled(m_pageFirstButton, false);
                    UIHelper.SetIsEnabled(m_pagePreviousButton, false);
                }

                if (offset + count < total)
                {
                    UIHelper.SetIsEnabled(m_pageNextButton, true);
                    UIHelper.SetIsEnabled(m_pageLastButton, true);
                }
                else
                {
                    UIHelper.SetIsEnabled(m_pageNextButton, false);
                    UIHelper.SetIsEnabled(m_pageLastButton, false);
                }
            }
        }
Example #13
0
 private void LoginComplete(LoadOperation op)
 {
     if (op.HasError)
     {
         // Remove the error information the RIA domain services framework adds in and that will just confuse things.
         string errorMessage = Regex.Replace(op.Error.Message, @"Load operation failed .*?\.", "");
         WriteLoginMessage("Error logging in." + errorMessage);
         op.MarkErrorAsHandled();
         UIHelper.SetText(m_passwordTextBox, String.Empty);
     }
     else if (op.Entities.Count() == 0)
     {
         WriteLoginMessage("Login failed.");
         UIHelper.SetText(m_passwordTextBox, String.Empty);
     }
     else
     {
         var user = op.Entities.SingleOrDefault() as User;
         Authenticated(user.Name, null);
         //Authenticated(m_loginUsername, null);
     }
 }
        public void Load()
        {
            SetUpdateButtonsEnabled(false);
            UIHelper.SetText(m_statusTextBlock, "Loading details, please wait...");

            m_riaContext.Customers.Clear();
            var query = m_riaContext.GetCustomerQuery();

            // Make sure the timezons are loaded first.
            if (Page.TimeZones == null)
            {
                m_riaContext.GetTimeZones(Page.GetTimeZonesCompleted, new Action(() => {
                    m_timezoneListBox.ItemsSource = Page.TimeZones;
                    m_riaContext.Load(query, LoadBehavior.RefreshCurrent, GetCustomerCompleted, null);
                }));
            }
            else
            {
                m_timezoneListBox.ItemsSource = Page.TimeZones;
                m_riaContext.Load(query, LoadBehavior.RefreshCurrent, GetCustomerCompleted, null);
            }
        }
Example #15
0
        public SIPAccountDetailsControl(
            DetailsControlModesEnum mode,
            SIPAccount sipAccount,
            string owner,
            SIPAccountUpdateDelegate add,
            SIPAccountUpdateDelegate update,
            ControlClosedDelegate closed,
            SIPEntitiesDomainContext riaContext
            //GetDialPlanNamesDelegate getDialPlanNames,
            //GetSIPDomainsDelegate getSIPDomains
            )
        {
            InitializeComponent();

            m_detailsMode             = mode;
            m_owner                   = owner;
            m_sipAccount              = sipAccount;
            AddSIPAccount_External    = add;
            UpdateSIPAccount_External = update;
            Closed_External           = closed;
            m_riaContext              = riaContext;
            //GetDialPlanNames_External = getDialPlanNames;
            //GetSIPDomains_External = getSIPDomains;

            if (m_detailsMode == DetailsControlModesEnum.Edit)
            {
                PopulateDataFields(m_sipAccount);
            }
            else
            {
                m_sipAccountUpdateButton.Content      = "Add";
                m_sipAccountIdCanvas.Visibility       = Visibility.Collapsed;
                m_statusDisabledRadio.Visibility      = Visibility.Collapsed;
                m_statusAdminDisabledRadio.Visibility = Visibility.Collapsed;
                UIHelper.SetText(m_sipAccountOwner, m_owner);
                SetDomainNames(null);
                SetDialPlanNames(null);
            }
        }
        private void CreateCustomerComplete(SubmitOperation so)
        {
            Customer customer = (Customer)so.UserState;

            if (so.HasError)
            {
                m_riaContext.Customers.Remove(customer);

                // Remove the error information the RIA domain services framework adds in and that will just confuse things.
                string errorMessage = Regex.Replace(so.Error.Message, @"Submit operation failed.", "");
                UIHelper.SetText(m_statusTextBlock, errorMessage);

                so.MarkErrorAsHandled();
            }
            else
            {
                CustomerCreated("A comfirmation email has been sent to " + customer.EmailAddress + ". " +
                                "Please click on the link contained in the email to activate your account. Accounts not activated within 24 hours are removed.");

                Reset();
            }
        }
        private void ChangeSIPDialPlanComplete(InvokeOperation io)
        {
            if (io.HasError)
            {
                LogActivityMessage_External(MessageLevelsEnum.Error, "There was an error changing the dial plan name. " + io.Error.Message);
                io.MarkErrorAsHandled();
                UIHelper.SetIsEnabled(_saveButton, true);
                UIHelper.SetIsEnabled(_dialPlanNameTextBox, IsEnabled);
            }
            else
            {
                string newName = (string)io.UserState;

                LogActivityMessage_External(MessageLevelsEnum.Info, "The dial plan name was successfully changed to " + newName + ".");

                UIHelper.SetText(_dialPlanNameTextBox, newName);
                UIHelper.SetText(m_dialPlanName, newName);
                UIHelper.SetVisibility(_dialPlanNameTextBox, System.Windows.Visibility.Collapsed);
                UIHelper.SetVisibility(m_dialPlanName, System.Windows.Visibility.Visible);
                UIHelper.SetVisibility(_changeButton, System.Windows.Visibility.Visible);
                UIHelper.SetVisibility(_saveButton, System.Windows.Visibility.Collapsed);
            }
        }
        private void GetCustomerCompleted(LoadOperation <Customer> lo)
        {
            if (lo.HasError)
            {
                UIHelper.SetText(m_statusTextBlock, lo.Error.Message);
                lo.MarkErrorAsHandled();
            }
            else
            {
                m_customer = m_riaContext.Customers.FirstOrDefault();

                if (m_customer == null)
                {
                    UIHelper.SetText(m_statusTextBlock, "There was an error retrieving your details. Please re-login and try again.");
                }
                else
                {
                    this.DataContext = m_customer;
                    UIHelper.SetText(m_statusTextBlock, "Details successfully loaded.");
                    SetUpdateButtonsEnabled(true);
                }
            }
        }
Example #19
0
 public void SetTitle(string title)
 {
     UIHelper.SetText(m_assetTitle, title);
 }
 private void CloseButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     UIHelper.SetText(m_statusTextBlock, String.Empty);
     CloseClicked();
 }
 public void Reset()
 {
     m_newCustomerDataForm.CurrentItem = CreateNewCustomer();
     UIHelper.SetText(m_statusTextBlock, String.Empty);
 }
Example #22
0
 public void SetProvisioningStatusMessage(string message)
 {
     UIHelper.SetText(m_provisioningStatusMessage, message);
 }
 private void ClearPasswordFields()
 {
     UIHelper.SetText(m_oldPasswordTextBox, String.Empty);
     UIHelper.SetText(m_newPasswordTextBox, String.Empty);
     UIHelper.SetText(m_retypeNewPasswordTextBox, String.Empty);
 }
 private void UpdateCustomerButton_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     SetUpdateButtonsEnabled(false);
     UIHelper.SetText(m_statusTextBlock, "Updating details, please wait...");
     m_riaContext.SubmitChanges(UpdateCustomerComplete, null);
 }