using LibTVRefCommmonPortable.DataModels;
using LibTVRefCommmonPortable.Utils;
-using System.Collections;
using System.Collections.Generic;
-using System.Collections.ObjectModel;
using System.ComponentModel;
-using System.Linq;
-using System.Threading.Tasks;
using Xamarin.Forms;
namespace TVApps.ViewModels
{
public enum AppsStatus
{
- Normal,
+ Launch,
Pin,
Delete,
};
Quit,
};
- public enum SortList
+ public enum SortingOptions
{
Newest,
- Ascending, // A-Z
- Descending, // Z-A
+ Ascending,
+ Descending,
};
class MainPageViewModel : INotifyPropertyChanged
public AppsStatus CurrentStatus { get; private set; }
- public SortList SortStatus { get; private set; }
+ public SortingOptions SortingOption { get; private set; }
public BackKeyInfo BackKeyStatus { get; private set; }
public ShortcutInfo FocusedItem { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
- protected void OnPropertyChanged(string name)
- {
- PropertyChangedEventHandler handler = PropertyChanged;
- if (handler != null)
- {
- handler(this, new PropertyChangedEventArgs(name));
- }
- }
-
public MainPageViewModel()
{
- BackKeyStatus = BackKeyInfo.Back;
- SortStatus = SortList.Newest;
- CurrentStatus = AppsStatus.Normal;
+ init();
GetInstalledApps();
SortCommand = new Command((sortType) =>
{
// 1. SortType = sortType;
- // 2. Sorting appsList
+ // 2. Sorting AppsList
+ // 3. OnPropertyChanged("AppList");
});
OptionCommand = new Command((optionType) =>
ButtonDelCommand = new Command(() =>
{
- CurrentStatus = AppsStatus.Normal;
+ CurrentStatus = AppsStatus.Launch;
OnPropertyChanged("CurrentStatus");
});
});
}
+ private void init()
+ {
+ BackKeyStatus = BackKeyInfo.Back;
+ SortingOption = SortingOptions.Newest;
+ CurrentStatus = AppsStatus.Launch;
+ }
+
+ protected void OnPropertyChanged(string name)
+ {
+ PropertyChangedEventHandler handler = PropertyChanged;
+ if (handler != null)
+ {
+ handler(this, new PropertyChangedEventArgs(name));
+ }
+ }
+
private async void GetInstalledApps()
{
AppList = await TVHomeImpl.GetInstance.AppShortcutControllerInstance.GetList();
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
using Xamarin.Forms;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
using Xamarin.Forms;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
using Xamarin.Forms;
{
switch (CurrentStatus)
{
- case AppsStatus.Normal:
+ case AppsStatus.Launch:
FooterNormal.IsVisible = true;
FooterPin.IsVisible = false;
FooterDelete.IsVisible = false;