private void LabelRemainingTime_Click() { GlobalsatProtocol device = this.fitnessDevice.Device(); if (device is GlobalsatProtocol2) { GlobalsatProtocol2 device2 = device as GlobalsatProtocol2; JobMonitor jobMonitor = new JobMonitor(); TimeSpan time = device2.GetRemainingTime(jobMonitor); if (!string.IsNullOrEmpty(jobMonitor.ErrorText)) { this.labelRemainingTime.Text = "Remaining time: " + jobMonitor.ErrorText; //MessageDialog.Show(jobMonitor.ErrorText, "", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } else if (time <= TimeSpan.MinValue) { MessageDialog.Show(Properties.Resources.Device_Unsupported, "", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } else { this.labelRemainingTime.Text = "Remaining time: " + time; } } }
private void ButtonDelete_Click(object sender, EventArgs e) { GlobalsatProtocol device = this.fitnessDevice.Device(); //device should already be checked, no error if (device is GlobalsatProtocol2) { //Delete date time not fully working, keep structure for now DateTime oldest = DateTime.MaxValue; //this.dateTimePickerOldest.Value.ToLocalTime().ToShortDateString() //string msg = string.Format("Are you sure you want to delete all activities older than {0}?", this.dateTimePickerOldest.Value.ToLocalTime().ToShortDateString()); string msg = string.Format("Are you sure you want to delete all device activities?"); if (MessageDialog.Show(msg, "", System.Windows.Forms.MessageBoxButtons.OKCancel, System.Windows.Forms.MessageBoxIcon.Question) == DialogResult.OK) { GlobalsatProtocol2 device2 = device as GlobalsatProtocol2; JobMonitor jobMonitor = new JobMonitor(); int n = device2.DeleteTracks(oldest, jobMonitor); if (!string.IsNullOrEmpty(jobMonitor.ErrorText)) { msg = jobMonitor.ErrorText; } else if (n >= 0) { msg = string.Format("Deleted {0} activities", n); } else { msg = string.Format("Failed to delete activities"); } MessageDialog.Show(msg, "", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } } }
public ImportJob_GH505(GlobalsatProtocol2 device, string sourceDescription, IJobMonitor monitor, IImportResults importResults) : base(device, sourceDescription, monitor, importResults) { }