public void SetCanvas(bool isSelected = false) { XmlReader xmlNote; if (isSelected == false) { xmlNote = XmlReader.Create(DirectoryWrapper.GetPathCurrentSolution() + "/Frusciantifier/Notes/Standard/" + this.Name + ".xml"); } else { xmlNote = XmlReader.Create(DirectoryWrapper.GetPathCurrentSolution() + "/Frusciantifier/Notes/Highlighted/" + this.Name + ".xml"); } Canvas = (Canvas)XamlReader.Load(xmlNote); Canvas.Tag = new Cell(this.Column, this.Row); }
public static void Create(Dictionary <ContentControl, MeasureViewModel> measures) { List <MidiStandardNote> midiStandardNotes = new List <MidiStandardNote>(); foreach (MeasureViewModel measureViewModel in measures.Values) { foreach (KeyValuePair <NotesKey, Note> kp in measureViewModel.measure.Notes) { Note note = kp.Value; MidiStandardNote midiStandardNote = new MidiStandardNote(); midiStandardNote.Duration = (float)note.Duration / 4; midiStandardNote.Time = (float)note.Column / 4; midiStandardNote.Degree = RowToDegree(note.Row); midiStandardNotes.Add(midiStandardNote); } } string json = JsonConvert.SerializeObject(midiStandardNotes, Formatting.Indented); System.IO.File.WriteAllText(DirectoryWrapper.GetPathCurrentSolution() + "/Song.json", json); }