\r
namespace TVHome.TizenTV.Ports\r
{\r
- class ApplicationManagerPort : IApplicationManagerAPIs\r
- {\r
- public ApplicationManagerPort()\r
- {\r
- ApplicationManager.ApplicationLaunched += new EventHandler<ApplicationLaunchedEventArgs>(OnApplicationLaunched);\r
- }\r
-\r
- void OnApplicationLaunched(object sender, EventArgs args)\r
- {\r
- ApplicationLaunchedEventArgs launchedEventArgs = args as ApplicationLaunchedEventArgs;\r
-\r
- DebuggingUtils.Dbg(launchedEventArgs.ApplicationInfo.Label.ToString() + " launched");\r
- }\r
-\r
- public async Task<Dictionary<string, string[]>> GetRecentApplications()\r
- {\r
- // RUA가 지원되지 않으므로 일단 설치된 app들을 가져와 본다\r
- // TODO: RUA로 대체한다\r
- Dictionary<string, string[]> resultList = new Dictionary<string, string[]>();\r
- var applicationList = await ApplicationManager.GetInstalledApplicationsAsync();\r
- string[] result;\r
-\r
- foreach (ApplicationInfo appInfo in applicationList)\r
- {\r
- result = new string[3];\r
-\r
- result[0] = appInfo.Label != null ? appInfo.Label : null;\r
- result[1] = appInfo.ApplicationId != null ? appInfo.ApplicationId : null;\r
- result[2] = appInfo.IconPath != null ? appInfo.IconPath : null;\r
-\r
- resultList.Add(appInfo.ApplicationId, result);\r
- }\r
-\r
- return resultList;\r
- }\r
- }\r
+ class ApplicationManagerPort : IApplicationManagerAPIs\r
+ {\r
+ public ApplicationManagerPort()\r
+ {\r
+ ApplicationManager.ApplicationLaunched += new EventHandler<ApplicationLaunchedEventArgs>(OnApplicationLaunched);\r
+ }\r
+\r
+ void OnApplicationLaunched(object sender, EventArgs args)\r
+ {\r
+ ApplicationLaunchedEventArgs launchedEventArgs = args as ApplicationLaunchedEventArgs;\r
+\r
+ DebuggingUtils.Dbg(launchedEventArgs.ApplicationInfo.Label.ToString() + " launched");\r
+ }\r
+\r
+ public async Task<Dictionary<string, string[]>> GetRecentApplications()\r
+ {\r
+ // RUA가 지원되지 않으므로 일단 설치된 app들을 가져와 본다\r
+ // TODO: RUA로 대체한다\r
+ Dictionary<string, string[]> resultList = new Dictionary<string, string[]>();\r
+ var applicationList = await ApplicationManager.GetInstalledApplicationsAsync();\r
+ string[] result;\r
+\r
+ foreach (ApplicationInfo appInfo in applicationList)\r
+ {\r
+ result = new string[3];\r
+\r
+ result[0] = appInfo.Label != null ? appInfo.Label : null;\r
+ result[1] = appInfo.ApplicationId != null ? appInfo.ApplicationId : null;\r
+ result[2] = appInfo.IconPath != null ? appInfo.IconPath : null;\r
+\r
+ resultList.Add(appInfo.ApplicationId, result);\r
+ }\r
+\r
+ return resultList;\r
+ }\r
+ }\r
}
\ No newline at end of file
public DBPort()\r
{\r
// TODO : make a unit test for this!!!\r
- DebuggingPort.d("DBPort-------------------------------------");\r
- DebuggingPort.d("version " + ExecSQL("csk", "SELECT SQLITE_VERSION()"));\r
- DebuggingPort.d("create " + ExecSQL("csk", "CREATE TABLE friends(Id INTEGER PRIMARY KEY, Name TEXT);"));\r
+ DebuggingPort.D("DBPort-------------------------------------");\r
+ DebuggingPort.D("version " + ExecSQL("csk", "SELECT SQLITE_VERSION()"));\r
+ DebuggingPort.D("create " + ExecSQL("csk", "CREATE TABLE friends(Id INTEGER PRIMARY KEY, Name TEXT);"));\r
\r
- DebuggingPort.d("insert 1 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Tom');"));\r
- DebuggingPort.d("insert 2 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Rebecca');"));\r
- DebuggingPort.d("insert 3 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Jim');"));\r
- DebuggingPort.d("insert 4 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Roger');"));\r
- DebuggingPort.d("insert 5 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Robert');"));\r
+ DebuggingPort.D("insert 1 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Tom');"));\r
+ DebuggingPort.D("insert 2 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Rebecca');"));\r
+ DebuggingPort.D("insert 3 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Jim');"));\r
+ DebuggingPort.D("insert 4 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Roger');"));\r
+ DebuggingPort.D("insert 5 " + ExecSQL("csk", "INSERT INTO friends(Name) VALUES ('Robert');"));\r
\r
IEnumerable<DBItem> dbItems = new List<DBItem>();\r
- DebuggingPort.d("select " + ExecSQL("csk", "SELECT * FROM friends;", out dbItems));\r
+ DebuggingPort.D("select " + ExecSQL("csk", "SELECT * FROM friends;", out dbItems));\r
foreach (var item in dbItems)\r
{\r
foreach (var value in item.ItemProperties)\r
{\r
- DebuggingPort.d("column[" + value.Key + "] = " + value.Value);\r
+ DebuggingPort.D("column[" + value.Key + "] = " + value.Value);\r
}\r
}\r
\r
- DebuggingPort.d("insert 5 " + ExecSQL("csk", "DROP TABLE friends;"));\r
+ DebuggingPort.D("insert 5 " + ExecSQL("csk", "DROP TABLE friends;"));\r
}\r
\r
private static bool CheckResult(int res, string desc)\r
{\r
if (res != SQLITE_OK)\r
{\r
- DebuggingPort.d(String.Format("DB Error [{0}], {1}", desc, res));\r
+ DebuggingPort.D(String.Format("DB Error [{0}], {1}", desc, res));\r
return false;\r
}\r
+\r
return true;\r
}\r
\r
private static bool Open(string dbName, out IntPtr handle)\r
{\r
- DebuggingPort.d("[DB Open]");\r
+ DebuggingPort.D("[DB Open]");\r
if (dbName == null)\r
{\r
- DebuggingPort.e("DB Name is NULL!!!");\r
+ DebuggingPort.E("DB Name is NULL!!!");\r
handle = IntPtr.Zero;\r
return false;\r
}\r
\r
private static void Close(IntPtr handle)\r
{\r
- DebuggingPort.d("[DB Close]");\r
+ DebuggingPort.D("[DB Close]");\r
if (handle == null)\r
{\r
return;\r
{\r
if (dbName == null || sql == null)\r
{\r
- DebuggingPort.e("Invalid argument!!!");\r
+ DebuggingPort.E("Invalid argument!!!");\r
return false;\r
}\r
\r
DBHandleRAII db = new DBHandleRAII(dbName);\r
if (db.handle == IntPtr.Zero)\r
{\r
- DebuggingPort.e("DB open failed!!!");\r
+ DebuggingPort.E("DB open failed!!!");\r
return false;\r
}\r
\r
\r
private int ExecCallback(IntPtr notUsed, int numberOfColumn, IntPtr value, IntPtr column)\r
{\r
- DebuggingPort.d("ExecCallback");\r
+ DebuggingPort.D("ExecCallback");\r
for (int i = 1; i < numberOfColumn; i++)\r
{\r
string _value = Marshal.PtrToStringAnsi(Marshal.ReadIntPtr(value, i * PtrSize));\r
- DebuggingPort.e("" + i + " - " + _value + " / ");\r
+ DebuggingPort.E("" + i + " - " + _value + " / ");\r
DBItem item = new DBItem();\r
item.Add(i, _value);\r
givenItems.Add(item);\r
}\r
+\r
return 0;\r
}\r
\r
givenItems.Clear();\r
items = givenItems;\r
\r
- DebuggingPort.d("ExecSQL");\r
+ DebuggingPort.D("ExecSQL");\r
if (dbName == null || sql == null)\r
{\r
- DebuggingPort.e("Invalid argument!!!");\r
+ DebuggingPort.E("Invalid argument!!!");\r
return false;\r
}\r
\r
DBHandleRAII db = new DBHandleRAII(dbName);\r
if (db.handle == IntPtr.Zero)\r
{\r
- DebuggingPort.e("DB open failed!!!");\r
+ DebuggingPort.E("DB open failed!!!");\r
return false;\r
}\r
\r
toast.Show();\r
}\r
\r
- public static void d(string message)\r
+ public static void D(string message)\r
{\r
Log.Debug(TAG, message);\r
}\r
\r
- public static void e(string message)\r
+ public static void E(string message)\r
{\r
Log.Error(TAG, message);\r
}\r
public event EventHandler<EventArgs> CustomChanged;
private FileSystemEventCustomArgs args;
- public void run()
+ public void Run()
{
watcher = new FileSystemWatcher();
watcher.Path = "/opt/usr/home/owner/share/";
{
CustomChanged(this, args);
}
- DebuggingPort.d(e.ChangeType + ", " + e.Name);
+
+ DebuggingPort.D(e.ChangeType + ", " + e.Name);
}
}
}
private void PackageManager_UninstallProgressChanged(object sender, PackageManagerEventArgs e)\r
{\r
if (e.State == PackageEventState.Completed)\r
+ {\r
DebuggingUtils.Dbg("uninstall completed");\r
+ }\r
}\r
\r
private void PackageManager_InstallProgressChanged(object sender, PackageManagerEventArgs e)\r
{\r
if (e.State == PackageEventState.Completed)\r
+ {\r
DebuggingUtils.Dbg("install completed");\r
+ }\r
}\r
\r
public Dictionary<string, string[]> GetPackageList()\r
result[0] = null;\r
}\r
\r
- if ( item.Id != null)\r
+ if (item.Id != null)\r
{\r
result[1] = item.Id;\r
}\r
result[1] = null;\r
}\r
\r
- if ( item.IconPath != null)\r
+ if (item.IconPath != null)\r
{\r
result[2] = item.IconPath;\r
}\r
Package tempItem = PackageManager.GetPackage(PkgID);\r
\r
if (tempItem != null)\r
+ {\r
return tempItem.Label;\r
+ }\r
else\r
+ {\r
return null;\r
+ }\r
}\r
}\r
}
\ No newline at end of file
AppResourcePath = DirectoryInfo.Resource;\r
AppDataPath = DirectoryInfo.Data;\r
\r
- // TODO : remove this.\r
- // var dbPort = new DBPort();\r
- DebuggingPort.d("I'm here");\r
+ // TODO : remove this.\r
+ // var dbPort = new DBPort();\r
+ DebuggingPort.D("I'm here");\r
LoadApplication(new App());\r
}\r
\r
global::Xamarin.Forms.DependencyService.Register<BTModulePort>();\r
global::Xamarin.Forms.DependencyService.Register<FileSystemWatcherPort>();\r
global::Xamarin.Forms.DependencyService.Register<ApplicationManagerPort>();\r
- global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);\r
+ global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);\r
app.Run(args);\r
}\r
}\r
<Compile Include="Ports\AppControlPort.cs" />\r
<Compile Include="Ports\ApplicationManagerPort.cs" />\r
<Compile Include="Ports\BTModulePort.cs" />\r
+ <Compile Include="Ports\FileSystemWatcherPort.cs" />\r
<Compile Include="Ports\PackageManagerPort.cs" />\r
<Compile Include="Ports\WifiModulePort.cs" />\r
<Compile Include="Ports\DebuggingPort.cs" />\r
<Folder Include="lib\" />\r
<Folder Include="res\" />\r
</ItemGroup>\r
- <ItemGroup>\r
- <Reference Include="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" />\r
- </ItemGroup>\r
<ItemGroup>\r
<ProjectReference Include="..\TVHome\TVHome.csproj">\r
<Project>{54dd6673-7e64-48e6-a008-4d455e19e017}</Project>\r
<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"\r
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
x:Class="TVHome.Controls.MainPanelButton">\r
- <RelativeLayout Opacity="0.3">\r
- <BoxView x:Name = "ButtonBox"\r
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
- Color="Red" />\r
- <Image x:Name="ButtonImage"\r
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}" \r
- Source="{Binding CurrentStateDescription.IconPath}"/>\r
- <Button x:Name = "ButtonFocusArea"\r
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
- RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
- Focused="OnFocused"\r
- Unfocused="OnUnfocused"\r
- Clicked="OnClicked"\r
- Opacity="0" />\r
- </RelativeLayout>\r
+ <RelativeLayout Opacity="0.3">\r
+ <BoxView x:Name = "ButtonBox"\r
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ Color="Red" />\r
+ <Image x:Name="ButtonImage"\r
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ Source="{Binding CurrentStateDescription.IconPath}" />\r
+ <Label x:Name="ButtonTitle"\r
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2}"\r
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.8}"\r
+ Opacity="0"\r
+ LineBreakMode="TailTruncation"\r
+ Text="{Binding CurrentStateDescription.Label}" />\r
+ <Button x:Name = "ButtonFocusArea"\r
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ Focused="OnFocused"\r
+ Unfocused="OnUnfocused"\r
+ Clicked="OnClicked"\r
+ Opacity="0" />\r
+ </RelativeLayout>\r
</ViewCell>
\ No newline at end of file
OnFocusedCommand.Execute("");\r
}\r
\r
+ ButtonTitle.FadeTo(0.99, 300);\r
await View.FadeTo(0.6, 300);\r
}\r
\r
private async void OnUnfocused(object sender, FocusEventArgs e)\r
{\r
+ ButtonTitle.FadeTo(0, 300);\r
await View.FadeTo(0.3, 300);\r
}\r
\r
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
Color="Blue" />\r
- <Label x:Name ="ButtonTitle"\r
- RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
+ <Image x:Name="ButtonImage"\r
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
- Text="{Binding CurrentStateDescription.Label}"\r
- LineBreakMode="TailTruncation" />\r
+ Source="{Binding CurrentStateDescription.IconPath}" />\r
+ <Label x:Name="ButtonTitle"\r
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.2}"\r
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.8}"\r
+ Opacity="0"\r
+ LineBreakMode="TailTruncation"\r
+ Text="{Binding CurrentStateDescription.Label}" />\r
<Button x:Name = "ButtonFocusArea"\r
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"\r
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.94}"\r
OnFocusedCommand.Execute("");\r
}\r
\r
+ ButtonTitle.FadeTo(0.99, 300);\r
await View.FadeTo(0.6, 300);\r
}\r
\r
private async void OnUnfocused(object sender, FocusEventArgs e)\r
{\r
+ ButtonTitle.FadeTo(0, 300);\r
await View.FadeTo(0.3, 300);\r
}\r
\r
get;\r
set;\r
}\r
+\r
public string PackageID\r
{\r
get;\r
set;\r
}\r
+\r
public string AppID\r
{\r
get;\r
set;\r
}\r
+\r
public string AppName\r
{\r
get;\r
public void SetDBItem(IDBItem item)\r
{\r
int idx = 0;\r
- foreach(var column in item.GetColumnValues())\r
+ foreach (var column in item.GetColumnValues())\r
{\r
SetColumnValue(idx++, column);\r
}\r
case 2: return AppID;\r
case 3: return AppName;\r
}\r
+\r
return "";\r
}\r
\r
{\r
return value;\r
}\r
+\r
return "";\r
}\r
\r
// The name of the affected file or directory.
public string Name { set; get; }
}
-}
-
+}
\ No newline at end of file
{\r
public class RecentShortcutInfo : ShortcutInfo\r
{\r
- public DateTime Date\r
- {\r
- get;\r
- set;\r
- }\r
- public override void UpdateState()\r
+ public DateTime Date\r
{\r
- SetCurrentState("default");\r
- }\r
+ get;\r
+ set;\r
+ }\r
+\r
+ public override void UpdateState()\r
+ {\r
+ SetCurrentState("default");\r
+ }\r
}\r
}\r
\r
public async Task<IEnumerable<RecentShortcutInfo>> GetList()\r
{\r
- IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();\r
- List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>();\r
+ IApplicationManagerAPIs applicationManagerPort = DependencyService.Get<IApplicationManagerAPIs>();\r
+ List<RecentShortcutInfo> recentShortcutInfoList = new List<RecentShortcutInfo>();\r
\r
- var applicationList = await applicationManagerPort.GetRecentApplications();\r
- foreach (KeyValuePair<string, string[]> item in applicationList)\r
- {\r
- var defaultStateDescription = new StateDescription()\r
- {\r
- // TODO : Label에는 ApplicationInfo의 Label을 넣자\r
- Label = item.Value[0],\r
- IconPath = item.Value[2],\r
- Action = new AppControlAction()\r
- {\r
- PkgID = item.Key\r
- }\r
- };\r
- var recentShortcutInfo = new RecentShortcutInfo();\r
- recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);\r
- recentShortcutInfo.CurrentStateDescription = defaultStateDescription;\r
- recentShortcutInfoList.Add(recentShortcutInfo);\r
- }\r
+ var applicationList = await applicationManagerPort.GetRecentApplications();\r
+ foreach (KeyValuePair<string, string[]> item in applicationList)\r
+ {\r
+ var defaultStateDescription = new StateDescription()\r
+ {\r
+ // TODO : Label에는 ApplicationInfo의 Label을 넣자\r
+ Label = item.Value[0],\r
+ IconPath = item.Value[2],\r
+ Action = new AppControlAction()\r
+ {\r
+ PkgID = item.Key\r
+ }\r
+ };\r
+ var recentShortcutInfo = new RecentShortcutInfo();\r
+ recentShortcutInfo.StateDescriptions.Add("default", defaultStateDescription);\r
+ recentShortcutInfo.CurrentStateDescription = defaultStateDescription;\r
+ recentShortcutInfoList.Add(recentShortcutInfo);\r
+ }\r
\r
- return recentShortcutInfoList;\r
+ return recentShortcutInfoList;\r
\r
- }\r
+ }\r
}\r
}\r
\r
private string DBName = "tvhome.apps";\r
//private string CreateTableStatement = "CREATE TABLE IF NOT EXISTS app_shortcut(" +\r
- private string CreateTableStatement = "CREATE TABLE app_shortcut(" +\r
- "id TEXT PRIMARY KEY, package_id TEXT, app_id TEXT, app_name TEXT);";\r
+ //private string CreateTableStatement = "CREATE TABLE app_shortcut(" +\r
+ // "id TEXT PRIMARY KEY, package_id TEXT, app_id TEXT, app_name TEXT);";\r
\r
public static AppShortcutStorage Instance\r
{\r
\r
private AppShortcutStorage()\r
{\r
- fileSystemWatcher.run();\r
+ fileSystemWatcher.Run();\r
}\r
+\r
public bool Create(AppShortcutInfo app)\r
{\r
string query = "INSERT INTO app_shortcut VALUES(";\r
query += value;\r
query += "', ";\r
}\r
+\r
query = query.Remove(query.Length - 2);\r
query += ");";\r
\r
{\r
DebuggingUtils.Err("DB inserting Failed!!! " + query);\r
}\r
+\r
return false;\r
}\r
\r
new StateDescription\r
{\r
Label = result[0],\r
- IconPath = "wifion.png", // result[2]\r
+ IconPath = "user_1.png", // result[2]\r
Action = new AppControlAction()\r
{\r
PkgID = "org.tizen.settings" // result[1]\r
\r
namespace TVHome.Utils\r
{\r
- public interface IApplicationManagerAPIs\r
- {\r
- Task<Dictionary<string, string[]>> GetRecentApplications();\r
- }\r
+ public interface IApplicationManagerAPIs\r
+ {\r
+ Task<Dictionary<string, string[]>> GetRecentApplications();\r
+ }\r
}\r
public interface IFileSystemWatcherAPIs
{
event EventHandler<EventArgs> CustomChanged;
- void run();
+ void Run();
}
}
\r
public static RecentShortcutInfo Read(string key)\r
{\r
- RecentShortcutInfo recentShortcutInfo = new RecentShortcutInfo();\r
+ RecentShortcutInfo recentShortcutInfo = new RecentShortcutInfo();\r
return recentShortcutInfo;\r
}\r
\r
handler(this, new PropertyChangedEventArgs(name));\r
}\r
}\r
+\r
public MainPageViewModel()\r
{\r
string[] AppName = { "Recent", "Apps", "Settings" };\r
shortcutInfo.UpdateState();\r
TempList.Add(shortcutInfo);\r
}\r
+\r
MainList = TempList;\r
OnPropertyChanged("MainList");\r
\r
{\r
currentSubPanel.HidePanel();\r
}\r
+\r
currentSubPanel = SubPanelDictionary[key];\r
currentSubPanel.ShowPanel();\r
});\r
}\r
+\r
private void OnAppearing(object sender, EventArgs e)\r
{\r
- PageMainPanel.initialFocusing();\r
+ PageMainPanel.InitialFocusing();\r
}\r
}\r
}
\ No newline at end of file
\r
private void OnItemsSourcePropertyChanged(object sender, PropertyChangedEventArgs e)\r
{\r
- if (e.PropertyName != "ItemsSource") return;\r
+ if (e.PropertyName != "ItemsSource")\r
+ {\r
+ return;\r
+ }\r
+\r
var index = 0;\r
PanelButtonGrid.Children.Clear();\r
foreach (ShortcutInfo item in ItemsSource)\r
}\r
}\r
\r
- public void initialFocusing()\r
+ public void InitialFocusing()\r
{\r
var button = PanelButtonGrid.Children[1] as RelativeLayout;\r
- button.Children[2].Focus();\r
+ button.FindByName<Button>("ButtonFocusArea").Focus();\r
}\r
}\r
}
\ No newline at end of file
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"\r
x:Class="TVHome.Views.SubPanel">\r
<ContentView.Content>\r
- <ScrollView Orientation="Horizontal"\r
+ <ScrollView x:Name="PanelScrollView"\r
+ Orientation="Horizontal"\r
HorizontalOptions="Center">\r
<StackLayout x:Name="PanelButtonStack"\r
Orientation="Horizontal">\r
InitializeComponent();\r
isFocused = false;\r
PropertyChanged += OnItemsSourcePropertyChanged;\r
- HidePanel();\r
}\r
\r
private void OnItemsSourcePropertyChanged(object sender, PropertyChangedEventArgs e)\r
{\r
- if (e.PropertyName != "ItemsSource") return;\r
+ if (e.PropertyName != "ItemsSource")\r
+ {\r
+ return;\r
+ }\r
+\r
PanelButtonStack.Children.Clear();\r
foreach (ShortcutInfo item in ItemsSource)\r
{\r
var button = new SubPanelButton();\r
- button.View.BindingContext = item;\r
+ button.View.BindingContext = item;\r
button.OnFocusedCommand = new Command(() =>\r
{\r
FocusPanel();\r
});\r
PanelButtonStack.Children.Add(button.View);\r
}\r
+\r
+ HidePanel();\r
}\r
\r
public async void HidePanel()\r
{\r
item.IsEnabled = false;\r
}\r
+\r
+ PanelScrollView.ScrollToAsync(0, 0, true);\r
this.TranslateTo(0, 1, 0);\r
await this.FadeTo(0, 0);\r
}\r
{\r
item.IsEnabled = true;\r
}\r
+\r
this.TranslateTo(0, 0, 0);\r
await this.FadeTo(0.3, 0);\r
}\r
\r
public async void FocusPanel()\r
{\r
- if (isFocused) return;\r
+ if (isFocused)\r
+ {\r
+ return;\r
+ }\r
+\r
isFocused = true;\r
var button = PanelButtonStack.Children[1] as RelativeLayout;\r
- button.Children[2].Focus();\r
+ button.FindByName<Button>("ButtonFocusArea").Focus();\r
\r
- this.TranslateTo(0, -120, 300);\r
+ this.TranslateTo(0, -140, 300);\r
await this.FadeTo(0.99, 300);\r
}\r
}\r