ButtonList = new List<PanelButton>();
ButtonViewList = new List<View>();
PropertyChanged += OnItemsSourcePropertyChanged;
+ }
- MessagingCenter.Subscribe<App>(this, "MenuKeyPressed", (sender) =>
- {
- isShowOptions = true;
- if (isFocused)
+ public override void MenuKeyPressed()
+ {
+ isShowOptions = true;
+
+ if (isFocused)
+ {
+ foreach (var item in ButtonList)
{
- foreach (var item in ButtonList)
+ if (item is SubPanelButton)
{
- if (item is SubPanelButton)
+ if (item.isFocused)
{
- if (item.isFocused)
- {
- OnShowOptionsCommand?.Execute(isShowOptions);
- item.ShowContextPopup();
- item.ChangeShowOptionsMode(isShowOptions);
- ChangeIsEnabledProperty(item.View, false);
- }
+ OnShowOptionsCommand?.Execute(isShowOptions);
+ item.ShowContextPopup();
+ item.ChangeShowOptionsMode(isShowOptions);
+ ChangeIsEnabledProperty(item.View, false);
}
}
}
- });
+ }
}
/// <summary>
/// A event handler for handling property changed event
NoContentInfoText.On<Tizen>().SetFontWeight(FontWeight.Light);
ButtonList = new List<PanelButton>();
+ }
- MessagingCenter.Subscribe<App>(this, "MenuKeyPressed", (sender) =>
+ public override void MenuKeyPressed()
+ {
+ if (isFocused)
{
- if (isFocused)
+ foreach (var item in ButtonList)
{
- foreach (var item in ButtonList)
+ if (item.isFocused)
{
- if (item.isFocused)
- {
- item.ShowContextPopup();
- }
+ item.ShowContextPopup();
}
}
- });
+ }
}
/// <summary>
NoContentInfo.IsVisible = false;
}
}
- else if (e.PropertyName != "ItemsSource")
- {
- return;
- }
-
- PanelButtonStack.Children.Clear();
- ButtonList.Clear();
- foreach (RecentShortcutInfo item in ItemsSource)
+ else if (e.PropertyName == "ItemsSource")
{
- PanelButton button = new SubPanelThumbnailButton();
- button.View.BindingContext = item;
- button.OnFocusedCommand = new Command(() =>
+ PanelButtonStack.Children.Clear();
+ ButtonList.Clear();
+ foreach (RecentShortcutInfo item in ItemsSource)
{
- FocusPanel();
- });
- button.OnClickedCommand = new Command(() =>
- {
- item.DoAction();
- OnItemClickEventHandler?.Invoke();
- });
- button.OnClearCommand = new Command(() =>
+ PanelButton button = new SubPanelThumbnailButton();
+ button.View.BindingContext = item;
+ button.OnFocusedCommand = new Command(() =>
+ {
+ FocusPanel();
+ if (SizeUtils.GetWidthSize((int)button.View.X) - SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) < 0)
+ {
+ ScrollToLeft();
+ }
+ else if (SizeUtils.GetWidthSize((int)button.View.X) + SizeUtils.GetWidthSize(320) > SizeUtils.GetWidthSize(1920))
+ {
+ ScrollToRight();
+ }
+ });
+ button.OnClickedCommand = new Command(() =>
+ {
+ item.DoAction();
+ });
+ button.OnClearCommand = new Command(() =>
+ {
+ OnClearVMCommand.Execute(item.Id);
+ });
+ button.OnClearAllCommand = new Command(() =>
+ {
+ OnClearAllVMCommand.Execute("");
+ });
+ PanelButtonStack.Children.Add(button.View);
+ ButtonList.Add(button);
+ }
+
+ if (!isFocused)
{
- OnClearVMCommand.Execute(item.Id);
- });
- button.OnClearAllCommand = new Command(() =>
+ HidePanel();
+ }
+ else
{
- OnClearAllVMCommand.Execute("");
- });
- PanelButtonStack.Children.Add(button.View);
- ButtonList.Add(button);
+ isFocused = false;
+ FocusPanel();
+ }
}
+ }
- if (!isFocused)
- {
- HidePanel();
- }
- else
- {
- isFocused = false;
- FocusPanel();
- }
+ private async void ScrollToRight()
+ {
+ double distance = SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) + SizeUtils.GetWidthSize(320);
+ await Task.Delay(1);
+ await PanelScrollView.ScrollToAsync(distance, 0, true);
+ }
- PanelScrollView.ScrollToAsync(110, 0, false);
+ private async void ScrollToLeft()
+ {
+ double distance = SizeUtils.GetWidthSize((int)PanelScrollView.ScrollX) - SizeUtils.GetWidthSize(320);
+ await Task.Delay(1);
+ await PanelScrollView.ScrollToAsync(distance, 0, true);
}
public IList<View> GetSubPanelButtons()
item.IsEnabled = false;
}
#pragma warning disable CS4014
- PanelScrollView.ScrollToAsync(110, 0, true);
+ PanelScrollView.ScrollToAsync(0, 0, true);
this.TranslateTo(0, selectTransitionHeight, 300);
#pragma warning restore CS4014
await this.FadeTo(0, 300);