public void SetGrid(LogonsList data) { code = data.OverrideCode; MaxLogons = data.MaxLogons; Usertype = data.UserType; label2.Text = (Usertype == UT.Student) ? string.Format(label2.Text, MaxLogons) : "Check you logged on to these computers"; foreach (trackerlogentrysmall entry in data.Logons) { dataGridView1.Rows.Add(entry.ComputerName, entry.DomainName, DateTime.Parse(entry.LogOnDateTime).ToString("f"), "Logoff"); } CheckCount(); }
void c_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) { closing = true; if (e.Error == null) { LogonsList list = JsonConvert.DeserializeObject <LogonsList>(e.Result); if (list.Logons.Length > 0) { Background bg = new Background(); bg.Main.SetGrid(list); bg.Main.baseurl = baseurl; bg.ShowDialog(this); } } if (action == Action.Logon) { Process proc = new Process(); proc.StartInfo.FileName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), "HAP Logon Tracker Notifier.exe"); proc.StartInfo.Arguments = baseurl; proc.Start(); } Close(); }