コード例 #1
0
        private void addWebsiteToListView(KP2faC_Website website)
        {
            ListViewItem lvi = new ListViewItem(website.name);

            if (website.is2faPosssible())
            {
                lvi.BackColor = Color.LightGreen;
                lvi.SubItems.Add("Yes - " + website.getTfa());
                lvi.ImageIndex  = (int)PwIcon.Checked;
                lvi.ToolTipText = "URL: " + website.url;

                if (!string.IsNullOrEmpty(website.exception))
                {
                    lvi.ImageIndex  = (int)PwIcon.Warning;
                    lvi.ToolTipText = lvi.ToolTipText + "\nException: " + website.exception;
                }
            }
            else
            {
                lvi.BackColor = Color.LightSalmon;
                lvi.SubItems.Add("No");
                lvi.ImageIndex  = (int)PwIcon.Expired;
                lvi.ToolTipText = "Tell them to support 2fa:\n (Double click)";
            }
            lvi.Tag = website;
            lv_Websites.Items.Add(lvi);
        }
コード例 #2
0
        private void lv_Websites_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var senderList = (ListView)sender;
            var item       = senderList.HitTest(e.Location).Item;

            if (item != null)
            {
                KP2faC_Website website = ((KP2faC_Website)item.Tag);
                if (website.is2faPosssible())
                {
                    if (website.doc != null)
                    {
                        System.Diagnostics.Process.Start(website.doc);
                    }
                    else
                    {
                        MessageBox.Show("Sorry, I cant help you. No Documentation found!", "KP2faChecker - " + website.name, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(website.email_address))
                    {
                        DialogResult dialogResult = MessageBox.Show(website.name + " is not supporting 2fa.\n\nTell them to support 2fa on:\n    Twitter: " + website.twitter + "\n    Facebook: " + website.facebook + "\n    Email: " + website.email_address + "\n\nDo you want to send an email to " + website.name + "?", "KP2faChecker - " + website.name, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                        if (dialogResult == DialogResult.Yes)
                        {
                            System.Diagnostics.Process.Start(Uri.EscapeUriString(string.Format("mailto:{0}?Subject={1}&Body={2}", website.email_address, "Support Two Factor Authentication", "Security is important. We'd like it if you supported two factor auth.\r\n")));
                        }
                    }
                    else
                    {
                        DialogResult dialogResult = MessageBox.Show(website.name + " is not supporting 2fa.\n\nTell them to support 2fa on:\n    Twitter: " + website.twitter + "\n    Facebook: " + website.facebook, "KP2faChecker - " + website.name, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
        }