Example #1
0
        private void button1_click(object sender, EventArgs e)
        {
            //SetAC9HPSystemTime timercontrol = new SetAC9HPSystemTime();
            DateTime s = DateTime.Now;

            label2.Text = "Last Time Set: " + SetAC9HPSystemTime.SetTime(GetNetworkTime(GovCheck.Checked), LastTime).ToString();
            DateTime et = DateTime.Now;
            TimeSpan ts = (et - s);

            LastTime     = ts.Milliseconds;
            MSLabel.Text = LastTime.ToString() + " ms";
        }
Example #2
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            ticks2 += 1;
            if (ticks2 > 15)
            {
                if (ServiceManager.isServiceRunning("W32Time"))
                {
                    WT.BackColor = Color.Green;
                }
                else
                {
                    WT.BackColor = Color.Red;
                }

                if (ServiceManager.isServiceRunning("Dimension4"))
                {
                    D4.BackColor = Color.Green;
                }
                else
                {
                    D4.BackColor = Color.Red;
                }

                ticks2 = 0;
                DateTime start = DateTime.Now;

                DateTime dn = GetNetworkTime(GovCheck.Checked);
                if (dn.ToString("yyyymmdd").Equals("18990101"))
                {
                    return;
                }
                if (dn < oldestDate)
                {
                    return;
                }

                if (!(DateTime.Now.ToString().Equals(dn.ToString())))
                {
                    if (AdminLabel.BackColor == Color.LightGreen)
                    {
                        if (checkBox1.Checked)
                        {
                            DateTime st = DateTime.Now;
                            label2.Text      = "Auto Sync: " + SetAC9HPSystemTime.SetTime(dn, LastTime);
                            label2.BackColor = Color.LightSeaGreen;
                            DateTime et = DateTime.Now;
                            TimeSpan ts = (et - st);
                            LastTime     = ts.Milliseconds;
                            MSLabel.Text = LastTime.ToString() + " ms";
                        }
                    }
                }

                //dock with flex helper app if its running.
                foreach (System.Diagnostics.Process p in System.Diagnostics.Process.GetProcesses())
                {
                    if (p.ProcessName.Equals("TouchRadio"))
                    {
                        try
                        {
                            if (FlexDock.Checked)
                            {
                                PositionWindow.Rect myrect = PositionWindow.getpos("TouchRadio");
                                this.Top  = myrect.Top - 200;
                                this.Left = myrect.Left;
                            }
                        }
                        catch (Exception ex)
                        { }
                    }
                }
            }
        }