Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Windows
pEp for Outlook
Commits
2b3974db
Commit
2b3974db
authored
Sep 22, 2021
by
Thomas
Browse files
Renaming
parent
b58c6e33
Changes
2
Hide whitespace changes
Inline
Side-by-side
DPE/DPEWebClient.cs
View file @
2b3974db
...
@@ -7,11 +7,11 @@ namespace pEp.DPE
...
@@ -7,11 +7,11 @@ namespace pEp.DPE
{
{
internal
static
class
DPEWebClient
internal
static
class
DPEWebClient
{
{
private
static
readonly
HttpClient
httpClient
=
new
HttpClient
();
private
static
readonly
HttpClient
httpClient
=
new
HttpClient
();
private
static
readonly
string
dbePostUrl
=
Globals
.
ThisAddIn
.
Settings
.
DPEWebClientUrl
+
"patches/"
;
private
static
readonly
string
DPE_POST_URL
=
Globals
.
ThisAddIn
.
Settings
.
DPEWebClientUrl
+
"patches/"
;
public
static
readonly
string
REJECT_PATCH_SUFFIX
=
"/reject/"
;
public
const
string
REJECT_PATCH_SUFFIX
=
"/reject/"
;
public
static
readonly
string
SUPPORT_PATCH_SUFFIX
=
"/support/"
;
public
const
string
SUPPORT_PATCH_SUFFIX
=
"/support/"
;
/// <summary>
/// <summary>
/// Rejects a given patch.
/// Rejects a given patch.
...
@@ -20,11 +20,11 @@ namespace pEp.DPE
...
@@ -20,11 +20,11 @@ namespace pEp.DPE
/// <param name="me">The own identity that rejects the patch.</param>
/// <param name="me">The own identity that rejects the patch.</param>
public
static
async
void
RejectPatch
(
Patch
patch
,
PEPIdentity
me
)
public
static
async
void
RejectPatch
(
Patch
patch
,
PEPIdentity
me
)
{
{
// POST http://
server
:port/pEpDPE/patches/patch_id/reject
// POST http://
localhost
:port/pEpDPE/patches/patch_id/reject
try
try
{
{
HttpResponseMessage
response
=
HttpResponseMessage
response
=
await
DPEWebClient
.
httpClient
.
PostAsync
(
DPEWebClient
.
dbePostUrl
,
await
DPEWebClient
.
httpClient
.
PostAsync
(
DPEWebClient
.
DPE_POST_URL
,
new
StringContent
(
patch
.
Id
+
DPEWebClient
.
REJECT_PATCH_SUFFIX
));
new
StringContent
(
patch
.
Id
+
DPEWebClient
.
REJECT_PATCH_SUFFIX
));
Log
.
Verbose
(
$"SuggestPatch: Patch
{
patch
.
Id
}
rejected. Return status is
{
Enum
.
GetName
(
typeof
(
HttpStatusCode
),
response
.
StatusCode
)
}
"
);
Log
.
Verbose
(
$"SuggestPatch: Patch
{
patch
.
Id
}
rejected. Return status is
{
Enum
.
GetName
(
typeof
(
HttpStatusCode
),
response
.
StatusCode
)
}
"
);
}
}
...
@@ -41,12 +41,12 @@ namespace pEp.DPE
...
@@ -41,12 +41,12 @@ namespace pEp.DPE
/// <param name="me">The own identity that suggests the patch.</param>
/// <param name="me">The own identity that suggests the patch.</param>
public
static
async
void
SuggestPatch
(
Patch
patch
,
PEPIdentity
me
)
public
static
async
void
SuggestPatch
(
Patch
patch
,
PEPIdentity
me
)
{
{
// POST http://
server
:port/pEpDPE/patches/
// POST http://
localhost
:port/pEpDPE/patches/
string
xml
=
patch
.
Serialize
();
string
xml
=
patch
.
Serialize
();
try
try
{
{
HttpResponseMessage
response
=
HttpResponseMessage
response
=
await
DPEWebClient
.
httpClient
.
PostAsync
(
DPEWebClient
.
dbePostUrl
,
await
DPEWebClient
.
httpClient
.
PostAsync
(
DPEWebClient
.
DPE_POST_URL
,
new
StringContent
(
xml
));
new
StringContent
(
xml
));
Log
.
Verbose
(
$"SuggestPatch: New patch posted. Return status is
{
Enum
.
GetName
(
typeof
(
HttpStatusCode
),
response
.
StatusCode
)
}
"
);
Log
.
Verbose
(
$"SuggestPatch: New patch posted. Return status is
{
Enum
.
GetName
(
typeof
(
HttpStatusCode
),
response
.
StatusCode
)
}
"
);
}
}
...
@@ -63,11 +63,11 @@ namespace pEp.DPE
...
@@ -63,11 +63,11 @@ namespace pEp.DPE
/// <param name="me">The own identity that supports the patch.</param>
/// <param name="me">The own identity that supports the patch.</param>
public
static
async
void
SupportPatch
(
Patch
patch
,
PEPIdentity
me
)
public
static
async
void
SupportPatch
(
Patch
patch
,
PEPIdentity
me
)
{
{
// POST http://
server
:port/pEpDPE/patches/patch_id/support
// POST http://
localhost
:port/pEpDPE/patches/patch_id/support
try
try
{
{
HttpResponseMessage
response
=
HttpResponseMessage
response
=
await
DPEWebClient
.
httpClient
.
PostAsync
(
DPEWebClient
.
dbePostUrl
,
await
DPEWebClient
.
httpClient
.
PostAsync
(
DPEWebClient
.
DPE_POST_URL
,
new
StringContent
(
patch
.
Id
+
DPEWebClient
.
SUPPORT_PATCH_SUFFIX
));
new
StringContent
(
patch
.
Id
+
DPEWebClient
.
SUPPORT_PATCH_SUFFIX
));
Log
.
Verbose
(
$"SuggestPatch: Patch
{
patch
.
Id
}
supported. Return status is
{
Enum
.
GetName
(
typeof
(
HttpStatusCode
),
response
.
StatusCode
)
}
"
);
Log
.
Verbose
(
$"SuggestPatch: Patch
{
patch
.
Id
}
supported. Return status is
{
Enum
.
GetName
(
typeof
(
HttpStatusCode
),
response
.
StatusCode
)
}
"
);
}
}
...
...
UI/Views/PatchDialogView.xaml
View file @
2b3974db
...
@@ -98,6 +98,7 @@
...
@@ -98,6 +98,7 @@
<Button Content="{Binding OKButtonText}"
<Button Content="{Binding OKButtonText}"
Command="{Binding OKButtonCommand}"
Command="{Binding OKButtonCommand}"
IsEnabled="{Binding IsValid}"
IsEnabled="{Binding IsValid}"
IsDefault="True"
Margin="10"
Margin="10"
Style="{StaticResource StyleButtonGray}"/>
Style="{StaticResource StyleButtonGray}"/>
<Button Content="{Binding CancelButtonText}"
<Button Content="{Binding CancelButtonText}"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment