Пример #1
0
        public override void OnDestroyView()
        {
            UnbindMusicControllerEvents();
            WallpaperPublisher.ReleaseWallpaper();

            UnbindViewEvents();
            UnbindViews();

            base.OnDestroyView();
        }
Пример #2
0
 public override void OnDestroy()
 {
     tvAlbum         = null;
     tvArtist        = null;
     tvTitle         = null;
     skbSeekSongTime = null;
     MusicController.MediaPlaybackChanged       -= MusicController_MediaPlaybackChanged;
     MusicController.MediaMetadataChanged       -= MusicController_MediaMetadataChanged;
     MusicControllerKitkat.MediaMetadataChanged -= MusicControllerKitkat_MediaMetadataChanged;
     MusicControllerKitkat.MediaPlaybackChanged -= MusicControllerKitkat_MediaPlaybackChanged;
     WallpaperPublisher.CurrentWallpaperCleared -= WallpaperPublisher_CurrentWallpaperHasBeenCleared;
     WallpaperPublisher.ReleaseWallpaper();
     timer.Elapsed -= Timer_Elapsed;
     timer.Dispose();
     base.OnDestroy();
 }
Пример #3
0
 private void WidgetStatusPublisher_OnWidgetStatusChanged(object sender, WidgetStatusEventArgs e)
 {
     if (e.WidgetName == "MusicFragment")
     {
         if (e.Show)
         {
             if (maincontainer != null)
             {
                 if (initForFirstTime == true)
                 {
                     RetrieveMediaInformation(); //Retrieving media information is when the music widget has never been used before.
                     //so it needs information to fill its views.
                     initForFirstTime = false;
                 }
                 maincontainer.Visibility = ViewStates.Visible;
             }
         }
         else
         {
             if (maincontainer != null)
             {
                 maincontainer.Visibility = ViewStates.Invisible;
                 //Also release Wallpaper, if holded.
                 WallpaperPublisher.ReleaseWallpaper();
             }
         }
     }
     if (e.WidgetName == "NotificationFragment")
     {
         if (e.Show)
         {
             if (maincontainer != null)
             {
                 maincontainer.Visibility = ViewStates.Invisible;
             }
         }
         else
         {
             if (maincontainer != null && WidgetStatusPublisher.CurrentActiveWidget == "MusicFragment")
             {
                 maincontainer.Visibility = ViewStates.Visible;
             }
         }
     }
 }