Ejemplo n.º 1
0
        private void DisposeRenderer()
        {
            seekt.Stop();
            seekt.Tick -= Seekt_Tick;

            Utils.Animation.Visible va = new Utils.Animation.Visible();
            va.Animate(Config.Current.Animation[Enums.Animation.Default], TimeL, Visibility.Hidden);
            TimeL.Content = "00:00 / 00:00";

            if (Renderer != null)
            {
                Renderer.PlaybackStopped -= Renderer_PlaybackStopped;

                Renderer.StreamStatus = Audio.Status.Stopped;
                Renderer.Dispose();
                Renderer = null;
                SetPlaybackState(NAudio.Wave.PlaybackState.Stopped);
            }

            RaiseEvent(LAPP.Player.Receiver.Action.RendererDisposed);
        }
Ejemplo n.º 2
0
        internal void StopFile(bool ClearImage)
        {
            Dialogs.LogWindow.Append("Stop");
            MC.MediaStateButton.MediaState = MVPUC.Buttons.MediaStateButton.State.Play;

            DisposeRenderer();

            if (ClearImage)
            {
                Utils.Animation.SwitchVisibility sv = new Utils.Animation.SwitchVisibility();
                if (MediaInformationRoot.Visibility == Visibility.Visible)
                {
                    sv.Animate(Config.Current.Animation[Enums.Animation.Default], LibraryRoot, MediaInformationRoot);
                }

                if (bgImage.Image != null)
                {
                    Utils.Animation.Visible va      = new Utils.Animation.Visible();
                    EventHandler            handler = null;
                    handler = (sender, e) =>
                    {
                        bgImage.Image = null;
                        Dialogs.LogWindow.Append("Image Removed");
                        va.AnimationCompleted -= handler;
                    };
                    va.AnimationCompleted += handler;

                    va.Animate(Config.Current.Animation[Enums.Animation.Default], bgImage, Visibility.Hidden);
                }
                MC.HideStatus();

                SetPlaybackState(NAudio.Wave.PlaybackState.Stopped);
            }

            SeekBar.Value = SeekBar.Minimum;
            if (TaskbarManager != null)
            {
                TaskbarManager.HideButtons();
            }
        }
Ejemplo n.º 3
0
        public bool RenderFile(LAPP.IO.MediaFile File, bool AutoRun = true)
        {
            try
            {
                InitializeRenderer(File);

                TitleT.Content  = File.Title;
                ArtistT.Content = File.Artist;
                AlbumT.Content  = File.Album;
                //TODO Plugin Events
            }
            catch (Exception ex)
            {
                Dialogs.LogWindow.Append(ex.Message);
                StopFile(true);
                Utils.Notification na = new Utils.Notification(ParentGrid,
                                                               Localize.Get("RENDERING_ERROR"), Constants.ErrorBrush);
                na.ShowMessage();
                return(false);
            }

            SeekBar.Maximum = Renderer.AudioFileReader.Length;
            ApplyVolume();

            Utils.Animation.Visible ta = new Utils.Animation.Visible();
            ta.Animate(Config.Current.Animation[Enums.Animation.Default], TimeL, Visibility.Visible);

            seekt.Interval = 20;
            seekt.Start();
            seekt.Tick += Seekt_Tick;

            MC.MediaStateButton.SwitchMediaState();

            bgImage.Image = File.Artwork;

            if (bgImage.Visibility == Visibility.Hidden)
            {
                Utils.Animation.Visible va = new Utils.Animation.Visible();
                va.Animate(Config.Current.Animation[Enums.Animation.BackgroundImage], bgImage, Visibility.Visible);
            }

            MC.PlayingStatus.Title = File.Title;
            MC.PlayingStatus.Album = File.Album;
            MC.PlayingStatus.Image = File.Artwork;
            MC.VisibleStatus();

            PlayingFile = File;

            TaskbarManager.VisibleButtons();

            if (AutoRun)
            {
                RunFile();
            }

            PluginPanel.Children.Clear();
            FrameworkElement[] elements = Utils.PluginManager.GetMediaPanelItems().ToArray();
            for (int i = 0; elements.Length > i; i++)
            {
                PluginPanel.Children.Add(elements[i]);
            }

            return(true);
        }