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
85b5a479
Commit
85b5a479
authored
Sep 17, 2021
by
Thomas
Browse files
Remove obsolete code from FormControlPatchView
parent
0cdb38d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
UI/ViewModels/FormControlPatchViewModel.cs
View file @
85b5a479
...
@@ -10,12 +10,6 @@ namespace pEp.UI.ViewModels
...
@@ -10,12 +10,6 @@ namespace pEp.UI.ViewModels
private
Patch
patch
;
private
Patch
patch
;
private
FlowDocument
_DisplayDiff
=
null
;
private
bool
_IsCommitMessageValid
=
false
;
private
bool
_IsDiffValid
=
false
;
private
bool
_IsUriValid
=
false
;
private
bool
_IsValid
=
false
;
#
endregion
#
endregion
#
region
Properties
#
region
Properties
...
@@ -54,55 +48,13 @@ namespace pEp.UI.ViewModels
...
@@ -54,55 +48,13 @@ namespace pEp.UI.ViewModels
/// <summary>
/// <summary>
/// Gets the diff of this patch as formatted flow document.
/// Gets the diff of this patch as formatted flow document.
/// </summary>
/// </summary>
public
FlowDocument
DisplayDiff
{
get
=>
this
.
_DisplayDiff
;
set
=>
SetProperty
(
ref
this
.
_DisplayDiff
,
value
)
;
}
public
FlowDocument
DisplayDiff
{
get
;
}
/// <summary>
/// <summary>
/// The explanation shown in the UI regarding this patch.
/// The explanation shown in the UI regarding this patch.
/// </summary>
/// </summary>
public
string
Explanation
{
get
;
}
public
string
Explanation
{
get
;
}
/// <summary>
/// Gets whether the Cancel button is visible.
/// </summary>
public
bool
IsCancelButtonVisible
{
get
;
}
=
true
;
/// <summary>
/// Gets or sets whether the commit message is valid.
/// </summary>
public
bool
IsCommitMessageValid
{
get
=>
this
.
_IsCommitMessageValid
;
set
{
if
(
value
!=
this
.
_IsCommitMessageValid
)
{
this
.
_IsCommitMessageValid
=
value
;
this
.
OnPropertyChanged
();
}
}
}
/// <summary>
/// Gets or sets whether the diff is valid.
/// </summary>
public
bool
IsDiffValid
{
get
=>
this
.
_IsDiffValid
;
set
{
if
(
value
!=
this
.
_IsDiffValid
)
{
this
.
_IsDiffValid
=
value
;
this
.
OnPropertyChanged
();
}
}
}
/// <summary>
/// Gets whether the patch in this dialog is editable.
/// </summary>
public
bool
IsEditable
{
get
;
}
=
false
;
/// <summary>
/// <summary>
/// Gets whether the OK button is visible.
/// Gets whether the OK button is visible.
/// </summary>
/// </summary>
...
@@ -113,42 +65,10 @@ namespace pEp.UI.ViewModels
...
@@ -113,42 +65,10 @@ namespace pEp.UI.ViewModels
/// </summary>
/// </summary>
public
bool
IsRejectButtonVisible
{
get
;
}
=
false
;
public
bool
IsRejectButtonVisible
{
get
;
}
=
false
;
/// <summary>
/// Gets or sets whether the URI is valid.
/// </summary>
public
bool
IsUriValid
{
get
=>
this
.
_IsUriValid
;
set
{
if
(
value
!=
this
.
_IsUriValid
)
{
this
.
_IsUriValid
=
value
;
this
.
OnPropertyChanged
();
}
}
}
/// <summary>
/// Gets or sets whether this patch is valid.
/// </summary>
public
bool
IsValid
{
get
=>
this
.
_IsValid
;
set
{
if
(
value
!=
this
.
_IsValid
)
{
this
.
_IsValid
=
value
;
this
.
OnPropertyChanged
();
}
}
}
/// <summary>
/// <summary>
/// The command to accept the patch dialog.
/// The command to accept the patch dialog.
/// </summary>
/// </summary>
public
RelayCommand
OKButtonCommand
=>
new
RelayCommand
(
this
.
SupportPatch
,
p
=>
this
.
IsValid
);
public
RelayCommand
OKButtonCommand
=>
new
RelayCommand
(
this
.
SupportPatch
);
/// <summary>
/// <summary>
/// Gets the OK button text.
/// Gets the OK button text.
...
@@ -205,11 +125,9 @@ namespace pEp.UI.ViewModels
...
@@ -205,11 +125,9 @@ namespace pEp.UI.ViewModels
/// </summary>
/// </summary>
/// <param name="patch">The patch to create the form region with.</param>
/// <param name="patch">The patch to create the form region with.</param>
/// <param name="submitter">The submitter of the patch.</param>
/// <param name="submitter">The submitter of the patch.</param>
/// <param name="isEditable">Whether this patch is editable.</param>
public
FormControlPatchViewModel
(
Patch
patch
,
PEPIdentity
submitter
)
public
FormControlPatchViewModel
(
Patch
patch
,
PEPIdentity
submitter
,
bool
isEditable
=
false
)
{
{
this
.
patch
=
patch
;
this
.
patch
=
patch
;
this
.
IsEditable
=
isEditable
;
this
.
Submitter
=
submitter
;
this
.
Submitter
=
submitter
;
this
.
Explanation
=
"New configuration changes pending approval"
;
this
.
Explanation
=
"New configuration changes pending approval"
;
this
.
IsRejectButtonVisible
=
true
;
this
.
IsRejectButtonVisible
=
true
;
...
@@ -267,11 +185,19 @@ namespace pEp.UI.ViewModels
...
@@ -267,11 +185,19 @@ namespace pEp.UI.ViewModels
return
document
;
return
document
;
}
}
/// <summary>
/// Rejects this patch.
/// </summary>
/// <param name="parameter">The command parameter.</param>
private
void
RejectPatch
(
object
parameter
)
private
void
RejectPatch
(
object
parameter
)
{
{
Globals
.
ThisAddIn
.
DistributedPolicyEngine
.
Reject
(
this
.
patch
,
new
PEPIdentity
());
Globals
.
ThisAddIn
.
DistributedPolicyEngine
.
Reject
(
this
.
patch
,
new
PEPIdentity
());
}
}
/// <summary>
/// Supports this patch.
/// </summary>
/// <param name="parameter">The command parameter.</param>
private
void
SupportPatch
(
object
parameter
)
private
void
SupportPatch
(
object
parameter
)
{
{
Globals
.
ThisAddIn
.
DistributedPolicyEngine
.
Support
(
this
.
patch
,
new
PEPIdentity
());
Globals
.
ThisAddIn
.
DistributedPolicyEngine
.
Support
(
this
.
patch
,
new
PEPIdentity
());
...
...
UI/Views/FormControlPatchView.xaml
View file @
85b5a479
...
@@ -65,74 +65,56 @@
...
@@ -65,74 +65,56 @@
HorizontalAlignment="Right"
HorizontalAlignment="Right"
VerticalAlignment="Center"
VerticalAlignment="Center"
Margin="5,5,10,5"/>
Margin="5,5,10,5"/>
<!--<Button Grid.Column="1"
Grid.Row="0"
Content="Load from file"
Margin="10"
HorizontalAlignment="Right"
Style="{StaticResource StyleButtonGray}"
Command="{Binding LoadFromFileCommand}"
Visibility="{Binding IsEditable, Converter={StaticResource BoolToVisibility}}"/>-->
<Label Grid.Column="0"
<Label Grid.Column="0"
Grid.Row="3"
Grid.Row="3"
Content="Diff"
Content="Diff"
Margin="10,10,5,10"/>
Margin="10,10,5,10"/>
<ui:TextBoxWithPlaceholder Grid.Column="1"
Grid.ColumnSpan="2"
Grid.Row="3"
Text="{Binding Diff, UpdateSourceTrigger=PropertyChanged}"
MultiLine="True"
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertBool}}"
IsValidInput="{Binding IsDiffValid}"
Placeholder="Please add diff"
Margin="5,10,10,10"
Visibility="{Binding IsEditable, Converter={StaticResource BoolToVisibility}}"/>
<FlowDocumentScrollViewer Grid.Column="1"
<FlowDocumentScrollViewer Grid.Column="1"
Grid.ColumnSpan="2"
Grid.ColumnSpan="2"
Grid.Row="3"
Grid.Row="3"
BorderBrush="Black"
BorderBrush="Black"
BorderThickness="1"
BorderThickness="1"
Margin="5,10,10,10"
Margin="5,10,10,10"
Document="{Binding DisplayDiff}"
Document="{Binding DisplayDiff}" />
Visibility="{Binding IsEditable, Converter={StaticResource InvertBoolToVisibility}}"/>
<Label Grid.Column="0"
<Label Grid.Column="0"
Grid.Row="4"
Grid.Row="4"
Content="Uri"
Content="Uri"
Margin="10,10,5,10"/>
Margin="10,10,5,10"/>
<
ui:
TextBox
WithPlaceholder
Grid.Column="1"
<TextBox Grid.Column="1"
Grid.ColumnSpan="2"
Grid.ColumnSpan="2"
Grid.Row="4"
Grid.Row="4"
Text="{Binding Uri}"
VerticalAlignment="Center"
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertBool}}
"
Padding="2
"
IsValidInpu
t="{Binding
Is
Uri
Valid
}"
Tex
t="{Binding Uri}"
Placeholder="URI
"
IsReadOnly="True
"
MinWidth="400"
MinWidth="400"
Margin="5,10,10,10"/>
Margin="5,10,10,10"/>
<Label Grid.Column="0"
<Label Grid.Column="0"
Grid.Row="5"
Grid.Row="5"
Content="Commit message"
Content="Commit message"
Margin="10,10,5,10"/>
Margin="10,10,5,10"/>
<
ui:
TextBox
WithPlaceholder
Grid.Column="1"
<TextBox Grid.Column="1"
Grid.ColumnSpan="2"
Grid.ColumnSpan="2"
Grid.Row="5"
Grid.Row="5"
Text="{Binding CommitMessage}
"
VerticalAlignment="Center
"
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertBool}}
"
Padding="2
"
IsValidInpu
t="{Binding
Is
CommitMessage
Valid
}"
Tex
t="{Binding CommitMessage}"
Placeholder="Commit messag
e"
IsReadOnly="Tru
e"
MinWidth="400"
MinWidth="400"
Margin="5,10,10,10"/>
Margin="5,10,10,10"/>
<Label Grid.Column="0"
<Label Grid.Column="0"
Grid.Row="6"
Grid.Row="6"
Content="Tag"
Content="Tag"
Margin="10,10,5,10"/>
Margin="10,10,5,10"/>
<ui:TextBoxWithPlaceholder Grid.Column="1"
<TextBox Grid.Column="1"
Grid.ColumnSpan="2"
Grid.ColumnSpan="2"
Grid.Row="6"
Grid.Row="6"
Text="{Binding Tag}"
VerticalAlignment="Center"
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertBool}}"
Padding="2"
Placeholder="Tag (optional)"
Text="{Binding Tag}"
MinWidth="400"
IsReadOnly="True"
Margin="5,10,10,10"/>
MinWidth="400"
Margin="5,10,10,10"/>
<StackPanel Grid.Column="0"
<StackPanel Grid.Column="0"
Grid.ColumnSpan="3"
Grid.ColumnSpan="3"
Grid.Row="7"
Grid.Row="7"
...
...
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