2 using System.Collections.Generic;
3 using SpeedportHybridControl.Model;
4 using SpeedportHybridControl.Data;
5 using SpeedportHybridControl.Implementations;
6 using System.Threading;
9 namespace SpeedportHybridControl.PageModel {
10 class PhonePageModel : SuperViewModel {
11 private DelegateCommand _reloadCommand;
12 private DelegateCommand _copyCommand;
13 private DelegateCommand _clearCommand;
14 private PhoneCallList _selectedItem;
16 private List<PhoneCallList> _missedCalls;
17 private List<PhoneCallList> _takenCalls;
18 private List<PhoneCallList> _dialedCalls;
19 private string _datetime;
21 public DelegateCommand ReloadCommand {
22 get { return _reloadCommand; }
23 set { SetProperty(ref _reloadCommand, value); }
26 public DelegateCommand CopyCommand {
27 get { return _copyCommand; }
28 set { SetProperty(ref _copyCommand, value); }
31 public DelegateCommand ClearCommand {
32 get { return _clearCommand; }
33 set { SetProperty(ref _clearCommand, value); }
36 public PhoneCallList SelectedItem {
37 get { return _selectedItem; }
38 set { SetProperty(ref _selectedItem, value); }
41 public List<PhoneCallList> missedCalls {
42 get { return _missedCalls; }
43 set { SetProperty(ref _missedCalls, value); }
46 public List<PhoneCallList> takenCalls {
47 get { return _takenCalls; }
48 set { SetProperty(ref _takenCalls, value); }
51 public List<PhoneCallList> dialedCalls {
52 get { return _dialedCalls; }
53 set { SetProperty(ref _dialedCalls, value); }
56 public string datetime {
57 get { return _datetime; }
58 set { SetProperty(ref _datetime, value); }
61 private void OnReloadCommandExecute () {
62 new Thread(() => { SpeedportHybrid.initPhone(); }).Start();
65 private void OnCopyCommandExecute () {
66 Clipboard.SetText(SelectedItem.ToString());
69 private void OnClearCommandExecute () {
73 public PhonePageModel () {
74 ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
75 CopyCommand = new DelegateCommand(new Action(OnCopyCommandExecute));
76 ClearCommand = new DelegateCommand(new Action(OnClearCommandExecute));