コード例 #1
0
 private void GridViewImports_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     //GridViewImports.BorderThickness = new Thickness(0, 0, 0, 0);
     //GridViewImports.BorderBrush = new SolidColorBrush(Colors.White);
     hostType = ((ControlInfoAccountType)GridViewImports.SelectedItem).HostType;
     ResetSuggestedAccount();
 }
コード例 #2
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            NotifyUser(string.Empty, NotifyType.InformMessage);

            switch (importMode)
            {
                case ImportMode.FROM_FILE:
                    UC_AddressBook.Instance.VisibleBackPage(PageTitles.TITLE_IMPORT_CONTACT_FROM_FILE);
                    this.grid_account.Visibility = Visibility.Collapsed;
                    GridViewImports.Visibility = Visibility.Collapsed;
                    this.grid_file.Visibility = Visibility.Visible;
                    lbl_account_type.Visibility = Visibility.Collapsed;
                    label_file_path.Text = string.Empty;
                    btn_browse.Focus(FocusState.Pointer);
                    sf = null;
                    break;
                case ImportMode.FROM_ACCOUNT:
                    UC_AddressBook.Instance.VisibleBackPage(PageTitles.TITLE_IMPORT_CONTACT_FROM_ACCOUNT);
                    GridViewImports.Visibility = Visibility.Visible;
                    this.grid_account.Visibility = Visibility.Visible;
                    this.grid_file.Visibility = Visibility.Collapsed;
                    lbl_account_type.Visibility = Visibility.Visible;
                    GridViewImports.SelectionChanged -= GridViewImports_SelectionChanged;
                    GridViewImports.ItemsSource = null;
                    GridViewImports.ItemsSource = Imports;
                    GridViewImports.SelectionChanged += GridViewImports_SelectionChanged;
                    tbox_account.Focus(FocusState.Keyboard);
                    tbox_account.Text = string.Empty;
                    tbox_password.Password = string.Empty;
                    hostType = CMData.HostType.TYPE_UNKNOWN;
                    StatusPanel.Visibility = Visibility.Collapsed;
                    listAccountName = dbController.GetAllUserNameOfAccounts();
                    ResetSuggestedAccount();
                    ToolTipService.SetToolTip(Import_Button, null);
                    break;
                default:
                    break;
            }
        }
コード例 #3
0
        private bool ValidateAccount()
        {
            string accountText = tbox_account.Text.Trim();
            string pass = tbox_password.Password.Trim();

            if (hostType == CMData.HostType.TYPE_UNKNOWN)
            {
                if (suggestedHostType.Count > 1)
                {
                    string msg = UC_AddressBook.ResourcesStringLoader.GetString("account_type_choose_error");
                    NotifyUser(msg, NotifyType.ErrorMessage);
                    UpdateGUIWhenStopProgressImportContact();
                    return false;
                }
                else if (suggestedHostType.Count == 1)
                {
                    hostType = suggestedHostType.FirstOrDefault();
                    var suggestedAccount = GridViewImports.ContainerFromItem(GridViewImports.Items.FirstOrDefault(g => ((ControlInfoAccountType)g).HostType.Equals(hostType))) as GridViewItem;
                    if (suggestedAccount != null)
                    {
                        GridViewImports.SelectionChanged -= GridViewImports_SelectionChanged;
                        suggestedAccount.IsSelected = true;
                        GridViewImports.SelectionChanged += GridViewImports_SelectionChanged;
                        NotifyUser(string.Empty, NotifyType.ErrorMessage);
                    }
                }
                else
                {
                    string msg = UC_AddressBook.ResourcesStringLoader.GetString("account_type_error");
                    NotifyUser(msg, NotifyType.ErrorMessage);
                    UpdateGUIWhenStopProgressImportContact();
                    return false;
                }
            }

            if (!MyUtils.IsEmailValid(accountText))
            {
                string msg = UC_AddressBook.ResourcesStringLoader.GetString("wrong_email_format");
                //Modals.UIConfirmPopup.ShowAsyncInfoPopup(msg);
                NotifyUser(msg, NotifyType.ErrorMessage);
                tbox_account.Focus(FocusState.Programmatic);
                UpdateGUIWhenStopProgressImportContact();
                return false;
            }

            if (pass.Length == 0)
            {
                string msg = UC_AddressBook.ResourcesStringLoader.GetString("please_enter_password");
                NotifyUser(msg, NotifyType.ErrorMessage);
                tbox_password.Focus(FocusState.Programmatic);
                UpdateGUIWhenStopProgressImportContact();
                return false;
            }

            return true;
        }