private void Window_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string item in files) { if (!item.isFormats(StaticFormatsSound.FormatsSound)) { continue; } SoundEngine se = new SoundEngine(); se.Sound(item); DPanelSound dPanelSound = new DPanelSound() { NameSound = se.Name, Path = item, TotalTime = se.TotalTime(), INDEX = StakPanelListSound.Children.Count }; dPanelSound.EventMouseButtonHandler += (oo, ee) => { SetCurSound(dPanelSound); }; dPanelSound.REventMouseButtonHandler += (oo, ee) => { StakPanelListSound.Children.RemoveAt(dPanelSound.INDEX); cur_list_sound.RemoveID(dPanelSound.INDEX); }; dPanelSound.Update(); StakPanelListSound.Children.Add(dPanelSound); cur_list_sound.AddStr(item); } SystemIO.Write(SOUND_LIST_ALL.path, SOUND_LIST_ALL_serializer.Serialize(cur_list_sound)); } }
public void UpdateSoundList() { StakPanelListSound.Children.Clear(); for (int i = 0; i < cur_list_sound.Count(); i++) { string item = cur_list_sound.GetStrID(i); if (!item.isFormats(StaticFormatsSound.FormatsSound)) { continue; } SoundEngine se = new SoundEngine(); se.Sound(item); DPanelSound dPanelSound = new DPanelSound() { NameSound = se.Name, Path = item, TotalTime = se.TotalTime(), INDEX = StakPanelListSound.Children.Count }; dPanelSound.EventMouseButtonHandler += (oo, ee) => { SetCurSound(dPanelSound); }; dPanelSound.REventMouseButtonHandler += (oo, ee) => { cur_list_sound.RemoveSteing(dPanelSound.Path); UpdateSoundList(); SystemIO.Write(SOUND_LIST_ALL.path, SOUND_LIST_ALL_serializer.Serialize(cur_list_sound)); }; dPanelSound.Update(); StakPanelListSound.Children.Add(dPanelSound); } }