private async void StackRegsiter_tapped(object sender, TappedRoutedEventArgs e)
        {
            Window.Current.CoreWindow.PointerCursor = new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Arrow, 0);
            MessageDialog myDlg;
            bool          executeFinally = true;

            if ((sender is StackPanel) && (e.OriginalSource is TextBlock))
            {
                ((Grid)((StackPanel)sender).Parent).Children.ElementAt(3).Visibility = Visibility.Visible;
                ((StackPanel)sender).Children.ElementAt(1).Visibility = Visibility.Collapsed;
            }
            string deviceFriendlyName = NameYourDevice.Text.Trim();

            var    loader = new Windows.ApplicationModel.Resources.ResourceLoader();
            string deviceNameAlreadyUsedContent = loader.GetString("DeviceNameAlreadyUsed_content_error");
            string deviceNameAlreadyUsedTitle   = loader.GetString("DeviceNameAlreadyUsed_title_error");

            string deviceAlreadyRegisteredContent = loader.GetString("DeviceAlreadyRegistered_content_error");
            string deviceAlreadyRegisteredTitle   = loader.GetString("DeviceAlreadyRegistered_title_error");

            try
            {
                IReadOnlyList <SecondaryAuthenticationFactorInfo> deviceList = await SecondaryAuthenticationFactorRegistration.FindAllRegisteredDeviceInfoAsync(SecondaryAuthenticationFactorDeviceFindScope.User);

                foreach (SecondaryAuthenticationFactorInfo device in deviceList)
                {
                    if (device.DeviceFriendlyName == deviceFriendlyName)
                    {
                        throw new Exception(deviceNameAlreadyUsedContent);
                    }
                }
                await CommomMethods.RegisterDevice_Click(deviceFriendlyName);
            }
            catch (Exception ex)
            {
                if (ex.Message == deviceNameAlreadyUsedContent)
                {
                    myDlg = new MessageDialog(ex.Message, deviceNameAlreadyUsedTitle);

                    await myDlg.ShowAsync();

                    this.Frame.Navigate(typeof(RegisterDevice));
                    executeFinally = false;
                }
                else if (ex.Message == deviceAlreadyRegisteredContent)
                {
                    myDlg = new MessageDialog(deviceAlreadyRegisteredContent, deviceAlreadyRegisteredTitle);
                    await myDlg.ShowAsync();

                    this.Frame.Navigate(typeof(waitingForDevice));
                    executeFinally = false;
                }
                else
                {
                    IReadOnlyList <SecondaryAuthenticationFactorInfo> deviceList = await SecondaryAuthenticationFactorRegistration.FindAllRegisteredDeviceInfoAsync(SecondaryAuthenticationFactorDeviceFindScope.User);

                    if (deviceList.Count > 0)
                    {
                        this.Frame.Navigate(typeof(MainPage), "false");
                    }
                    else
                    {
                        this.Frame.Navigate(typeof(waitingForDevice));
                    }
                }
            }
            finally
            {
                if (executeFinally)
                {
                    this.Frame.Navigate(typeof(MainPage), "false");
                }
            }
        }