Пример #1
0
        private async void InquiryList_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            _ = sender;

            if (e.OriginalSource.GetType() == typeof(Grid))
            {
                return;
            }

            // If password file is not loaded, ignore this operation.
            if (null == m_PasswordFile)
            {
                return;
            }

            // If in Read-Only mode, ignore this operation.
            if (!m_EnableEdit)
            {
                return;
            }

            // If Account list item is not selected, ignore this event
            if (m_SelectedAccount < 0 || m_SelectedAccount >= m_PasswordFile.GetCount())
            {
                return;
            }

            int         idx = InquiryList.SelectedIndex;
            AccountInfo ai  = m_PasswordFile.GetAccountInfo(m_SelectedAccount);

            // show edit dialog
            string      hiddenString = GlbFunc.GetResourceString("PASS_HIDDEN_STRING", "******");
            EditInquiry d            = new EditInquiry(CreateEditInquiryCondidateDic());

            d.ItemName      = ai.GetInquiryName(idx);
            d.ItemValue     = ai.GetInquiryValue(idx);
            d.HideItemValue = ai.GetHideFlag(idx);
            await d.ShowAsync();

            if (!d.IsOK)
            {
                return;
            }

            ai.SetInquiry(idx, d.ItemName, d.ItemValue, d.HideItemValue);
            m_InquiryList_ItemTitles[idx].Text = d.ItemName;
            if (d.HideItemValue)
            {
                m_InquiryList_ItemTexts[idx].Text = hiddenString;
            }
            else
            {
                m_InquiryList_ItemTexts[idx].Text = d.ItemValue;
            }

            // Save explicitly
            SaveAccountFile();
        }
Пример #2
0
        // Add inquiry button is clicked.
        private async void AddInquiryButton_Click(object sender, RoutedEventArgs e)
        {
            _ = sender;
            _ = e;

            // If password file is not loaded, ignore this operation.
            if (null == m_PasswordFile)
            {
                return;
            }

            // If in Read-Only mode, ignore this operation.
            if (!m_EnableEdit)
            {
                return;
            }

            // If Account list item is not selected, ignore this event
            if (m_SelectedAccount < 0 || m_SelectedAccount >= m_PasswordFile.GetCount())
            {
                return;
            }

            int idx = m_PasswordFile.GetAccountInfo(m_SelectedAccount).GetInquiryCount();

            // Get new inquiry info
            AccountInfo ai = m_PasswordFile.GetAccountInfo(m_SelectedAccount);
            EditInquiry d  = new EditInquiry(CreateEditInquiryCondidateDic());

            d.ItemName      = "";
            d.ItemValue     = "";
            d.HideItemValue = false;
            await d.ShowAsync();

            if (!d.IsOK)
            {
                return;
            }

            ai.InsertInquiryFromPlainValue(idx, d.ItemName, d.ItemValue, d.HideItemValue);
            UpdateInquiryList(m_SelectedAccount);
            InquiryList.SelectedIndex = idx;

            // Save explicitly
            SaveAccountFile();
        }