Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Joona Romppanen
/
Moya Info Tools
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f78ff2de
authored
Jun 07, 2017
by
Joona Romppanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UserLoginControl cleanup & better exception handler
1 parent
9f01e3a2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
11 deletions
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/MoyaApiException.cs
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/RestClient.cs
MoyaSignup/UserLoginControl.Designer.cs
MoyaSignup/UserLoginControl.cs
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/MoyaApiException.cs
View file @
f78ff2d
...
...
@@ -5,16 +5,20 @@ namespace MoyaAdminLib
{
public
class
MoyaApiException
:
WebException
{
public
HttpStatusCode
StatusCode
{
get
;
set
;
}
public
MoyaApiException
()
{
}
public
MoyaApiException
(
string
message
)
:
base
(
message
)
public
MoyaApiException
(
string
message
,
HttpStatusCode
statusCode
)
:
base
(
message
)
{
StatusCode
=
statusCode
;
}
public
MoyaApiException
(
string
message
,
Exception
innerException
)
:
base
(
message
,
innerException
)
public
MoyaApiException
(
string
message
,
HttpStatusCode
statusCode
,
Exception
innerException
)
:
base
(
message
,
innerException
)
{
StatusCode
=
statusCode
;
}
}
}
MoyaAdmin/MoyaAdminUI/MoyaAdminLib/RestClient.cs
View file @
f78ff2d
...
...
@@ -141,8 +141,7 @@ namespace MoyaAdminLib
if
((
int
)
response
.
StatusCode
<
200
&&
(
int
)
response
.
StatusCode
>=
300
)
{
var
message
=
string
.
Format
(
"Request failed. Received HTTP {0}"
,
response
.
StatusCode
);
throw
new
ApplicationException
(
message
);
throw
new
MoyaApiException
(
"Request failed"
,
response
.
StatusCode
);
}
using
(
var
responseStream
=
response
.
GetResponseStream
())
...
...
@@ -171,7 +170,7 @@ namespace MoyaAdminLib
{
var
responseValue
=
StreamToString
(
responseStream
);
Console
.
WriteLine
(
"Response was "
+
responseValue
);
throw
new
MoyaApi
Exception
(
responseValue
,
e
);
throw
new
Web
Exception
(
responseValue
,
e
);
}
...
...
MoyaSignup/UserLoginControl.Designer.cs
View file @
f78ff2d
...
...
@@ -60,13 +60,13 @@
this
.
txtEmail
.
Name
=
"txtEmail"
;
this
.
txtEmail
.
Size
=
new
System
.
Drawing
.
Size
(
395
,
26
);
this
.
txtEmail
.
TabIndex
=
67
;
this
.
txtEmail
.
TextChanged
+=
new
System
.
EventHandler
(
this
.
t
xtEmail_TextChanged
);
this
.
txtEmail
.
KeyUp
+=
new
System
.
Windows
.
Forms
.
KeyEventHandler
(
this
.
t
xtEmail_KeyUp
);
this
.
txtEmail
.
TextChanged
+=
new
System
.
EventHandler
(
this
.
T
xtEmail_TextChanged
);
this
.
txtEmail
.
KeyUp
+=
new
System
.
Windows
.
Forms
.
KeyEventHandler
(
this
.
T
xtEmail_KeyUp
);
//
// timer1
//
this
.
timer1
.
Interval
=
500
;
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
t
imer1_Tick
);
this
.
timer1
.
Tick
+=
new
System
.
EventHandler
(
this
.
T
imer1_Tick
);
//
// infoLabel
//
...
...
@@ -89,7 +89,7 @@
this
.
passwordTextBox
.
Size
=
new
System
.
Drawing
.
Size
(
125
,
26
);
this
.
passwordTextBox
.
TabIndex
=
93
;
this
.
passwordTextBox
.
Visible
=
false
;
this
.
passwordTextBox
.
KeyDown
+=
new
System
.
Windows
.
Forms
.
KeyEventHandler
(
this
.
p
asswordTextBox_KeyDown
);
this
.
passwordTextBox
.
KeyDown
+=
new
System
.
Windows
.
Forms
.
KeyEventHandler
(
this
.
P
asswordTextBox_KeyDown
);
//
// loginButton
//
...
...
@@ -100,7 +100,7 @@
this
.
loginButton
.
Text
=
"Kirjaudu tapahtumaan"
;
this
.
loginButton
.
UseVisualStyleBackColor
=
true
;
this
.
loginButton
.
Visible
=
false
;
this
.
loginButton
.
Click
+=
new
System
.
EventHandler
(
this
.
l
oginButton_Click
);
this
.
loginButton
.
Click
+=
new
System
.
EventHandler
(
this
.
L
oginButton_Click
);
//
// forgottenPasswordButton
//
...
...
@@ -121,7 +121,7 @@
this
.
btnNewProfile
.
Text
=
"Lisää omat tiedot"
;
this
.
btnNewProfile
.
UseVisualStyleBackColor
=
true
;
this
.
btnNewProfile
.
Visible
=
false
;
this
.
btnNewProfile
.
Click
+=
new
System
.
EventHandler
(
this
.
b
tnNewProfile_Click
);
this
.
btnNewProfile
.
Click
+=
new
System
.
EventHandler
(
this
.
B
tnNewProfile_Click
);
//
// UserLoginControl
//
...
...
MoyaSignup/UserLoginControl.cs
View file @
f78ff2d
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment