-
Notifications
You must be signed in to change notification settings - Fork 0
/
FileModel.cs
160 lines (146 loc) · 4.34 KB
/
FileModel.cs
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
using Windows.Storage.FileProperties;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
namespace FileEx
{
public class FileModel
{
public ImageBrush Background { set; get; }
public double BarHeight
{
get
{
if (IsVertical()) return Window.Current.Bounds.Height / 7.3;
else return Window.Current.Bounds.Width / 7.3;
}
}
public double PopupHeight
{
get
{
if (IsVertical()) return Window.Current.Bounds.Height / 2;
else return Window.Current.Bounds.Width / 2;
}
}
public string Name { set; get; }
public string Image { set; get; }
public string Count { set; get; }
public bool IsVisible { set; get; }
public double VidHeight
{
get
{
if (IsVertical()) return Window.Current.Bounds.Height / 4;
else return Window.Current.Bounds.Width / 4;
}
}
public double VidWidth
{
get
{
if (IsVertical()) return Window.Current.Bounds.Width / 0.95;
else return Window.Current.Bounds.Height / 0.95;
}
}
public double PicHeight
{
get
{
if (IsVertical()) return (Window.Current.Bounds.Height - 20) / 3;
else return (Window.Current.Bounds.Width -20) / 3;
}
}
public double PicWidth
{
get
{
if (IsVertical()) return Window.Current.Bounds.Width / 2;
else return Window.Current.Bounds.Height / 2;
}
}
public double ImageHeight
{
get
{
if (IsVertical()) return Window.Current.Bounds.Height / 3.5;
else return Window.Current.Bounds.Width / 3.5;
}
}
public double ImageWidth
{
get
{
if (IsVertical()) return Window.Current.Bounds.Width / 2.2;
else return Window.Current.Bounds.Height / 2.2;
}
}
public double Space
{
get { return Window.Current.Bounds.Height / 600; }
}
public double GridHeight
{
get
{
if (IsVertical()) return Window.Current.Bounds.Height / 6;
else return Window.Current.Bounds.Width / 6;
}
}
public double GridWidth
{
get
{
if (IsVertical()) return (Window.Current.Bounds.Width ) / 3;
else return (Window.Current.Bounds.Height) / 3;
}
}
public double ListHeight
{
get
{
if (IsVertical()) return Window.Current.Bounds.Height / 8;
else return Window.Current.Bounds.Width / 8;
}
}
public double Width
{
get { return Window.Current.Bounds.Width; }
}
public FileModel(string name, string image)
{
this.Name = name;
this.Image = image;
if (image == "f") IsVisible = false;
else IsVisible = true;
}
public FileModel(string name, string image, string count)
{
this.Name = name;
this.Image = image;
this.Count = count;
}
public FileModel(string name, StorageItemThumbnail background, string count)
{
ImageBrush im = new ImageBrush();
BitmapImage bm = new BitmapImage();
bm.SetSource(background);
im.ImageSource = bm;
im.Stretch = Stretch.UniformToFill;
this.Name = name;
this.Background = im;
this.Count = count;
}
public FileModel(string name, ImageBrush background, string count)
{
this.Name = name;
this.Background = background;
this.Count = count;
}
private bool IsVertical()
{
if (Window.Current.Bounds.Height > Window.Current.Bounds.Width) return true;
else return false;
}
}
}