Skip to content

Commit

Permalink
Updated items list model 🚗
Browse files Browse the repository at this point in the history
  • Loading branch information
Inestic committed Apr 14, 2021
1 parent 58df27e commit c548f41
Show file tree
Hide file tree
Showing 12 changed files with 250 additions and 3 deletions.
3 changes: 3 additions & 0 deletions SophiApp/SophiApp/Commons/JsonDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ namespace SophiApp.Commons
[DataContract]
public class JsonDTO
{
[DataMember(Name = "ArrowIsVisible")]
public bool ArrowIsVisible { get; set; }

[DataMember(Name = "ChildId")]
public List<int> ChildId { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion SophiApp/SophiApp/Controls/CheckBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<Setter Property="Foreground" Value="{DynamicResource Brush.Window.Foreground}" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="HorizontalAlignment" Value="Left" />
</Style>
<Style TargetType="{x:Type local:CheckBox}">
<Setter Property="Header" Value="{Binding Header, UpdateSourceTrigger=PropertyChanged}" />
Expand Down
68 changes: 68 additions & 0 deletions SophiApp/SophiApp/Controls/DropDownListBox.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<UserControl x:Class="SophiApp.Controls.DropDownListBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SophiApp.Controls"
mc:Ignorable="d">

<UserControl.Resources>
<Style TargetType="{x:Type StackPanel}" x:Key="Style.Grid.ViewBox.Wrapper">
<Setter Property="Background" Value="{Binding Path=Background, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="Width" Value="32" />
<Setter Property="Height" Value="32" />
<Setter Property="Panel.ZIndex" Value="30" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="Margin" Value="0" />
</Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="FontSize" Value="{Binding Path=FontSize, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="TextWrapping" Value="NoWrap" />
</Style>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="Panel.ZIndex" Value="10" />
<Setter Property="Width" Value="{Binding Path=Width, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="Height" Value="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
<Style TargetType="{x:Type StackPanel}">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="Background" Value="{Binding Path=Background, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="Width" Value="{Binding Path=Width, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="Height" Value="{Binding Path=Height, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<!--<Setter Property="Panel.ZIndex" Value="20" />-->
</Style>
<Style TargetType="{x:Type Viewbox}">
<Setter Property="Width" Value="12" />
<Setter Property="Height" Value="12" />
</Style>
<Style TargetType="{x:Type Canvas}">
<Setter Property="Width" Value="12" />
<Setter Property="Height" Value="12" />
</Style>
<Style TargetType="{x:Type Path}">
<Setter Property="Fill" Value="{Binding Path=Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
<Style TargetType="{x:Type local:DropDownListBox}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Focusable" Value="False" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display" />
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
<Setter Property="Background" Value="{DynamicResource Brush.Window.Background}" />
<Setter Property="Foreground" Value="{DynamicResource Brush.Window.Foreground}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<!--<Setter Property="Height" Value="32" />
<Setter Property="Width" Value="156" />-->
<Setter Property="FontSize" Value="14" />
</Style>
</UserControl.Resources>
<UserControl.Template>
<ControlTemplate>
</ControlTemplate>
</UserControl.Template>
</UserControl>
15 changes: 15 additions & 0 deletions SophiApp/SophiApp/Controls/DropDownListBox.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Windows.Controls;

namespace SophiApp.Controls
{
/// <summary>
/// Логика взаимодействия для DropDownListBox.xaml
/// </summary>
public partial class DropDownListBox : UserControl
{
public DropDownListBox()
{
InitializeComponent();
}
}
}
4 changes: 3 additions & 1 deletion SophiApp/SophiApp/Controls/ItemsList.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Filter="HasParentFilter" />
<converters:ActualHeightMultiply x:Key="ActualHeightMultiplyConverter" />
<converters:ObjectToIntList x:Key="ObjectToIntListConverter" />
<converters:BoolToVisibility x:Key="BoolToVisibilityConverter" />
<Style TargetType="{x:Type Viewbox}">
<Setter Property="Width" Value="16" />
<Setter Property="Height" Value="16" />
Expand All @@ -37,6 +38,7 @@
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Background" Value="{Binding Path=Background, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="Visibility" Value="{Binding ArrowIsVisible, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolToVisibilityConverter}}" />
</Style>
<Style TargetType="{x:Type Grid}" x:Key="Style.Grid.Header">
<Setter Property="DockPanel.Dock" Value="Top" />
Expand All @@ -46,7 +48,7 @@
<Setter Property="Fill" Value="{Binding Path=Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
<Setter Property="Data" Value="M15.1484 12.3516L15.8516 11.6484L8 3.79688L0.148438 11.6484L0.851562 12.3516L8 5.20312L15.1484 12.3516Z" />
</Style>
<Style TargetType="{x:Type TextBlock}" x:Key="Style.TextBlock.Header">
<Style TargetType="{x:Type TextBlock}" x:Key="Style.TextBlock.Header">
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Left" />
Expand Down
2 changes: 1 addition & 1 deletion SophiApp/SophiApp/Interfaces/IItemsListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ namespace SophiApp.Interfaces
{
internal interface IItemsListModel
{
bool ArrowIsVisible { get; set; }
List<int> ChildId { get; set; }

bool SelectOnce { get; set; }
}
}
1 change: 1 addition & 0 deletions SophiApp/SophiApp/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
<view:ViewContent Grid.Row="0" Header="{DynamicResource Localization.TaskSheduler}" Tag="{StaticResource Tags.View.TaskSheduler}" />
<view:ViewContent Grid.Row="0" Header="{DynamicResource Localization.Security}" Tag="{StaticResource Tags.View.Security}" />
<view:ViewContent Grid.Row="0" Header="{DynamicResource Localization.ContextMenu}" Tag="{StaticResource Tags.View.ContextMenu}" />
<view:ViewSettings Grid.Row="0" Header="{DynamicResource Localization.Settings}" Tag="{StaticResource Tags.View.Settings}" />
<controls:ChangesPanel Grid.Row="1" Panel.ZIndex="10" />
<controls:WaitingPanel Grid.Row="1" Panel.ZIndex="20" />
</Grid>
Expand Down
12 changes: 12 additions & 0 deletions SophiApp/SophiApp/Models/ItemsListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ namespace SophiApp.Models
{
internal class ItemsListModel : IUIElementModel, IItemsListModel, INotifyPropertyChanged
{
private bool arrowIsVisible;
private string header;

public ItemsListModel(JsonDTO json)
{
ArrowIsVisible = json.ArrowIsVisible;
Headers = json.Headers;
Id = json.Id;
Tag = json.Tag;
Expand All @@ -20,6 +22,16 @@ public ItemsListModel(JsonDTO json)

public event PropertyChangedEventHandler PropertyChanged;

public bool ArrowIsVisible
{
get => arrowIsVisible;
set
{
arrowIsVisible = value;
OnPropertyChanged("ArrowIsVisible");
}
}

public List<int> ChildId { get; set; }
public string Description { get; set; }

Expand Down
10 changes: 10 additions & 0 deletions SophiApp/SophiApp/Resources/UIElementsData.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
},
{
"Id": 101,
"ArrowIsVisible": "true",
"ChildId": [ 102, 103 ],
"Headers": {
"EN": "The OS level of diagnostic data gathering",
Expand Down Expand Up @@ -68,6 +69,7 @@
},
{
"Id": 105,
"ArrowIsVisible": "true",
"ChildId": [ 106, 107 ],
"Headers": {
"EN": "Windows should ask for my feedback",
Expand Down Expand Up @@ -107,6 +109,7 @@
},
{
"Id": 108,
"ArrowIsVisible": "true",
"ChildId": [ 109, 110, 111, 112, 113, 114, 115, 116, 117 ],
"Headers": {
"EN": "Diagnostic Tracking Tasks",
Expand Down Expand Up @@ -468,6 +471,7 @@
},
{
"Id": 134,
"ArrowIsVisible": "true",
"ChildId": [ 135, 136 ],
"Headers": {
"EN": "Open File Explorer to:",
Expand Down Expand Up @@ -591,6 +595,7 @@
},
{
"Id": 143,
"ArrowIsVisible": "true",
"ChildId": [ 144, 145 ],
"Headers": {
"EN": "File transfer dialog box",
Expand Down Expand Up @@ -714,6 +719,7 @@
},
{
"Id": 152,
"ArrowIsVisible": "true",
"ChildId": [ 153, 154, 155 ],
"Headers": {
"EN": "Search on the taskbar",
Expand Down Expand Up @@ -795,6 +801,7 @@
},
{
"Id": 158,
"ArrowIsVisible": "true",
"ChildId": [ 159, 160, 161 ],
"Headers": {
"EN": "View the Control Panel icons by:",
Expand Down Expand Up @@ -848,6 +855,7 @@
},
{
"Id": 162,
"ArrowIsVisible": "true",
"ChildId": [ 163, 164 ],
"Headers": {
"EN": "Windows mode color scheme",
Expand Down Expand Up @@ -887,6 +895,7 @@
},
{
"Id": 165,
"ArrowIsVisible": "true",
"ChildId": [ 166, 167 ],
"Headers": {
"EN": "App mode color scheme",
Expand Down Expand Up @@ -954,6 +963,7 @@
},
{
"Id": 170,
"ArrowIsVisible": "true",
"ChildId": [ 171, 172 ],
"Headers": {
"EN": "The quality factor of the JPEG desktop wallpapers",
Expand Down
14 changes: 14 additions & 0 deletions SophiApp/SophiApp/SophiApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
<Compile Include="Controls\CheckBox.xaml.cs">
<DependentUpon>CheckBox.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\DropDownListBox.xaml.cs">
<DependentUpon>DropDownListBox.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\FilledButton.xaml.cs">
<DependentUpon>FilledButton.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -149,6 +152,9 @@
<Compile Include="Views\ViewContent.xaml.cs">
<DependentUpon>ViewContent.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ViewSettings.xaml.cs">
<DependentUpon>ViewSettings.xaml</DependentUpon>
</Compile>
<Page Include="Commons\Constants.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand All @@ -157,6 +163,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\DropDownListBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Controls\ItemsList.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -253,6 +263,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ViewSettings.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
Expand Down
96 changes: 96 additions & 0 deletions SophiApp/SophiApp/Views/ViewSettings.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<UserControl x:Class="SophiApp.Views.ViewSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converters="clr-namespace:SophiApp.Converters"
xmlns:controls="clr-namespace:SophiApp.Controls"
xmlns:local="clr-namespace:SophiApp.Views"
mc:Ignorable="d">

<UserControl.Resources>
<converters:BoolToInverseBool x:Key="BoolToInverseBoolConverter" />
<converters:TagToVisibility x:Key="TagToVisibilityConverter" />
<Thickness x:Key="Animation.Page.Margin">0, 10, 0, 0</Thickness>
<Storyboard x:Key="Animation.Page.Visible">
<ThicknessAnimation Storyboard.TargetProperty="Margin"
From="{StaticResource Animation.Page.Margin}"
To="0, 0, 0, 0"
Duration="0:0:0.2" />
</Storyboard>
<Style x:Key="Style.Panel.Description" TargetType="{x:Type StackPanel}">
<Setter Property="Background" Value="{DynamicResource Brush.Window.Background}" />
<Setter Property="Grid.Column" Value="2" />
</Style>
<Style TargetType="{x:Type TextBlock}" x:Key="Style.TextBlock.Description">
<Setter Property="FontSize" Value="14" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="Margin" Value="10" />
<Setter Property="Text" Value="{Binding Path=Description, RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
<Style TargetType="{x:Type TextBlock}" x:Key="Style.TextBlock.Header">
<Setter Property="FontSize" Value="28" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Grid.Row" Value="0" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="0, 0, 0, 18" />
<Setter Property="Text" Value="{Binding Path=Header, RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
<Style TargetType="{x:Type local:ViewSettings}">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Focusable" Value="False" />
<Setter Property="TextOptions.TextFormattingMode" Value="Display" />
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType" />
<Setter Property="Background" Value="{DynamicResource Brush.View.Background}" />
<Setter Property="IsEnabled" Value="{Binding Path=WaitingPanelIsVisible, Converter={StaticResource BoolToInverseBoolConverter}, UpdateSourceTrigger=PropertyChanged}" />
<Setter Property="Visibility">
<Setter.Value>
<MultiBinding Converter="{StaticResource TagToVisibilityConverter}">
<Binding Path="ViewVisibilityByTag" UpdateSourceTrigger="PropertyChanged" />
<Binding Path="Tag" RelativeSource="{RelativeSource Self}" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<UserControl.Template>
<ControlTemplate>
<Grid Background="{Binding Path=Background, RelativeSource={RelativeSource TemplatedParent}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="20" />
<ColumnDefinition Width="6*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="80" />
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource Style.TextBlock.Header}" />
<ScrollViewer x:Name="ScrollViewerContent" Grid.Row="1" BorderBrush="{DynamicResource Brush.Window.Element.Border}">
<StackPanel>
<controls:DropDownListBox />
<TextBlock Text="Test" />
</StackPanel>
</ScrollViewer>
</Grid>
<StackPanel Style="{DynamicResource Style.Panel.Description}">
<TextBlock Style="{DynamicResource Style.TextBlock.Description}" />
</StackPanel>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource Animation.Page.Visible}" />
</Trigger.EnterActions>
</Trigger>
<Trigger Property="Visibility" Value="Collapsed">
<Setter Property="Margin" Value="{StaticResource Animation.Page.Margin}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</UserControl.Template>
</UserControl>
Loading

0 comments on commit c548f41

Please sign in to comment.