private void taskList_SelectionChanged(object sender, SelectionChangedEventArgs e) { labelTimer.Foreground = new SolidColorBrush(Colors.Green); //unless set otherwise below SolidColorBrush standardBackgroundBrush = new SolidColorBrush(Color.FromRgb(215, 228, 242)); SolidColorBrush notificationBrush1 = new SolidColorBrush(Color.FromRgb(129, 137, 145)); SolidColorBrush notificationBrush2 = new SolidColorBrush(Color.FromRgb(129, 137, 145)); if (taskList.SelectedIndex == 9) { //last ticks item before jitter demo gridMainForm.Background = notificationBrush1; } else if (taskList.SelectedIndex == 17) { //last jitter item before ISIP gridMainForm.Background = notificationBrush2; } else { //returning to normal color after warning items gridMainForm.Background = standardBackgroundBrush; } // hacky hacky hack to go to the listen-only jitter item before following through to the set list. if (taskList.SelectedIndex == 10) { Clipboard.SetText("T25"); MessageBox.Show("(1) Advancing to the jitter items. (2) Copied the 'listen only' version. Click OK when done to proceed (copy the first jitter practice item and run the timer)."); } //then follow through to the next task in the order (either jits practice 500 or 800): if (taskList.SelectedIndex > -1) { taskType selectedTask = tasks[taskList.SelectedIndex]; string toCopy = getTaskIDCommand(selectedTask); Clipboard.SetText(toCopy); labelNotify.Text = String.Concat("Copied: ", getTaskIDCommand(selectedTask), "\n (for ", selectedTask.taskName, ")"); //get timer stuff timeRemaining = selectedTask.duration + taskDurationAdjustment; TimeSpan t = TimeSpan.FromSeconds(timeRemaining); string answer = string.Format("{0:D1}:{1:D2}", t.Minutes, t.Seconds); dispatcherTimer.Start(); } }
private string getTaskIDCommand(taskType t) { int idOfReceivedTask = t.taskID; string leadingzero = ""; if (idOfReceivedTask < 10) { leadingzero = "0"; } string s = "T" + leadingzero + idOfReceivedTask.ToString(); return(s); }
private void Window_Loaded(object sender, RoutedEventArgs e) { //orderedTaskSet = new List<taskType>(); flashToggle = true; taskDurationAdjustment = 4; textTimerAdjustment.Text = taskDurationAdjustment.ToString(); dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); dispatcherTimer.Interval = new TimeSpan(0, 0, 1); dispatcherTimer.Start(); tasks = new List <taskType>(); taskSetNames = new String[26]; taskSetNames[ID_TICKS_PRAC_500] = "ID_TICKS_PRAC_500"; taskSetNames[ID_TICKS_PRAC_800] = "ID_TICKS_PRAC_800"; taskSetNames[ID_T1_SMS_500] = "ID_T1_SMS_500"; taskSetNames[ID_T1_SMS_800] = "ID_T1_SMS_800"; taskSetNames[ID_TICKS_ISO_T2_500] = "ID_TICKS_ISO_T2_500"; taskSetNames[ID_TICKS_ISO_T2_800] = "ID_TICKS_ISO_T2_800"; taskSetNames[ID_TICKS_LINEAR_500] = "ID_TICKS_LINEAR_500"; taskSetNames[ID_TICKS_LINEAR_800] = "ID_TICKS_LINEAR_800"; taskSetNames[ID_TICKS_PHASESH_500] = "ID_TICKS_PHASESH_500"; taskSetNames[ID_TICKS_PHASESH_800] = "ID_TICKS_PHASESH_800"; taskSetNames[ID_JITS_PRAC_500] = "ID_JITS_PRAC_500"; taskSetNames[ID_JITS_PRAC_800] = "ID_JITS_PRAC_800"; taskSetNames[ID_JITS_ISO_500] = "ID_JITS_ISO_500"; taskSetNames[ID_JITS_ISO_800] = "ID_JITS_ISO_800"; taskSetNames[ID_JITS_LINEAR_500] = "ID_JITS_LINEAR_500"; taskSetNames[ID_JITS_LINEAR_800] = "ID_JITS_LINEAR_800"; taskSetNames[ID_JITS_PHASESH_500] = "ID_JITS_PHASESH_500"; taskSetNames[ID_JITS_PHASESH_800] = "ID_JITS_PHASESH_800"; taskSetNames[ID_ISIP_500] = "ID_ISIP_500"; taskSetNames[ID_ISIP_800] = "ID_ISIP_800"; taskSetNames[ID_PATT_PRAC] = "ID_PATT_PRAC"; taskSetNames[ID_IMPROV_METRO] = "ID_IMPROV_METRO"; taskSetNames[ID_IMPROV_MELODY] = "ID_IMPROV_MELODY"; taskSetNames[ID_REMOVED] = "ID_REMOVED"; taskSetNames[ID_MELODYACC] = "ID_MELODYACC"; taskSetNames[ID_PATT_REC] = "ID_PATT_REC"; for (int i = 0; i < taskSetNames.Count(); i++) { taskType t = new taskType(); t.recordingIntervalCount = taskSetRecordingIntervalCount[i]; t.stimulusCount = taskSetStimulusCount[i]; t.taskName = taskSetNames[i]; t.avgInterval = taskSetAvgInterval[i]; t.duration = taskDurations[i]; t.usedInSet = taskSetUsedInSet[i]; t.taskID = taskSetArduinoTaskID[i]; tasks.Add(t); } for (int i = 0; i < tasks.Count; i++) { if (!tasks[i].usedInSet) { tasks.RemoveAt(i); } } /* * foreach (taskType t in tasks) { * //orderedTaskSet.Add(t); * taskList.Items.Add(t.taskName + " [" + t.taskID + "] " + * t.stimulusCount + ":" + t.recordingIntervalCount); * } */ }