{
void OnHomeKeyPressed();
- void OnAppInstalled(string pkgID);
+ void OnMenuKeyPressed();
+
+ void OnAppInstalled(string pkgID);
void OnAppUninstalled(string pkgID);
public void OnHomeKeyPressed()
{
}
+
+ public void OnMenuKeyPressed()
+ {
+ }
}
}
private void CallbackForKeyGrab(Object state)
{
MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName, true);
+ MainWindow.KeyGrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName, true);
timerForKeyGrab.Dispose();
timerForKeyGrab = null;
DebuggingPort.D("KeyGrab finished");
notification.OnHomeKeyPressed();
}
}
+ else if (e.KeyName.CompareTo(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName) == 0)
+ {
+ if (notification != null)
+ {
+ notification.OnMenuKeyPressed();
+ }
+ }
}
protected override void OnTerminate()
notification = null;
PackageManagerPort.DeregisterCallbacks();
MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformHomeButtonName);
+ MainWindow.KeyUngrab(ElmSharp.EvasKeyEventArgs.PlatformMenuButtonName);
}
protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
public class App : Application, IPlatformNotification
{
private static EventHandler<TVHomeEventArgs> HomeKeyListener;
+ private static EventHandler<TVHomeEventArgs> MenuKeyListener;
private static EventHandler<TVHomeEventArgs> AppInstalledListener;
private static EventHandler<TVHomeEventArgs> AppUninstalledListener;
private static EventHandler<TVHomeEventArgs> AppPinnedNotificationListener;
HomeKeyListener += listener;
}
- public static void SetAppInstalledListener(EventHandler<TVHomeEventArgs> listener)
+ public static void SetMenuKeyListener(EventHandler<TVHomeEventArgs> listener)
+ {
+ MenuKeyListener += listener;
+ }
+
+ public static void SetAppInstalledListener(EventHandler<TVHomeEventArgs> listener)
{
AppInstalledListener += listener;
}
AppUninstalledListener += listener;
}
- public static void SetAppPinnedNotificationListener(EventHandler<TVHomeEventArgs> listener)
+ public static void SetAppPinnedNotificationListener(EventHandler<TVHomeEventArgs> listener)
{
AppPinnedNotificationListener += listener;
}
});
}
+ public void OnMenuKeyPressed()
+ {
+ DebuggingUtils.Dbg("\" Menu Key \" ");
+ MenuKeyListener.Invoke(this, new TVHomeEventArgs()
+ {
+ arg = "",
+ });
+ }
+
public void OnAppInstalled(string pkgID)
{
DebuggingUtils.Dbg("[[[ App Installed ]]] " + pkgID);
xmlns:ViewModels="clr-namespace:TVHome.ViewModels"
xmlns:Controls="clr-namespace:TVHome.Controls"
Appearing="OnAppearing"
- BackgroundImage="background.jpg"
CurrentStatus="{Binding CurrentStatus}"
SelectedMenuName="{Binding SelectedMenuName}">
<ContentPage.BindingContext>
}
});
+ // TODO : this is for the unpin test.
+ App.SetMenuKeyListener((e, arg) =>
+ {
+ AppShortcutInfo item = null;
+ item = AppsSubPanel.GetFocusedItem() as AppShortcutInfo;
+
+ DebuggingUtils.Dbg("Menu key is pressed : " + item.AppID);
+ if (item != null && item.AppID != null)
+ {
+ UnpinAppShortcutInfo(item.AppID);
+ }
+ });
+
AppsSubPanel.OnUnpinCommand = new Command<string>((appId) =>
{
- UnpinAppShortcutInfo(appId);
+ //UnpinAppShortcutInfo(appId);
});
}
TVHomeImpl.GetInstance.AppShortcutControllerInstance.UpdatePinnedApps(pinnedAppList);
}
- public async void RemovePinnedApp(string AppID)
+ private async void RemovePinnedApp(string AppID)
{
Dictionary<string, string> PinnedApps = await TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetPinnedAppsAppIDs();
if (PinnedApps.ContainsKey(AppID))
/// </summary>
public partial class SubPanel : Panel
{
+ private ShortcutInfo focusedItem;
public SubPanel()
{
InitializeComponent();
PropertyChanged += OnItemsSourcePropertyChanged;
}
+ public ShortcutInfo GetFocusedItem()
+ {
+ return focusedItem;
+ }
+
private void OnItemsSourcePropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName != "ItemsSource")
button.View.BindingContext = item;
button.OnFocusedCommand = new Command(() =>
{
+ focusedItem = item;
FocusPanel();
});
button.OnClickedCommand = new Command(() =>
{
- if (item is AppShortcutInfo)
- {
- if (button is SubPanelAllAppsButton || button is SubPanelReservedButton)
- {
- item.DoAction();
- }
- else
- {
- OnUnpinCommand.Execute((item as AppShortcutInfo).AppID);
- }
- }
- else
- {
- item.DoAction();
- }
+ item.DoAction();
});
PanelButtonStack.Children.Add(button.View);
}