using MusicPlayer.Models;
using MusicPlayer.Common;
using MusicPlayer.Core;
+using MusicPlayer.Views.Utils;
using Tizen.NUI;
using Tizen.Multimedia;
using System.Threading.Tasks;
else if(e.Type == EventType.Error)
{
Tizen.Log.Error(AppConstants.LogTag, "ThreadId: " + System.Threading.Thread.CurrentThread.ManagedThreadId + ", Error Occured: " + e.Description);
+ ErrorPopup errorPopup = new ErrorPopup();
+ errorPopup.GetAlertDialog().Message = e.Description;
+ PlayNext();
}
}
}
if(subcontentView != null)
{
- Tizen.Log.Error(AppConstants.LogTag, "subcontent view already added , remove it first");
- return;
+ Tizen.Log.Error(AppConstants.LogTag, "subcontent view already added , removing it first");
+ RemoveSubContentView();
}
subContentViewContainer.Show();
subContentViewContainer.Add(baseSubContentView);
--- /dev/null
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+using MusicPlayer.Common;
+
+namespace MusicPlayer.Views.Utils
+{
+ class ErrorPopup : View
+ {
+ private Button okButton;
+ private AlertDialog errorDialog;
+ public ErrorPopup() : base()
+ {
+ AddOkButton();
+ errorDialog = new AlertDialog()
+ {
+ Size2D = new Size2D(1184, 368),
+ Title = "Unable to play track",
+ Message = "",
+ Actions = new List<View> { okButton },
+ };
+
+ TextLabel textLabel = (TextLabel)errorDialog.TitleContent;
+ textLabel.FontStyle = UIFontStyles.AllNormal;
+ Window.Instance.Add(errorDialog);
+ }
+
+ private void AddOkButton()
+ {
+ okButton = new Button()
+ {
+ Text = "OK",
+ };
+ okButton.TextLabel.FontStyle = UIFontStyles.AllNormal;
+ okButton.IsSelectable = true;
+ okButton.Clicked += OkButtonClicked;
+ }
+
+ private void OkButtonClicked(object sender, ClickedEventArgs e)
+ {
+ RemoveThePopup();
+ }
+
+ public void RemoveThePopup()
+ {
+ Window.Instance.Remove(errorDialog);
+ Dispose(DisposeTypes.Explicit);
+ }
+
+ public AlertDialog GetAlertDialog()
+ {
+ return errorDialog;
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (Disposed)
+ {
+ return;
+ }
+ if (type == DisposeTypes.Explicit)
+ {
+ errorDialog?.Dispose();
+ errorDialog = null;
+ okButton?.Dispose();
+ okButton = null;
+ }
+
+ base.Dispose(type);
+ }
+ }
+}