private void btn_ShowContent_Click(object sender, RoutedEventArgs e) { string extension = txt_MidiFilePath.Text.Split('.').Last(); if (extension == "mid") { ShowMidiTracks(MidiReader.ReadMidi(txt_MidiFilePath.Text)); MidiToObject midiToObject = new MidiToObject(txt_MidiFilePath.Text); IWrapper wrapper = new Wrapper(); wrapper.draw(scrollViewer, midiToObject.getTrackObject()); textBox.Visibility = Visibility.Hidden; tabCtrl_MidiContent.Visibility = Visibility.Visible; } else if (extension == "ly") { initialLilypond = File.ReadAllText(txt_MidiFilePath.Text); textBox.Visibility = Visibility.Visible; tabCtrl_MidiContent.Visibility = Visibility.Hidden; LyToObject lyToObject = new LyToObject(initialLilypond); initialLilypond = new ObjectToLy().convert(lyToObject.getTrackObject()); textBox.Text = initialLilypond; IWrapper wrapper = new Wrapper(); wrapper.draw(scrollViewer, lyToObject.getTrackObject()); } }
private void UpdateStaff(object source, ElapsedEventArgs e) { TimeSpan timeElapsed = DateTime.Now - _now; if (timeElapsed.TotalMilliseconds > 1500 && _typed) { Console.WriteLine("Update!"); _typed = false; Application.Current.Dispatcher.Invoke(new Action(() => { LyToObject lyToObject = new LyToObject(textBox.Text); IWrapper wrapper = new Wrapper(); wrapper.draw(scrollViewer, lyToObject.getTrackObject()); })); } }