using System.Windows.Controls;
namespace pEp.UI.Views
{
/// <summary>
/// Interaction logic for FormControlPatchView.xaml
/// </summary>
public partial class FormControlPatchView : UserControl
{
public FormControlPatchView()
{
InitializeComponent();
}
}
}
...@@ -973,52 +973,7 @@ ...@@ -973,52 +973,7 @@
FontSize="16" /> FontSize="16" />
<Separator /> <Separator />
<!--Patch management--> <!--New patch button-->
<ListBox Name="patchManagementListBox"
HorizontalContentAlignment="Stretch"
VerticalAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ItemsSource="{Binding Patches}"
MinHeight="300"
Margin="10,5" >
<ListBox.ContextMenu>
<ContextMenu DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}">
<MenuItem Header="Open"
Command="{Binding DataContext.CommandOpenPatch}"
CommandParameter="{Binding Path=SelectedItems}"/>
<MenuItem Header="Support"
Command="{Binding DataContext.CommandSupportPatch}"
CommandParameter="{Binding Path=SelectedItems}"/>
<MenuItem Header="Reject"
Command="{Binding DataContext.CommandRejectPatch}"
CommandParameter="{Binding Path=SelectedItems}"/>
</ContextMenu>
</ListBox.ContextMenu>
<ListBox.ItemTemplate>
<DataTemplate>
<ContentControl MouseDoubleClick="ContentControl_MouseDoubleClick">
<Grid Background="{Binding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="{Binding CommitMessage}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"
Foreground="{Binding Foreground}"
Margin="10"/>
<TextBlock Grid.Column="1"
Text="{Binding LastUpdate}"
TextTrimming="CharacterEllipsis"
VerticalAlignment="Center"
Foreground="{Binding Foreground}"
Margin="10"/>
</Grid>
</ContentControl>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="New patch" <Button Content="New patch"
Style="{StaticResource StyleButtonGray}" Style="{StaticResource StyleButtonGray}"
Margin="10,5,5,5" Margin="10,5,5,5"
......
<UserControl xmlns:UI="clr-namespace:pEp.UI" <UserControl x:Class="pEp.UI.Views.PatchDialogView"
x:Class="pEp.UI.Views.PatchDialogView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:p="clr-namespace:pEp.Properties"
xmlns:ui="clr-namespace:pEp.UI" xmlns:ui="clr-namespace:pEp.UI"
xmlns:vm="clr-namespace:pEp.UI.ViewModels" xmlns:vm="clr-namespace:pEp.UI.ViewModels"
mc:Ignorable="d" mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=vm:PatchDialogViewModel}" d:DataContext="{d:DesignInstance Type=vm:PatchDialogViewModel}"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
...@@ -26,105 +24,86 @@ ...@@ -26,105 +24,86 @@
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Grid.Column="0" <Label Grid.Row="0"
Grid.Row="0" Grid.Column="0"
Content="{Binding Explanation}" Grid.ColumnSpan="3"
Content="Change config"
Margin="10"/> Margin="10"/>
<Button Grid.Column="1" <ListBox Grid.Row="1"
Grid.Row="0" Grid.Column="0"
Content="Load from file" Margin="10"
Margin="10" Width="500"
HorizontalAlignment="Right" Height="500"
Style="{StaticResource StyleButtonGray}" SelectedItem="{Binding SelectedFile}"
Command="{Binding LoadFromFileCommand}" /> ItemsSource="{Binding ConfigFiles}">
<Label Grid.Column="0" <ListBox.ItemTemplate>
Grid.Row="1" <DataTemplate>
Content="Diff*" <ContentControl MouseDoubleClick="ListBoxItem_MouseDoubleClick">
Margin="10,10,5,10"/> <Label Content="{Binding FileName}" />
<UI:TextBoxWithPlaceholder Grid.Column="1" </ContentControl>
Grid.Row="1" </DataTemplate>
Text="{Binding Diff, UpdateSourceTrigger=PropertyChanged}" </ListBox.ItemTemplate>
MultiLine="True" </ListBox>
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertBool}}" <StackPanel Grid.Row="1"
IsValidInput="{Binding IsDiffValid}" Grid.Column="1">
Placeholder="Please add diff" <Button Content="Add file"
Height="400" Margin="5"
Width="600" Style="{StaticResource StyleButtonGray}"
Margin="5,10,10,10" Command="{Binding AddOrEditFileCommand}"/>
Visibility="{Binding IsEditable, Converter={StaticResource BoolToVisibility}}"/> <Button Content="Remove file"
<FlowDocumentScrollViewer Grid.Column="1" Margin="5"
Style="{StaticResource StyleButtonGray}"
Command="{Binding RemoveButtonCommand}" />
</StackPanel>
<FlowDocumentScrollViewer Grid.Column="2"
Grid.Row="1" Grid.Row="1"
Height="400" Width="500"
Width="600" Height="500"
BorderBrush="Black"
BorderThickness="1"
Margin="5,10,10,10" Margin="5,10,10,10"
Document="{Binding DisplayDiff}" HorizontalScrollBarVisibility="Auto"
Visibility="{Binding IsEditable, Converter={StaticResource InvertBoolToVisibility}}"/> Document="{Binding VisibleDiff}"/>
<Label Grid.Column="0" <ui:TextBoxWithPlaceholder Grid.Column="0"
Grid.Row="2" Grid.ColumnSpan="3"
Content="Uri*"
Margin="10,10,5,10"/>
<UI:TextBoxWithPlaceholder Grid.Column="1"
Grid.Row="2" Grid.Row="2"
Text="{Binding Uri}" Text="{Binding CommitMessage, UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertBool}}"
IsValidInput="{Binding IsUriValid}"
Placeholder="URI"
MinWidth="400"
Margin="5,10,10,10"/>
<Label Grid.Column="0"
Grid.Row="3"
Content="Commit message*"
Margin="10,10,5,10"/>
<UI:TextBoxWithPlaceholder Grid.Column="1"
Grid.Row="3"
Text="{Binding CommitMessage}"
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertBool}}"
IsValidInput="{Binding IsCommitMessageValid}" IsValidInput="{Binding IsCommitMessageValid}"
Placeholder="Commit message" Placeholder="Commit message"
MinWidth="400" Margin="5,10,10,10"
Margin="5,10,10,10"/> Visibility="{Binding IsEditable, Converter={StaticResource BoolToVisibility}}"/>
<Label Grid.Column="0" <ui:TextBoxWithPlaceholder Grid.Column="0"
Grid.Row="4" Grid.ColumnSpan="3"
Content="Tag" Grid.Row="3"
Margin="10,10,5,10"/> Text="{Binding Tag, UpdateSourceTrigger=PropertyChanged}"
<UI:TextBoxWithPlaceholder Grid.Column="1"
Grid.Row="4"
Text="{Binding Tag}"
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertBool}}"
Placeholder="Tag (optional)" Placeholder="Tag (optional)"
MinWidth="400" Margin="5,10,10,10"
Margin="5,10,10,10"/> Visibility="{Binding IsEditable, Converter={StaticResource BoolToVisibility}}"/>
<StackPanel Grid.Column="0" <StackPanel Grid.Column="0"
Grid.ColumnSpan="2" Grid.ColumnSpan="3"
Grid.Row="5" Grid.Row="4"
Orientation="Horizontal" Orientation="Horizontal"
HorizontalAlignment="Center"> HorizontalAlignment="Center"
Margin="10">
<Button Content="{Binding OKButtonText}" <Button Content="{Binding OKButtonText}"
Command="{Binding OKButtonCommand}" Command="{Binding OKButtonCommand}"
IsDefault="True" IsEnabled="{Binding IsValid}"
Visibility="{Binding IsOKButtonVisible, Converter={StaticResource BoolToVisibility}}" Margin="10"
Style="{StaticResource StyleButtonGray}" Style="{StaticResource StyleButtonGray}"/>
Margin="10" />
<Button Content="{Binding RejectButtonText}"
Command="{Binding RejectButtonCommand}"
Visibility="{Binding IsRejectButtonVisible, Converter={StaticResource BoolToVisibility}}"
Style="{StaticResource StyleButtonGray}"
Margin="10" />
<Button Content="{Binding CancelButtonText}" <Button Content="{Binding CancelButtonText}"
Margin="10"
Command="{Binding CancelButtonCommand}" Command="{Binding CancelButtonCommand}"
Visibility="{Binding IsCancelButtonVisible, Converter={StaticResource BoolToVisibility}}" Style="{StaticResource StyleButtonGray}"/>
Style="{StaticResource StyleButtonGray}"
Margin="10"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>
using System.Windows.Controls; using pEp.UI.Models;
using pEp.UI.ViewModels;
using System.Windows.Controls;
using System.Windows.Input;
namespace pEp.UI.Views namespace pEp.UI.Views
{ {
...@@ -7,9 +10,21 @@ namespace pEp.UI.Views ...@@ -7,9 +10,21 @@ namespace pEp.UI.Views
/// </summary> /// </summary>
public partial class PatchDialogView : UserControl public partial class PatchDialogView : UserControl
{ {
/// <summary>
/// Primary constructor.
/// </summary>
public PatchDialogView() public PatchDialogView()
{ {
InitializeComponent(); InitializeComponent();
} }
/// <summary>
/// Event handler for when a list box item is double-clicked.
/// </summary>
private void ListBoxItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
// Edit the file that is being double-clicked
(this.DataContext as PatchDialogViewModel)?.AddOrEditFileCommand?.Execute(((sender as ContentControl)?.DataContext as ConfigFile)?.FileName);
}
} }
} }
...@@ -251,6 +251,9 @@ ...@@ -251,6 +251,9 @@
--> -->
<ItemGroup> <ItemGroup>
<Reference Include="Accessibility" /> <Reference Include="Accessibility" />
<Reference Include="DiffPlex, Version=1.7.0.0, Culture=neutral, PublicKeyToken=1d35e91d1bd7bc0f, processorArchitecture=MSIL">
<HintPath>..\packages\DiffPlex.1.7.0\lib\net40\DiffPlex.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"> <Reference Include="Microsoft.Office.Interop.Outlook, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
</Reference> </Reference>
...@@ -267,6 +270,9 @@ ...@@ -267,6 +270,9 @@
<Reference Include="MimeKitLite, Version=2.10.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL"> <Reference Include="MimeKitLite, Version=2.10.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814, processorArchitecture=MSIL">
<HintPath>..\packages\MimeKitLite.2.10.1\lib\net45\MimeKitLite.dll</HintPath> <HintPath>..\packages\MimeKitLite.2.10.1\lib\net45\MimeKitLite.dll</HintPath>
</Reference> </Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"> <Reference Include="Office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c">
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
</Reference> </Reference>
...@@ -419,6 +425,13 @@ ...@@ -419,6 +425,13 @@
<DependentUpon>Resources.tr.resx</DependentUpon> <DependentUpon>Resources.tr.resx</DependentUpon>
</Compile> </Compile>
<Compile Include="Sequoia.cs" /> <Compile Include="Sequoia.cs" />
<Compile Include="UI\FormRegionDPE.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\FormRegionDPE.Designer.cs">
<DependentUpon>FormRegionDPE.cs</DependentUpon>
</Compile>
<Compile Include="UI\Models\ConfigFile.cs" />
<Compile Include="UI\Models\GroupWizard.cs" /> <Compile Include="UI\Models\GroupWizard.cs" />
<Compile Include="UI\Models\CustomMessageBox.cs" /> <Compile Include="UI\Models\CustomMessageBox.cs" />
<Compile Include="UI\Models\InputMessageBox.cs" /> <Compile Include="UI\Models\InputMessageBox.cs" />
...@@ -427,6 +440,7 @@ ...@@ -427,6 +440,7 @@
<Compile Include="UI\TextBoxWithPlaceholder.xaml.cs"> <Compile Include="UI\TextBoxWithPlaceholder.xaml.cs">
<DependentUpon>TextBoxWithPlaceholder.xaml</DependentUpon> <DependentUpon>TextBoxWithPlaceholder.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="UI\ViewModels\FormControlPatchViewModel.cs" />
<Compile Include="UI\ViewModels\GroupWizardAddMembersViewModel.cs" /> <Compile Include="UI\ViewModels\GroupWizardAddMembersViewModel.cs" />
<Compile Include="UI\ViewModels\GroupWizardNewListViewModel.cs" /> <Compile Include="UI\ViewModels\GroupWizardNewListViewModel.cs" />
<Compile Include="UI\ViewModels\GroupWizardViewModel.cs" /> <Compile Include="UI\ViewModels\GroupWizardViewModel.cs" />
...@@ -522,6 +536,9 @@ ...@@ -522,6 +536,9 @@
</Compile> </Compile>
<Compile Include="UI\ValueConverters.cs" /> <Compile Include="UI\ValueConverters.cs" />
<Compile Include="UI\ViewModels\ViewModelBase.cs" /> <Compile Include="UI\ViewModels\ViewModelBase.cs" />
<Compile Include="UI\Views\FormControlPatchView.xaml.cs">
<DependentUpon>FormControlPatchView.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Views\GroupWizardAddMembersView.xaml.cs"> <Compile Include="UI\Views\GroupWizardAddMembersView.xaml.cs">
<DependentUpon>GroupWizardAddMembersView.xaml</DependentUpon> <DependentUpon>GroupWizardAddMembersView.xaml</DependentUpon>
</Compile> </Compile>
...@@ -717,6 +734,10 @@ ...@@ -717,6 +734,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="UI\Views\FormControlPatchView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Views\GroupWizardAddMembersView.xaml"> <Page Include="UI\Views\GroupWizardAddMembersView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="DiffPlex" version="1.7.0" targetFramework="net45" />
<package id="Microsoft.VisualStudio.OLE.Interop" version="16.7.30328.74" targetFramework="net45" /> <package id="Microsoft.VisualStudio.OLE.Interop" version="16.7.30328.74" targetFramework="net45" />
<package id="MimeKitLite" version="2.10.1" targetFramework="net45" /> <package id="MimeKitLite" version="2.10.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net45" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.113.3" targetFramework="net45" /> <package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.113.3" targetFramework="net45" />
<package id="System.Buffers" version="4.5.1" targetFramework="net45" /> <package id="System.Buffers" version="4.5.1" targetFramework="net45" />
<package id="System.Data.SQLite.Core" version="1.0.113.7" targetFramework="net45" /> <package id="System.Data.SQLite.Core" version="1.0.113.7" targetFramework="net45" />
......