コード例 #1
0
        private Pattern generate()
        {
            var pattern = new Pattern();

            bool generateHold = endTime - HitObject.StartTime >= 100;

            switch (TotalColumns)
            {
            case 8 when HitObject.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH) && endTime - HitObject.StartTime < 1000:
                addToPattern(pattern, 0, generateHold);

                break;

            case 8:
                addToPattern(pattern, FindAvailableColumn(GetRandomColumn(), PreviousPattern), generateHold);
                break;

            default:
                if (TotalColumns > 0)
                {
                    addToPattern(pattern, GetRandomColumn(), generateHold);
                }
                break;
            }

            return(pattern);
        }
コード例 #2
0
        public void FilterAndJoin()
        {
            //filter subjects by arms
            if (Arms.Any())
            {
                Subjects = Subjects.FindAll(s => Arms.Select(a => a.Id).Contains(s.StudyArmId)).ToList();
            }

            Debug.WriteLine(Subjects.Count, " AFTER ARMS");

            //filter subjects by studies
            if (Studies.Any())
            {
                Subjects = Subjects.FindAll(subj => Studies.Select(st => st.Id).Contains(subj.StudyId)).ToList();
            }
            Debug.WriteLine(Subjects.Count, " AFTER Studies");

            //filter subjects by subCharacteristics
            if (SubjChars.Any())
            {
                Subjects = Subjects.FindAll(s => SubjChars.Select(sc => sc.SubjectId).Contains(s.Id)).ToList();
            }
            Debug.WriteLine(Subjects.Count, " AFTER SubjChars");

            //filter by visits
            //TODO

            //TODO : WILL RETRIEVE SUBJECTS THAT HAVE SAME UNIQUE IDS ACROSS PROJECTS  (i.e. need to load observations to Mongo with
            //TODO: DB subjectId
            //filter observations for filtered subjects
            Observations = Observations?.FindAll(o => Subjects.Select(s => s.UniqueSubjectId).Contains(o.USubjId));

            //filter subjects by selected observations
            if (Observations.Any() && ObservationsFiltered)
            {
                Subjects = Subjects.FindAll(s => Observations.Select(o => o.USubjId).Contains(s.UniqueSubjectId));
            }
            Debug.WriteLine(Subjects.Count, " AFTER syncing with observations");

            //FILTER SAMPLES BY SELECTED AND FILTERED SAMPLE CHARACTERISTICS
            if (SampleCharacteristics.Any())
            {
                Samples = Samples.FindAll(s => SampleCharacteristics.Select(sc => sc.SampleId).Contains(s.Id)).ToList();
            }

            //TODO: TEMP FILTERING BY COLLECTION STUDY DAY


            //SYNCHRONIZE SAMPLES AND SUBJECTS
            if (Samples.Any())
            {
                Samples  = Samples.FindAll(s => Subjects.Select(sc => sc.Id).Contains(s.SubjectId)).ToList();
                Subjects = Subjects.FindAll(sb => Samples.Select(sp => sp.SubjectId).Contains(sb.Id)).ToList();
            }
        }
コード例 #3
0
        public void TestDataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGrid      datagrid = sender as DataGrid;
            Point         aP       = e.GetPosition(datagrid);
            IInputElement obj      = datagrid.InputHitTest(aP);

            if (!(obj is Visual))
            {
                return;
            }
            DependencyObject target = obj as DependencyObject;


            while (target != null)
            {
                if (target is DataGridColumnHeader)
                {
                    break;
                }
                target = VisualTreeHelper.GetParent(target);
            }
            if (target is DataGridColumnHeader head)
            {
                var index = head.Column.DisplayIndex - 2;
                var tp    = typeof(SampleInfo).GetProperty("TestItem" + index);
                if (Samples.Any(item => !(bool)(tp.GetValue(item))))
                {
                    foreach (var samp in Samples)
                    {
                        tp.SetValue(samp, true);
                    }
                }
                else
                {
                    foreach (var samp in Samples)
                    {
                        tp.SetValue(samp, false);
                    }
                }
            }
        }