-
Notifications
You must be signed in to change notification settings - Fork 203
/
MainPageView.cs
223 lines (200 loc) · 9.89 KB
/
MainPageView.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#region Copyright Syncfusion Inc. 2001-2024.
// Copyright Syncfusion Inc. 2001-2024. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// [email protected]. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using Syncfusion.SfNavigationDrawer.iOS;
#if __UNIFIED__
using Foundation;
using UIKit;
using CoreGraphics;
#else
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.CoreGraphics;
using nint = System.Int32;
using nuint = System.Int32;
using CGSize = System.Drawing.SizeF;
using CGRect = System.Drawing.RectangleF;
using nfloat = System.Single;
#endif
namespace SampleBrowser
{
public class MainPageView : UIView
{
public UIView content;
UIView background;
UITableView maintable;
public string[] tableItems;
public string[] contentItems;
UILabel headerContentLabel;
UILabel textBlockLabel1;
public MainPageView (CGRect bounds)
{
headerContentLabel = new UILabel ();
this.BackgroundColor = UIColor.FromRGB(49,173,225);
this.Frame = new CGRect (0, 0, UIScreen.MainScreen.Bounds.Size.Width, UIScreen.MainScreen.Bounds.Size.Height);
content =new UIView(new CGRect(0,0,this.Frame.Width,this.Frame.Height));
background=new UIView(new CGRect(0,50,this.Frame.Width,this.Frame.Height-120));
background.BackgroundColor = UIColor.White;
setvalue1 (0);
this.Add(background);
background.Add(content);
headerContentLabel.Frame =new CGRect ((UIScreen.MainScreen.Bounds.Size.Width/2)-100, 10, 200, 30);
headerContentLabel.Text="Home";
headerContentLabel.TextColor = UIColor.White;
headerContentLabel.TextAlignment = UITextAlignment.Center;
this.AddSubview (headerContentLabel);
}
public MainPageView ()
{
}
public void setvalue1(int index)
{
nfloat width, height;
width = UIScreen.MainScreen.Bounds.Size.Width;
height = UIScreen.MainScreen.Bounds.Size.Height;
foreach(UIView sub in this.Subviews)
{
if(sub==content)
sub.RemoveFromSuperview();
}
content.RemoveFromSuperview ();
content =new UIView(new CGRect(0,0,this.Frame.Width,this.Frame.Height-120));
if (index == 0) {
headerContentLabel.Text = "Home";
content.BackgroundColor = UIColor.White;
textBlockLabel1 = new UILabel ();
textBlockLabel1.Frame = new CGRect(15, 10, width - 30, 300);
textBlockLabel1.Text = "Lorem ipsum dolor sit amet, lacus amet amet ultricies. Quisque mi venenatis morbi libero, orci dis, mi ut et class porta, massa ligula magna enim, aliquam orci vestibulum tempus. Turpis facilisis vitae consequat, cum a a, turpis dui consequat massa in dolor per, felis non amet. Auctor eleifend in omnis elit vestibulum, donec non elementum tellus est mauris, id aliquam, at lacus, arcu pretium proin lacus dolor et. Eu tortor, vel ultrices amet dignissim mauris vehicula. Lorem tortor neque, purus taciti quis id. Elementum integer orci accumsan minim phasellus vel.";
textBlockLabel1.LineBreakMode = UILineBreakMode.WordWrap;
textBlockLabel1.TextAlignment = UITextAlignment.Justified;
textBlockLabel1.Lines = 0;
textBlockLabel1.Font = UIFont.FromName ("Helvetica", 15f);
content.AddSubview (textBlockLabel1);
}
else if (index == 1) {
headerContentLabel.Text = "Profile";
content.BackgroundColor = UIColor.White;
UILabel usernameLabel = new UILabel ();
usernameLabel.Frame =new CGRect ((width/2), 20, 200, 30);
usernameLabel.Text="James Pollock";
usernameLabel.TextAlignment = UITextAlignment.Left;
content.AddSubview (usernameLabel);
UILabel userageLabel = new UILabel ();
userageLabel.Frame =new CGRect ((width/2), 45, 200, 30);
userageLabel.Text="Age 30";
userageLabel.Font = UIFont.FromName ("Helvetica", 18f);
userageLabel.TextAlignment = UITextAlignment.Left;
content.AddSubview (userageLabel);
UILabel emptyLabel = new UILabel ();
emptyLabel.Frame =new CGRect (10, 120, width-20, 1);
emptyLabel.BackgroundColor = UIColor.Gray;
content.AddSubview (emptyLabel);
UIImageView userImgLabel=new UIImageView();
userImgLabel.Frame =new CGRect((width/2)-100, 10, 80, 80);
userImgLabel.Image = new UIImage ("Images/User.png");
content.Add (userImgLabel);
UILabel commentLabel = new UILabel ();
commentLabel.Frame =new CGRect (20, 130, width-40, 200);
commentLabel.Text="It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout." +
" The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters. \n\nWhen looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters." +
"\n\n James Pollock";
commentLabel.Font = UIFont.FromName ("Helvetica", 15f);
commentLabel.LineBreakMode = UILineBreakMode.WordWrap;
commentLabel.Lines = 0;
content.AddSubview (commentLabel);
}else if (index == 2) {
headerContentLabel.Text = "Inbox";
maintable = new UITableView (new CGRect (0, 0, width, height)); // defaults to Plain style
if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
{
tableItems = new string[] { "John", "Caster", "Joey", "Xavier", "Gonzalez", "Rodriguez", "Ruben" ,"Keven","Walton"};
contentItems = new string[]
{"Hi John, See you at 7AM", "Hi Caster, See you at 9AM", "Hi Joey, See you at 11AM", "Hi Xavier, See you at 12PM", "Hi Gonzalez, See you at 1PM", "Hi Rodriguez, See you at 2PM",
"Hi Ruben, See you at 4PM","Hi Keven, See you at 5PM","Hi Walton, See you at 7PM"
};
}
else {
tableItems = new string[] { "John", "Caster", "Joey", "Xavier", "Gonzalez", "Rodriguez", "Ruben" };
contentItems = new string[] {"Hi John, See you at 10AM", "Hi Caster, See you at 11AM", "Hi Joey, See you at 1PM", "Hi Xavier, See you at 2PM", "Hi Gonzalez, See you at 3PM", "Hi Rodriguez, See you at 4PM",
"Hi Ruben, See you at 6PM"
};
}
TableSource tablesource = new TableSource (tableItems, contentItems);
tablesource.customise = true;
maintable.Source = tablesource;
content.Add (maintable);
} else if (index == 3) {
headerContentLabel.Text = "Outbox";
maintable = new UITableView (new CGRect (0, 0, width, height)); // defaults to Plain style
if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
{
tableItems = new string[] { "John", "Caster", "Joey", "Xavier", "Gonzalez", "Rodriguez", "Ruben" ,"Keven","Walton"};
contentItems = new string[]
{"Hi John, See you at 7AM", "Hi Caster, See you at 9AM", "Hi Joey, See you at 11AM", "Hi Xavier, See you at 12PM", "Hi Gonzalez, See you at 1PM", "Hi Rodriguez, See you at 2PM",
"Hi Ruben, See you at 4PM","Hi Keven, See you at 5PM","Hi Walton, See you at 7PM"
};
}
else {
tableItems = new string[] { "John", "Caster", "Joey", "Xavier", "Gonzalez", "Rodriguez", "Ruben" };
contentItems = new string[] {"Hi John, See you at 10AM", "Hi Caster, See you at 11AM", "Hi Joey, See you at 1PM", "Hi Xavier, See you at 2PM", "Hi Gonzalez, See you at 3PM", "Hi Rodriguez, See you at 4PM",
"Hi Ruben, See you at 6PM"
};
}
TableSource tablesource = new TableSource (tableItems, contentItems);
tablesource.customise = true;
maintable.Source = tablesource;
content.Add (maintable);
}else if (index == 4) {
headerContentLabel.Text = "Sent";
maintable = new UITableView (new CGRect (0, 0, width, height)); // defaults to Plain style
if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
{
tableItems = new string[] { "John", "Caster", "Joey", "Xavier", "Gonzalez", "Rodriguez", "Ruben" ,"Keven","Walton"};
contentItems = new string[]
{"Hi John, See you at 7AM", "Hi Caster, See you at 9AM", "Hi Joey, See you at 11AM", "Hi Xavier, See you at 12PM", "Hi Gonzalez, See you at 1PM", "Hi Rodriguez, See you at 2PM",
"Hi Ruben, See you at 4PM","Hi Keven, See you at 5PM","Hi Walton, See you at 7PM"
};
}
else {
tableItems = new string[] { "John", "Caster", "Joey", "Xavier", "Gonzalez", "Rodriguez", "Ruben" };
contentItems = new string[] {"Hi John, See you at 10AM", "Hi Caster, See you at 11AM", "Hi Joey, See you at 1PM", "Hi Xavier, See you at 2PM", "Hi Gonzalez, See you at 3PM", "Hi Rodriguez, See you at 4PM",
"Hi Ruben, See you at 6PM"
};
}
TableSource tablesource = new TableSource (tableItems, contentItems);
tablesource.customise = true;
maintable.Source = tablesource;
content.Add (maintable);
}
else if (index == 5) {
headerContentLabel.Text = "Trash";
maintable = new UITableView (new CGRect (0, 0, width, height)); // defaults to Plain style
if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
{
tableItems = new string[] { "John", "Caster", "Joey", "Xavier", "Gonzalez", "Rodriguez", "Ruben" ,"Keven","Walton"};
contentItems = new string[]
{"Hi John, See you at 7AM", "Hi Caster, See you at 9AM", "Hi Joey, See you at 11AM", "Hi Xavier, See you at 12PM", "Hi Gonzalez, See you at 1PM", "Hi Rodriguez, See you at 2PM",
"Hi Ruben, See you at 4PM","Hi Keven, See you at 5PM","Hi Walton, See you at 7PM"
};
}
else {
tableItems = new string[] { "John", "Caster", "Joey", "Xavier", "Gonzalez", "Rodriguez", "Ruben" };
contentItems = new string[] {"Hi John, See you at 10AM", "Hi Caster, See you at 11AM", "Hi Joey, See you at 1PM", "Hi Xavier, See you at 2PM", "Hi Gonzalez, See you at 3PM", "Hi Rodriguez, See you at 4PM",
"Hi Ruben, See you at 6PM"
};
}
TableSource tablesource = new TableSource (tableItems, contentItems);
tablesource.customise = true;
maintable.Source = tablesource;
content.Add (maintable);
}
background.Add(content);
}
}
}