Skip to content

Commit 6672235

Browse files
Update WiFiAP sample (#227)
1 parent 300d06a commit 6672235

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

samples/WiFiAP/Resources/Html/main.html

+48
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
<!DOCTYPE html>
22
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<style>
8+
* {
9+
box-sizing: border-box;
10+
}
11+
12+
h1,
13+
legend {
14+
text-align: center;
15+
}
16+
17+
form {
18+
max-width: 250px;
19+
margin: 10px auto 0 auto;
20+
}
21+
22+
fieldset {
23+
border-radius: 5px;
24+
box-shadow: 3px 3px 15px hsl(0, 0%, 90%);
25+
font-size: large;
26+
}
27+
28+
input {
29+
width: 100%;
30+
padding: 4px;
31+
margin-bottom: 8px;
32+
border: 1px solid hsl(0, 0%, 50%);
33+
border-radius: 3px;
34+
font-size: medium;
35+
}
36+
37+
input[type=submit]:hover {
38+
cursor: pointer;
39+
background-color: hsl(0, 0%, 90%);
40+
transition: 0.5s;
41+
}
42+
43+
@media only screen and (max-width: 768px) {
44+
form {
45+
max-width: 100%;
46+
}
47+
}
48+
</style>
49+
<title>NanoFramework</title>
50+
</head>
351
<body>
452
<h1>NanoFramework</h1>
553
<form method='POST'>

samples/WiFiAP/WebServer.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static Hashtable ParseParams(string rawParams)
153153
static string CreateMainPage(string message)
154154
{
155155

156-
return "<!DOCTYPE html><html><body>" +
156+
return $"<!DOCTYPE html><html>{GetCss()}<body>" +
157157
"<h1>NanoFramework</h1>" +
158158
"<form method='POST'>" +
159159
"<fieldset><legend>Wireless configuration</legend>" +
@@ -165,5 +165,18 @@ static string CreateMainPage(string message)
165165
"<b>" + message + "</b>" +
166166
"</form></body></html>";
167167
}
168+
169+
static string GetCss()
170+
{
171+
return "<head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><style>" +
172+
"*{box-sizing: border-box}" +
173+
"h1,legend {text-align:center;}" +
174+
"form {max-width: 250px;margin: 10px auto 0 auto;}" +
175+
"fieldset {border-radius: 5px;box-shadow: 3px 3px 15px hsl(0, 0%, 90%);font-size: large;}" +
176+
"input {width: 100%;padding: 4px;margin-bottom: 8px;border: 1px solid hsl(0, 0%, 50%);border-radius: 3px;font-size: medium;}" +
177+
"input[type=submit]:hover {cursor: pointer;background-color: hsl(0, 0%, 90%);transition: 0.5s;}" +
178+
" @media only screen and (max-width: 768px) { form {max-width: 100%;}} " +
179+
"</style><title>NanoFramework</title></head>";
180+
}
168181
}
169182
}

0 commit comments

Comments
 (0)