Source

KeeOtp / Troubleshooting.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Windows.Forms;

namespace KeeOtp
{
    public partial class Troubleshooting : Form
    {
        public Troubleshooting()
        {
            InitializeComponent();
        }

        private void buttonPingGoogle_Click(object sender, EventArgs e)
        {
            try
            {
                using (var wc = new WebClient())
                {
                    wc.DownloadData("https://www.google.com");
                    var dateHeader = wc.ResponseHeaders.Get("Date");
                    var date = DateTime.Parse(dateHeader);

                    var offset = date.ToUniversalTime() - DateTime.UtcNow;

                    if (offset.TotalSeconds == 0)
                        MessageBox.Show("Your time is perfect according to Google's servers");
                    else if (offset.TotalSeconds <= 5)
                        MessageBox.Show("Your time is off by five seconds or less from Google's servers.  You should be just fine.");
                    else
                        MessageBox.Show(string.Format("Your time is off by {0} seconds from Google's servers.  Try correcting the difference and try again.", offset.TotalSeconds));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }

        private void buttonTroubleshootingWebsite_Click(object sender, EventArgs e)
        {
            // go to the troubleshooting page
            var url = "https://bitbucket.org/devinmartin/keeotp/wiki/Troubleshooting";
            Process ps = new Process();
            ps.StartInfo = new ProcessStartInfo(url);
            ps.Start();
        }
    }
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.