Пример #1
0
        public void LoadFile(string filepath)
        {
            ListBoxViewModel2 item = ListBoxVm.soundFiles.Where(x => x.FullPath.Equals(filepath)).FirstOrDefault();

            if (item == null)
            {
                Focus();
                item = new ListBoxViewModel2
                {
                    Content  = Path.GetFileName(filepath),
                    Data     = null,
                    FullPath = filepath,
                    Folder   = string.Empty
                };

                ListBoxVm.soundFiles.Add(item);

                if (ListBoxVm.soundFiles.Count == 1) // auto play if one in queue
                {
                    output.Stop();
                    output.Load(filepath);
                    output.Play();
                    Sound_LstBox.SelectedIndex = 0;

                    string name = Path.GetFileName(filepath);
                    InputFileVm.inputFileViewModel.Set(name, output);
                    DiscordIntegration.Update(string.Empty, string.Format(Properties.Resources.Listening, name));
                    PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
                }
                else
                {
                    Sound_LstBox.SelectedIndex = ListBoxVm.soundFiles.IndexOf(item);
                    Sound_LstBox.ScrollIntoView(item);
                }
            }
            else
            {
                Focus();
                Sound_LstBox.SelectedIndex = ListBoxVm.soundFiles.IndexOf(item);
                Sound_LstBox.ScrollIntoView(item);
            }
        }
Пример #2
0
        public void LoadFile(string filepath)
        {
            Focus();

            output.Stop();
            output.Load(filepath);
            output.Play();

            string name = Path.GetFileName(filepath);

            InputFileVm.inputFileViewModel.Set(name, output);
            DiscordIntegration.Update(string.Empty, string.Format(Properties.Resources.Listening, name));
            PlayPauseImg.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/pause.png"));
        }
Пример #3
0
 private void Play(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     output.Play();
 }