*/
using System;
+using System.Threading;
using System.Windows.Input;
using Tizen.Xamarin.Forms.Extension;
using TVMediaHub.Tizen.Controls;
/// <summary>
/// The timer to handle the control area
/// </summary>
- private IntPtr timer = default(IntPtr);
+ Timer timer;
/// <summary>
- /// The interval of the timer
+ /// The due time of the timer
+ /// 5 second
/// </summary>
- private double timerInterval = 5.0;
+ private int timerDueTime = 5000;
/// <summary>
/// Identifies the SavedRotationCommand bindable property
InitializeButtons();
+ timer = new Timer(HideControlAreaHandler, null, Timeout.Infinite, Timeout.Infinite);
+
PropertyChanged += ImageViewerPropertyChanged;
OnBackButtonPressedHandler += async (s, e) =>
}
/// <summary>
- /// Initialize the timer
- /// </summary>
- private void InitializeTimer()
- {
- if (timer != default(IntPtr))
- {
- ElmSharp.EcoreMainloop.RemoveTimer(timer);
- timer = default(IntPtr);
- }
- }
-
- /// <summary>
/// A method for changing control area according to ControlAreaState
/// </summary>
/// <param name="state">A current ControlAreaState</param>
RunShowAnimation();
}
- InitializeTimer();
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
break;
case ControlAreaState.HIDE:
RunHideAnimation();
}
- InitializeTimer();
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
break;
case ControlAreaState.AUTO:
RunShowAnimation();
}
- InitializeTimer();
-
- timer = ElmSharp.EcoreMainloop.AddTimer(timerInterval, HideControlAreaHandler());
+ timer.Change(timerDueTime, Timeout.Infinite);
break;
}
OptionBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusRightView(OptionBtn.MediaHubButtonBtn);
RunShowAnimation();
- timer = ElmSharp.EcoreMainloop.AddTimer(timerInterval, HideControlAreaHandler());
+ timer.Change(timerDueTime, Timeout.Infinite);
if (isFirstLaunching)
{
ControlArea.TranslationY = 93;
ControlArea.Opacity = 0;
- InitializeTimer();
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
UngrabRemoteKeys();
}
/// <summary>e
/// A method for hiding control area when timer is over
/// </summary>
- /// <returns>Always returns false</returns>
- private Func<bool> HideControlAreaHandler()
+ private void HideControlAreaHandler(object state)
{
- return delegate()
- {
- SetControlAreaState(ControlAreaState.HIDE);
-
- timer = default(IntPtr);
-
- return false;
- };
+ SetControlAreaState(ControlAreaState.HIDE);
}
/// <summary>
*/
using System;
+using System.Threading;
using System.Windows.Input;
using Tizen.Xamarin.Forms.Extension;
using TVMediaHub.Tizen.Controls;
/// <summary>
/// The timer to handle the control area
/// </summary>
- private IntPtr timer = default(IntPtr);
+ private Timer timer;
/// <summary>
- /// The interval of the timer
+ /// The due time of the timer
+ /// 5 second
/// </summary>
- private double timerInterval = 5.0;
+ private int timerDueTime = 5000;
/// <summary>
/// Identifies the SavedRotationCommand bindable property
InitializeButtons();
+ timer = new Timer(HideControlAreaHandler, null, Timeout.Infinite, Timeout.Infinite);
+
PropertyChanged += ImageViewerPropertyChanged;
OnBackButtonPressedHandler += async (s, e) =>
{
RunShowAnimation();
}
- if (timer != default(IntPtr))
- {
- ElmSharp.EcoreMainloop.RemoveTimer(timer);
- timer = default(IntPtr);
- }
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
break;
case ControlAreaState.HIDE:
RunHideAnimation();
}
- if (timer != default(IntPtr))
- {
- ElmSharp.EcoreMainloop.RemoveTimer(timer);
- timer = default(IntPtr);
- }
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
break;
case ControlAreaState.AUTO:
RunShowAnimation();
}
- if (timer != default(IntPtr))
- {
- ElmSharp.EcoreMainloop.RemoveTimer(timer);
- timer = default(IntPtr);
- }
-
- timer = ElmSharp.EcoreMainloop.AddTimer(timerInterval, HideControlAreaHandler());
+ timer.Change(timerDueTime, Timeout.Infinite);
break;
}
OptionBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusRightView(OptionBtn.MediaHubButtonBtn);
RunShowAnimation();
- timer = ElmSharp.EcoreMainloop.AddTimer(timerInterval, HideControlAreaHandler());
+ timer.Change(timerDueTime, Timeout.Infinite);
RotateBtn.MediaHubButtonBtn.Focus();
/// <summary>e
/// A method for hiding control area when timer is over
/// </summary>
- /// <returns>Always returns false</returns>
- private Func<bool> HideControlAreaHandler()
+ private void HideControlAreaHandler(object state)
{
- return delegate()
- {
- SetControlAreaState(ControlAreaState.HIDE);
-
- timer = default(IntPtr);
-
- return false;
- };
+ SetControlAreaState(ControlAreaState.HIDE);
}
/// <summary>
/// A method for finalizing page when the page is disappeared
- /// Ungrabs move keys of the remote controller
- /// Releases resources of the minimap
+ /// Ungrabs keys of the remote controller
/// </summary>
protected override void FinalizePage()
{
UngrabRemoteKeys();
+
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
}
/// <summary>
using Xamarin.Forms;
using Extension = Tizen.Xamarin.Forms.Extension;
using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
+using System.Threading;
namespace TVMediaHub.Tizen.Views
{
/// <summary>
/// The timer to handle the control area
/// </summary>
- private IntPtr timer = default(IntPtr);
+ private Timer timer;
/// <summary>
- /// The interval of the timer
+ /// The due time of the timer
+ /// 5 second
/// </summary>
- private double timerInterval = 5.0;
+ private int timerDueTime = 5000;
/// <summary>
/// Gets or sets whether play status is back forward or back rewind
InitializeButtons();
- OnBackButtonPressedHandler += async (s, e) =>
- {
- try
- {
- playerInstance?.Stop();
- playerInstance?.Unprepare();
- }
- catch (Exception ex)
- {
- DbgPort.E("Stop Failed : " + ex.Message);
- }
+ timer = new Timer(HideControlAreaHandler, null, Timeout.Infinite, Timeout.Infinite);
+
+ OnBackButtonPressedHandler += async (s, e) =>
+ {
+ try
+ {
+ playerInstance?.Stop();
+ playerInstance?.Unprepare();
+ }
+ catch (Exception ex)
+ {
+ DbgPort.E("Stop Failed : " + ex.Message);
+ }
#pragma warning disable CS4014
GradientDim.FadeTo(0, 667, Easing.CubicInOut);
- ControlArea.TranslateTo(0, 93, 667, Easing.CubicInOut);
- ControlArea.FadeTo(0, 667, Easing.CubicInOut);
- TitleLabel.TranslateTo(0, -50, 667, Easing.CubicInOut);
- await TitleLabel.FadeTo(0, 667, Easing.CubicInOut);
+ ControlArea.TranslateTo(0, 93, 667, Easing.CubicInOut);
+ ControlArea.FadeTo(0, 667, Easing.CubicInOut);
+ TitleLabel.TranslateTo(0, -50, 667, Easing.CubicInOut);
+ await TitleLabel.FadeTo(0, 667, Easing.CubicInOut);
- App.AppMainPage.Navigation.PopAsync();
+ App.AppMainPage.Navigation.PopAsync();
//Program.TransitionToMain(0);
#pragma warning restore CS4014
};
RunShowAnimation();
}
- if (timer != default(IntPtr))
- {
- ElmSharp.EcoreMainloop.RemoveTimer(timer);
- timer = default(IntPtr);
- }
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
break;
case ControlAreaState.HIDE:
RunHideAnimation();
}
- if (timer != default(IntPtr))
- {
- ElmSharp.EcoreMainloop.RemoveTimer(timer);
- timer = default(IntPtr);
- }
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
break;
case ControlAreaState.AUTO:
RunShowAnimation();
}
- if (timer != default(IntPtr))
- {
- ElmSharp.EcoreMainloop.RemoveTimer(timer);
- timer = default(IntPtr);
- }
-
- timer = ElmSharp.EcoreMainloop.AddTimer(timerInterval, HideControlAreaHandler());
+ timer.Change(timerDueTime, Timeout.Infinite);
break;
}
NextBtn.MediaHubButtonBtn.On<Tizen>().SetNextFocusRightView(NextBtn.MediaHubButtonBtn);
RunShowAnimation();
- timer = ElmSharp.EcoreMainloop.AddTimer(timerInterval, HideControlAreaHandler());
+ timer.Change(timerDueTime, Timeout.Infinite);
PausePlayBtn.MediaHubButtonBtn.Focus();
GrabRemoteKeys();
}
- /// <summary>
- /// Hide the control area
+ /// <summary>e
+ /// A method for hiding control area when timer is over
/// </summary>
- /// <returns></returns>
- private Func<bool> HideControlAreaHandler()
+ private void HideControlAreaHandler(object state)
{
- return delegate ()
- {
- SetControlAreaState(ControlAreaState.HIDE);
-
- timer = default(IntPtr);
-
- return false;
- };
+ SetControlAreaState(ControlAreaState.HIDE);
}
/// <summary>
/// </summary>
protected override void FinalizePage()
{
- DbgPort.D("Finalize Page");
-
- if (timer != default(IntPtr))
- {
- ElmSharp.EcoreMainloop.RemoveTimer(timer);
- timer = default(IntPtr);
- }
-
UngrabRemoteKeys();
+
+ timer.Change(Timeout.Infinite, Timeout.Infinite);
}
/// <summary>