class PlaylistSelectorView : View
{
+
+ private const int DisposeTimerInterval = 100;
+
private View selectPlaylistContentArea;
private View createPlaylistContentArea;
private View inputArea;
private TextField textField;
private Button crossButton;
private readonly PlaylistSelectorViewModel viewModel;
+ private Timer disposeTimer;
public event EventHandler<PlaylistMemberAddEventArgs> PlaylistMemberAdd;
};
Window.Instance.Add(selectPlaylistDialog);
selectPlaylistDialog.BackKeyPressed += OnBackKeyPressed;
+ disposeTimer = new Timer(DisposeTimerInterval);
+ disposeTimer.Tick += OnTimerTick;
}
private TextLabel CreateAlertDialogTitle(string titleText)
OnBackKey();
}
+ private bool OnTimerTick(object source, Timer.TickEventArgs e)
+ {
+ //This should be the last statement anything done should be before this statement.
+ Tizen.Log.Debug(AppConstants.LogTag, "Deleting the Playlist selector view");
+ DeleteSelectorView();
+ return false;
+ }
+
private void AddSelectPlaylistContentArea()
{
selectPlaylistContentArea = new View()
collectionView.SelectedItem = null;
return;
}
- else
+ else if(status == PlaylistMemberAddStatus.PlaylistCreationFailed)
{
- Tizen.Log.Error(AppConstants.LogTag, "Failed to add track to playlist");
+ ShowInfoMessage("Failed to create playlist");
+ collectionView.SelectedItem = null;
+ return;
}
- if(createPlaylistDialog != null && createPlaylistDialog.IsOnWindow)
+ else if (status == PlaylistMemberAddStatus.Failed)
+ {
+ ShowInfoMessage("Failed to add member to playlist");
+ collectionView.SelectedItem = null;
+ return;
+ }
+ else if(status == PlaylistMemberAddStatus.Added)
+ {
+ Tizen.Log.Debug(AppConstants.LogTag, "Tracks are added to playlist");
+ }
+
+ if (createPlaylistDialog != null && createPlaylistDialog.IsOnWindow)
{
RemoveTheCreatePopup();
}
PlaylistMemberAdd?.Invoke(this, new PlaylistMemberAddEventArgs(PlaylistMemberAddStatus.Added));
RemoveTheSelectPopup();
- DeleteSelectorView();
+
+ // Starting the dispose timer as we can't delete the collection view in the current callback
+ disposeTimer.Start();
}
private void AddNoListText()
selectPlaylistDialog?.Dispose();
selectPlaylistDialog = null;
selectPlaylistContentArea = null;
+
+ // This should be deleted last;
+ disposeTimer.Dispose();
+ disposeTimer = null;
}
base.Dispose(type);