public TimeSyncForm(LuteBotForm parent) { this.parent = parent; InitializeComponent(); serverIP = ConfigManager.GetProperty(PropertyItem.Server); serverBox.Text = serverIP; // Run a timer to check system time every 10ms or maybe faster System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); t.Interval = 10; t.Tick += T_Tick; t.Enabled = true; t.Start(); // We'll also update our server time every second or so System.Windows.Forms.Timer serverTimer = new System.Windows.Forms.Timer(); serverTimer.Interval = 5000; serverTimer.Tick += ServerTimer_Tick; serverTimer.Enabled = true; serverTimer.Start(); System.Windows.Forms.Timer pingTimer = new System.Windows.Forms.Timer(); pingTimer.Interval = 1000; pingTimer.Tick += PingTimer_Tick; pingTimer.Enabled = true; pingTimer.Start(); dateTimeOffsetMS = (int)(DateTime.UtcNow - GetNetworkTime()).TotalMilliseconds; // Set initial value }
public GuildLibraryForm(LuteBotForm form) { InitializeComponent(); InitGridView(); mainForm = form; searchBox.TextChanged += SearchBox_TextChanged; searchBox.KeyPress += SearchBox_KeyPress; Directory.CreateDirectory(appdata_PATH + songs_FOLDER); if (File.Exists(appdata_PATH + log_FILENAME)) { //File.Copy(appdata_PATH + log_FILENAME, appdata_PATH + log_FILENAME + DateTime.Now.ToString("MM.dd-HH.mm.ss") + ".backup"); // No need to keep backups of the log files really File.Delete(appdata_PATH + log_FILENAME); } }