This commit is contained in:
Sebastien Bovo 2019-01-11 10:40:02 +01:00
Родитель ea4b68e96d
Коммит 35ce6d2652
12 изменённых файлов: 287 добавлений и 69 удалений

Просмотреть файл

@ -27,7 +27,7 @@
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Center" FontSize="14" FontWeight="Bold" Margin="10">
Contoso Expenses is 'modern application of yesterday tomorow' from Contoso Corp.
Contoso Expenses is a 'modern application of yesterday tomorrow' from Contoso Corp.
</TextBlock>
<WebBrowser Grid.Row="1"
Source="https://contosocorpwebsite.azurewebsites.net/" />

Просмотреть файл

@ -1,4 +1,19 @@
<Window x:Class="ContosoExpenses.AddNewExpense"
<!--
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
-->
<Window x:Class="ContosoExpenses.AddNewExpense"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

Просмотреть файл

@ -1,4 +1,18 @@
using ContosoExpenses.Models;
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
using ContosoExpenses.Models;
using ContosoExpenses.Services;
using System;
using System.Windows;

Просмотреть файл

@ -1,24 +1,32 @@
<Application x:Class="ContosoExpenses.App"
<!--
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
-->
<Application x:Class="ContosoExpenses.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ContosoExpenses"
StartupUri="MainWindow.xaml">
<Application.Resources>
<SolidColorBrush x:Key="SemiTransparentBackground"
Color="#0073CF"
Opacity=".6" />
<!--Background images-->
<ImageBrush x:Key="MainBackground"
ImageSource="Images\ExpensesBackground.jpg"
Stretch="UniformToFill" />
<Style x:Key="DataGridHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="Foreground" Value="Black" />
</Style>
<Style x:Key="DataGridRowStyle" TargetType="DataGridRow">
<Setter Property="Cursor" Value="Hand" />
</Style>
<ImageBrush x:Key="HorizontalBackground"
ImageSource="Images\HorizontalBackground.png"
Stretch="UniformToFill" />
<ImageBrush x:Key="ExpensesListBackground"
ImageSource="Images\ExpensesListBackground.png"
@ -28,7 +36,20 @@
<ImageBrush x:Key="AddNewExpenseBackground"
ImageSource="Images\AddNewExpense.png"
Stretch="UniformToFill" />
<!--Styles for DataGrid-->
<Style x:Key="DataGridHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="Foreground" Value="Black" />
</Style>
<Style x:Key="DataGridRowStyle" TargetType="DataGridRow">
<Setter Property="Cursor" Value="Hand" />
</Style>
<SolidColorBrush x:Key="SemiTransparentBackground"
Color="#0073CF"
Opacity=".6" />
</Application.Resources>
</Application>

Просмотреть файл

@ -145,6 +145,9 @@
<Resource Include="Images\contoso.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="Images\HorizontalBackground.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Images\AddNewExpense.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

Просмотреть файл

@ -1,4 +1,19 @@
<Window x:Class="ContosoExpenses.ExpenseDetail"
<!--
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
-->
<Window x:Class="ContosoExpenses.ExpenseDetail"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -6,42 +21,116 @@
Loaded="Window_Loaded"
xmlns:local="clr-namespace:ContosoExpenses"
mc:Ignorable="d"
Title="Expense Detail" Height="450" Width="800">
Title="Expense Detail" Height="500" Width="600"
Background="{StaticResource HorizontalBackground}">
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock FontSize="24" Text="Expense" Grid.Row="0" />
<!-- Expense detail -->
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<TextBlock Text="Type:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtType" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
<TextBlock FontSize="24" Text="Expense" Grid.Row="0" />
<StackPanel Orientation="Horizontal" Grid.Row="2">
<TextBlock Text="Description:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtDescription" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<TextBlock Text="Type:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtType" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="3">
<TextBlock Text="Amount:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtAmount" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2">
<TextBlock Text="Description:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtDescription" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="3">
<TextBlock Text="Amount:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtAmount" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="4">
<TextBlock Text="Location:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtLocation" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
</Grid>
<!-- Chart -->
<DockPanel Grid.Column="1" VerticalAlignment="Bottom" Margin="20,0,0,0" MinHeight="420">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" x:Name="Chart" Width="50" VerticalAlignment="Bottom">
<Rectangle StrokeThickness="1" RadiusX="2" RadiusY="2">
<Rectangle.Stroke>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#4E87D4" Offset="0" />
<GradientStop Color="#73B2F5" Offset="1" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Stroke>
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FFFFFF" Offset="0" />
<GradientStop Color="#4E87D4" Offset="1" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</Grid>
<Grid Grid.Column="1" Width="20" Height="400" VerticalAlignment="Bottom">
<Rectangle StrokeThickness="1" RadiusX="2" RadiusY="2">
<Rectangle.Stroke>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF0000" Offset="0" />
<GradientStop Color="#4CFF00" Offset="1" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Stroke>
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF0000" Offset="0" />
<GradientStop Color="#4CFF00" Offset="1" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
</Grid>
</Grid>
<TextBlock Grid.Column="2" Text="1000$ limit" Margin="0,20,0,0"></TextBlock>
</DockPanel>
<StackPanel Orientation="Horizontal" Grid.Row="4">
<TextBlock Text="Location:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtLocation" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
</Grid>
</Window>

Просмотреть файл

@ -1,4 +1,18 @@
using System;
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
using System;
using System.Linq;
using System.Windows;
using ContosoExpenses.Models;
@ -23,6 +37,7 @@ namespace ContosoExpenses
txtDescription.Text = SelectedExpense.Description;
txtLocation.Text = SelectedExpense.Address;
txtAmount.Text = SelectedExpense.Cost.ToString();
Chart.Height = (SelectedExpense.Cost * 400) / 1000;
}
}
}

Просмотреть файл

@ -1,4 +1,19 @@
<Window x:Class="ContosoExpenses.ExpensesList"
<!--
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
-->
<Window x:Class="ContosoExpenses.ExpensesList"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -9,7 +24,7 @@
Activated="Window_Activated"
Title="Expenses List" Height="450" Width="800"
Background="{StaticResource ExpensesListBackground}">
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
@ -36,26 +51,26 @@
<TextBlock Text="E-mail:" FontSize="16" FontWeight="Bold" />
<TextBlock x:Name="txtEmail" FontSize="16" Margin="5, 0, 0, 0" />
</StackPanel>
<DataGrid x:Name="ExpensesGrid"
Grid.Row="4"
SelectionChanged="OnSelectedExpense"
AutoGenerateColumns="False"
AutoGenerateColumns="False"
IsReadOnly="True"
Grid.Row="4"
Margin="0, 12, 0, 0"
SelectionMode="Single"
Background="{StaticResource SemiTransparentBackground}"
RowBackground="{StaticResource SemiTransparentBackground}"
ColumnHeaderStyle="{StaticResource DataGridHeaderStyle}"
RowStyle="{StaticResource DataGridRowStyle}"
Foreground="White"
FontSize="14"
RowStyle="{StaticResource DataGridRowStyle}">
FontSize="14">
<DataGrid.Columns>
<DataGridTextColumn Header="Date" Binding="{Binding Path=Date}" />
<DataGridTextColumn Header="Type" Binding="{Binding Path=Type}" />
<DataGridTextColumn Header="Description" Binding="{Binding Path=Description}" />
<DataGridTextColumn Header="Cost" Binding="{Binding Path=Cost}" />
<DataGridTextColumn Header="City" Binding="{Binding Path=City}" />
<DataGridTextColumn Header="Date" Binding="{Binding Path=Date}" />
<DataGridTextColumn Header="Type" Binding="{Binding Path=Type}" />
<DataGridTextColumn Header="Description" Binding="{Binding Path=Description}" />
<DataGridTextColumn Header="Cost" Binding="{Binding Path=Cost}" />
<DataGridTextColumn Header="City" Binding="{Binding Path=City}" />
</DataGrid.Columns>
</DataGrid>

Просмотреть файл

@ -1,4 +1,18 @@
using System;
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 27 KiB

Просмотреть файл

@ -1,4 +1,19 @@
<Window x:Class="ContosoExpenses.MainWindow"
<!--
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
-->
<Window x:Class="ContosoExpenses.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@ -19,20 +34,23 @@
<MenuItem Header="_About" FontSize="12" Click="OnOpenAbout" />
</Menu>
<DataGrid x:Name="CustomersGrid" SelectionChanged="OnSelectedEmployee" Grid.Row="1" AutoGenerateColumns="False"
<DataGrid x:Name="CustomersGrid"
Grid.Row="1"
SelectionChanged="OnSelectedEmployee"
AutoGenerateColumns="False"
SelectionMode="Single"
IsReadOnly="True"
Background="{StaticResource SemiTransparentBackground}"
RowBackground="{StaticResource SemiTransparentBackground}"
ColumnHeaderStyle="{StaticResource DataGridHeaderStyle}"
RowStyle="{StaticResource DataGridRowStyle}"
Foreground="White"
FontSize="14"
RowStyle="{StaticResource DataGridRowStyle}">
FontSize="14">
<DataGrid.Columns>
<DataGridTextColumn Header="Employee Id" Binding="{Binding Path=EmployeeId}" />
<DataGridTextColumn Header="Name" Binding="{Binding Path=FirstName}" />
<DataGridTextColumn Header="Surname" Binding="{Binding Path=LastName}" />
<DataGridTextColumn Header="E-mail" Binding="{Binding Path=Email}" />
<DataGridTextColumn Header="Employee Id" Binding="{Binding Path=EmployeeId}" />
<DataGridTextColumn Header="Name" Binding="{Binding Path=FirstName}" />
<DataGridTextColumn Header="Surname" Binding="{Binding Path=LastName}" />
<DataGridTextColumn Header="E-mail" Binding="{Binding Path=Email}" />
</DataGrid.Columns>
</DataGrid>
</Grid>

Просмотреть файл

@ -1,4 +1,18 @@
using System.Collections.Generic;
// ******************************************************************
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the MIT License (MIT).
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
// ******************************************************************
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using ContosoExpenses.Models;