Nextrek
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
using ClassLibrary1;
using GuidaTv.Common;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236
namespace GuidaTv
{
public sealed partial class TimeBar
{
public TimeBar()
{
this.InitializeComponent();
}
public void scrollToHorizontalOffset(double hOffset) {
this.timebarScrollViewer.ScrollToHorizontalOffset(hOffset);
}
private object lockObj = new Object();
public void highlightNow(){
CustomTime current;
int hour;
int minutes;
lock (lockObj)
{
foreach (object item in this.timelist.Items)
{
current = item as CustomTime;
hour = int.Parse(current.displayTime.Substring(0, 2));
minutes = int.Parse(current.displayTime.Substring(3, 2));
if (hour == (int)DateTime.Now.TimeOfDay.TotalHours)
{
if (minutes == 30 && (int)DateTime.Now.TimeOfDay.Minutes >= 30)
{
current.fontsize = "20";
current.foreground = "#FFFFFFFF";
}
else if (minutes == 0 && (int)DateTime.Now.TimeOfDay.TotalMinutes >= 0 && (int)DateTime.Now.TimeOfDay.Minutes < 30)
{
current.fontsize = "20";
current.foreground = "#FFFFFFFF";
}
else
{
current.fontsize = CustomTime.DEFAULT_FONT_SIZE;
current.foreground = CustomTime.DEFAULT_FOREGROUND;
}
}
else
{
current.fontsize = CustomTime.DEFAULT_FONT_SIZE;
current.foreground = CustomTime.DEFAULT_FOREGROUND;
}
}
}
}
private void timelist_Loaded_1(object sender, RoutedEventArgs e)
{
ObservableCollection<CustomTime> hours = new ObservableCollection<CustomTime>();
CustomTime current;
for (int i = 0; i < 48; i++)
{
current = new CustomTime() { displayTime = i % 24 < 10 ? "0" + i%24 + ":00" : i % 24 + ":00" };
hours.Add(current);
current = new CustomTime() { displayTime = i % 24 < 10 ? "0" + i%24 + ":30" : i%24 + ":30" };
hours.Add(current);
}
this.timelist.ItemsSource = hours;
}
public class CustomTime : BindableBase
{
private string DisplayTime = "";
public string displayTime
{
get { return this.DisplayTime; }
set { this.SetProperty(ref this.DisplayTime, value); }
}
public const string DEFAULT_FONT_SIZE = "14";
private string Fontsize = DEFAULT_FONT_SIZE;
public string fontsize
{
get { return this.Fontsize; }
set { this.SetProperty(ref this.Fontsize, value); }
}
public const string DEFAULT_FOREGROUND = "#DEEDEFDF";
private string Foreground = DEFAULT_FOREGROUND;
public string foreground
{
get { return this.Foreground; }
set { this.SetProperty(ref this.Foreground, value); }
}
}
}
}
|
Revision |
Author |
Commited |
Message |
21
|
JMBauan
|
Wed 26 Jun, 2013 10:48:36 +0000 |
|