public static T Show <T>(string description, Dictionary <string, T> values)
        {
            var dialog = new ChooseBox();

            dialog.Owner = Application.Current.MainWindow;
            dialog.DescriptionTextBlock.Text  = description;
            dialog.ValuesComboBox.ItemsSource = values;
            return(dialog.ShowDialog() == true && dialog.ValuesComboBox.SelectedValue != null ? (T)dialog.ValuesComboBox.SelectedValue : default(T));
        }
        private void Authenticate_CusmonUserNameType_Click(object sender, RoutedEventArgs e)
        {
            LogTextBox.Clear();

            try
            {
                var userName = InputBox.Show("User name:");

                var userNameTypeValues = new Dictionary <string, int>();
                userNameTypeValues["SAM (domain\\user_name)"] = 3;
                userNameTypeValues["DpAccount (user_name)"]   = 9;
                var userNameType = ChooseBox.Show <int>("User name type:", userNameTypeValues);

                Log("User name: {0}", userName);
                Log("User name: {0}", userNameType);

                var dialog = new AuthenticationDialog();
                dialog.Title        = ".NET SDK Sample";
                dialog.Description  = ((Button)sender).Content.ToString();
                dialog.ParentWindow = new WindowInteropHelper(this).Handle;
                dialog.UserName     = userName;
                dialog.UserNameType = userNameType;

                Log("Show dialog");

                if (dialog.ShowDialog())
                {
                    Log("OK");
                    Log("User name: {0}", dialog.UserName);
                    Log("Authenticated credentials: {0}", String.Join(", ", dialog.AuthenticatedCredentials));
                }
                else
                {
                    Log("Cancel");
                }
            }
            catch (Exception ex)
            {
                Log("Error: {0}", ex.Message);
            }
        }