Esempio n. 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);
            }
        }
Esempio n. 2
0
        private void LoadMedia(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog
            {
                Filter = Audion.OutputSource.SupportedFiles
            };

            if (openFileDialog.ShowDialog() == true)
            {
                output.Load(openFileDialog.FileName);
                OutputMediaPath.Text = openFileDialog.FileName;
            }
        }
Esempio n. 3
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"));
        }