Example #1
0
        private List <TimeSeriesNote> LoadNotes(IDbClient dbClient)
        {
            if (RowNotes.Any())
            {
                return(RowNotes);
            }

            if (string.IsNullOrWhiteSpace(Context.DbNotesQuery))
            {
                return(new List <TimeSeriesNote>());
            }

            var query = ResolveQuery(Context.DbNotesQuery, nameof(Context.DbNotesQuery));

            var table = dbClient.ExecuteTable(query);

            ValidateTable(table, new List <Field>
            {
                Context.NoteStartField,
                Context.NoteEndField,
                Context.NoteTextField,
            });

            return(table
                   .Rows.Cast <DataRow>()
                   .Select(ConvertRowToNote)
                   .Where(note => note != null)
                   .ToList());
        }
Example #2
0
    void Start()
    {
        m_thisButton = GetComponent <Button>();
        m_colorBlock = m_thisButton.colors;
        m_rowNotes   = FindObjectOfType <RowNotes>();

        // Subscribe to 16th notes
        RhythmTracker.instance.Subscribe(OnBeat, RhythmTracker.TriggerTiming.Sixteenths);
    }
        protected void AddRowNote(Instant time, string text)
        {
            if (string.IsNullOrWhiteSpace(text))
            {
                CurrentNote = null;
                return;
            }

            if (CurrentNote != null && CurrentNote.NoteText == text)
            {
                // Extend the last note
                CurrentNote.TimeRange = new Interval(CurrentNote.TimeRange?.Start ?? time, time);
                return;
            }

            CurrentNote = new TimeSeriesNote
            {
                TimeRange = new Interval(time, time),
                NoteText  = text
            };

            RowNotes.Add(CurrentNote);
        }