update TR181 and Phone page
[GitHub/Stricted/SpeedportHybridControl.git] / SpeedportHybridControl / PageModel / PhonePageModel.cs
1 using System;
2 using System.Collections.Generic;
3 using SpeedportHybridControl.Model;
4 using SpeedportHybridControl.Data;
5 using SpeedportHybridControl.Implementations;
6 using System.Threading;
7 using System.Windows;
8
9 namespace SpeedportHybridControl.PageModel {
10 class PhonePageModel : SuperViewModel {
11 private DelegateCommand _reloadCommand;
12 private DelegateCommand _copyCommand;
13 private DelegateCommand _clearCommand;
14 private PhoneCallList _selectedItem;
15
16 private List<PhoneCallList> _missedCalls;
17 private List<PhoneCallList> _takenCalls;
18 private List<PhoneCallList> _dialedCalls;
19 private string _datetime;
20
21 public DelegateCommand ReloadCommand {
22 get { return _reloadCommand; }
23 set { SetProperty(ref _reloadCommand, value); }
24 }
25
26 public DelegateCommand CopyCommand {
27 get { return _copyCommand; }
28 set { SetProperty(ref _copyCommand, value); }
29 }
30
31 public DelegateCommand ClearCommand {
32 get { return _clearCommand; }
33 set { SetProperty(ref _clearCommand, value); }
34 }
35
36 public PhoneCallList SelectedItem {
37 get { return _selectedItem; }
38 set { SetProperty(ref _selectedItem, value); }
39 }
40
41 public List<PhoneCallList> missedCalls {
42 get { return _missedCalls; }
43 set { SetProperty(ref _missedCalls, value); }
44 }
45
46 public List<PhoneCallList> takenCalls {
47 get { return _takenCalls; }
48 set { SetProperty(ref _takenCalls, value); }
49 }
50
51 public List<PhoneCallList> dialedCalls {
52 get { return _dialedCalls; }
53 set { SetProperty(ref _dialedCalls, value); }
54 }
55
56 public string datetime {
57 get { return _datetime; }
58 set { SetProperty(ref _datetime, value); }
59 }
60
61 private void OnReloadCommandExecute () {
62 new Thread(() => { SpeedportHybrid.initPhone(); }).Start();
63 }
64
65 private void OnCopyCommandExecute () {
66 Clipboard.SetText(SelectedItem.ToString());
67 }
68
69 private void OnClearCommandExecute () {
70 //TODO
71 }
72
73 public PhonePageModel () {
74 ReloadCommand = new DelegateCommand(new Action(OnReloadCommandExecute));
75 CopyCommand = new DelegateCommand(new Action(OnCopyCommandExecute));
76 ClearCommand = new DelegateCommand(new Action(OnClearCommandExecute));
77 }
78 }
79 }