示例#1
0
        private void Delete_Button_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new SynthDB())
            {
                db.Remove(currentMelodie);

                db.SaveChanges();
            }
        }
示例#2
0
        private void Window_Loaded()
        {
            // Adds key press event to window
            this.KeyDown += new KeyEventHandler(MainWindow_KeyDown);

            // init sounds list for retreiving from database
            List <Sound> s = new List <Sound>();

            // Access database and pull sounds to local list s
            using (var db = new SynthDB())
            {
                s = db.Sounds.ToList();
            }

            // Add sounds to dictionary, using charater inputs as keys
            s.ForEach(o => sounds.Add(o.CharInput, o));
        }
示例#3
0
 private void Save_Button_Click(object sender, RoutedEventArgs e)
 {
     Console.WriteLine("hello");
     using (var db = new SynthDB())
     {
         if (currentMelodie == null)
         {
             var m = new Melodie
             {
                 CharMelodie = MelodieBox.Text
             };
             currentMelodie = m;
             db.Melodies.Add(m);
         }
         else
         {
             db.Melodies.Update(currentMelodie);
         }
         db.SaveChanges();
     }
 }