Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Layers Pattern in Practice

, 23 Apr 2010 CPOL
Layers Pattern via a WPF project.
AdditionalDependencies.zip
WPFVisifire.Charts.dll
AvalonControlsLibrary.dll
System.Windows.Controls.DataVisualization.Toolkit.dll
WPFToolkit.dll
BillsManager.zip
BillsManager
BillManagerUninstallAction
Properties
BillPayManager
Application.ico
BillPayManager.cd
BillPayManager.csproj.user
bin
Debug
AvalonControlsLibrary.dll
System.Windows.Controls.DataVisualization.Toolkit.dll
WPFToolkit.dll
WPFVisifire.Charts.dll
Charting
DataGrid
icon.ico
Images
about.png
archive.png
backArrow.png
bills.png
charts.png
fwdArrow.png
icon.ico
settings.png
Properties
Themes
BillPayManager.suo
BillsBusinessLogicLib
BillsBusinessLogicLib.csproj.user
BLLBills.cd
ciumac.sergiu.pfx
Properties
BillsDalLib
BillsDalClassDiagram.cd
BillsDalLib.csproj.user
ciumac.sergiu.pfx
DALSchema
Properties
BillsEntityLib
BillEntityClassDiagram.cd
BillsEntityLib.csproj.user
ciumac.sergiu.pfx
Properties
SetupBillPayManager
SetupBillPayManager.vdproj
TestBillPayManager
Properties
TestBillPayManager.csproj.user
TestBillPayManagerManual
AddBillManualTest.mht
DeleteBill.mht
Properties
Release.zip
AvalonControlsLibrary.dll
BillPayManager.exe
BillPayManager.vshost.exe
BillsBusinessLogicLib.dll
BillsDalLib.dll
BillsEntityLib.dll
System.Windows.Controls.DataVisualization.Toolkit.dll
WPFToolkit.dll
WPFVisifire.Charts.dll
en-US
BillPayManager.resources.dll
ro-RO
BillPayManager.resources.dll
ReleaseSetup.zip
SetupBillPayManager.msi
setup.exe
<Window 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:WPFToolkit="http://schemas.microsoft.com/wpf/2008/toolkit" 
    xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:core="clr-namespace:System;assembly=mscorlib"
    xmlns:src="clr-namespace:BillsEntityLib;assembly=BillsEntityLib"
    xmlns:billPayManager="clr-namespace:BillPayManager"
	xmlns:vc="clr-namespace:Visifire.Charts;assembly=WPFVisifire.Charts"  
	xmlns:avalon="clr-namespace:AC.AvalonControlsLibrary.Controls;assembly=AvalonControlsLibrary"
	mc:Ignorable="d"
	x:Uid="Window"
	x:Class="BillPayManager.MainWindow"
	x:Name="Window"
	Title="Bill Pay Manager"
	Width="640" Height="480" Background="#FFAEECEE" Closing="Window_Closing">
	<Window.Resources>           
        <billPayManager:DateConverter x:Key="DateConverter"/>    
		<!--_____________Create list of enumeration values___________________-->
        <ObjectDataProvider x:Key="myEnum" 
                            MethodName="GetValues" 
                            ObjectType="{x:Type core:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="src:BillStatus"/> <!--List of Bill Status enumeration type-->
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        
	</Window.Resources>
	<Grid x:Uid="Grid_3">
		<TabControl x:Uid="_tbMain" x:Name="_tbMain">
            <TabControl.Background>
                <LinearGradientBrush x:Uid="LinearGradientBrush_2" EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop x:Uid="GradientStop_5" Color="#FF498BCB" Offset="0"/>
                    <GradientStop x:Uid="GradientStop_6" Color="White" Offset="1"/>
                    <GradientStop x:Uid="GradientStop_7" Color="#FE8AB1D6"/>
                </LinearGradientBrush>
            </TabControl.Background>
            <TabItem x:Uid="_tiBills" x:Name="_tiBills" Header="Bills" Width="100" Selector.Selected="_tiBills_Selected">
				<Grid x:Uid="Grid_4">
					<Label x:Uid="_lListOfRecent" x:Name="_lListOfRecent" HorizontalAlignment="Left" VerticalAlignment="Top" Content="List of recent bills" Margin="63.63,8,0,0"/>
					<Image x:Uid="_iRecent" x:Name="_iRecent" Margin="8,4,0,0" Source="Images\bills.png" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top" Width="34.96" Height="34.96"/>
					<WPFToolkit:DataGrid x:Uid="_dgBills" Style="{StaticResource DataGrid}" ItemContainerStyle="{StaticResource ItemContStyle}" x:Name="_dgBills" Margin="8,42.96,8,167.08" IsReadOnly="False" AutoGenerateColumns="False" CanUserAddRows="False">
						<WPFToolkit:DataGrid.Columns>
							<WPFToolkit:DataGridTextColumn x:Uid="Custom:DataGridTextColumn_1" Header="Bill" Width="100" Binding="{Binding Name}"/>
							<WPFToolkit:DataGridTextColumn x:Uid="Custom:DataGridTextColumn_2" Header="Due Date" Width="100" Binding="{Binding DueDate, Converter={StaticResource DateConverter}}"/>
							<WPFToolkit:DataGridTextColumn x:Uid="Custom:DataGridTextColumn_3" Header="Amount" Width="75" Binding="{Binding Amount}"/>
							<WPFToolkit:DataGridTextColumn x:Uid="Custom:DataGridTextColumn_4" Header="Added On" Width="100" Binding="{Binding AddedOn, Converter={StaticResource DateConverter}}"/>
							<WPFToolkit:DataGridComboBoxColumn Header="Status" Width="75" SelectedItemBinding="{Binding BillStatus}" ItemsSource="{Binding Source={StaticResource myEnum}}"/>
						</WPFToolkit:DataGrid.Columns>
					</WPFToolkit:DataGrid>
					<Grid x:Uid="Grid_5" Margin="8,0,8,8" VerticalAlignment="Bottom" Height="155.08">
						<Label x:Uid="_lAddBills" x:Name="_lAddBills" HorizontalAlignment="Left" Content="Add Bills - Think about bill you have to pay : Electricity, Rent, Gas etc. " Margin="0,66,0,63.12" d:LayoutOverrides="Height"/>
                        <Label x:Uid="_lAmount" x:Name="_lAmount" Margin="290,0,0,36" VerticalAlignment="Bottom" Content="Amount" d:LayoutOverrides="Width" Height="25.96" HorizontalAlignment="Left" Width="53" />
                        <Button x:Uid="_btnAdd" x:Name="_btnAdd" Margin="378,0,0,15.08" Content="Add" Width="75" Click="_btnAdd_Click" HorizontalAlignment="Left" d:LayoutOverrides="Width" Height="21.96" VerticalAlignment="Bottom" />
                        <Label Height="28" Margin="200.209,0,0,0" Name="_labTotalAmountValue" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120">[Total Amount]</Label>
                        <Label Height="28" Margin="199.98,29.997,0,0" Name="_labNearestDeadline" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120.229">[Nearest Deadline]</Label>
                    </Grid>
					<Label x:Uid="_lDueDate" x:Name="_lDueDate" HorizontalAlignment="Left" Margin="135.987,0,0,45.04" VerticalAlignment="Bottom" Content="Due Date"/>
					<Label x:Uid="_lPayTo" x:Name="_lPayTo" HorizontalAlignment="Left" Margin="8,0,0,45.04" VerticalAlignment="Bottom" Content="Pay To"/>
                    <TextBox x:Uid="_tbPayTo" x:Name="_tbPayTo" HorizontalAlignment="Left" Margin="8,0,0,23.08" VerticalAlignment="Bottom" TextWrapping="Wrap" Width="100"/>
					<WPFToolkit:DatePicker x:Uid="_calendarDueDate" x:Name="_calendarDueDate" HorizontalAlignment="Left" Margin="135.987,0,0,23.08" VerticalAlignment="Bottom" Width="150.889" RenderTransformOrigin="1.567,0.587"/>
					<TextBox x:Uid="_tbAmount" x:Name="_tbAmount" Margin="297.876,0,0,23.08" VerticalAlignment="Bottom" TextWrapping="Wrap" Height="21.96" HorizontalAlignment="Left" Width="69" />
					<Button x:Uid="_btnNext" x:Name="_btnNext" Margin="0,0,8,8" VerticalAlignment="Bottom" Content="Add" Style="{DynamicResource NextStyle}" HorizontalAlignment="Right" Width="39.317" Height="41.08" Click="_btnNext_Click_1" />
					<Label x:Uid="_lNext" x:Name="_lNext" HorizontalAlignment="Right" Margin="0,0,12.49,49.08" VerticalAlignment="Bottom" Content="Next"/>
					<Label x:Uid="_lTotalAmount" x:Name="_lTotalAmount" HorizontalAlignment="Left" Margin="8,0,0,137.12" VerticalAlignment="Bottom" Content="Total amount"/>
                    <Label x:Uid="_lNearestDeadline" x:Name="_lNearestDeadline" HorizontalAlignment="Left" Margin="7,0,0,107.16" VerticalAlignment="Bottom" Content="Nearest Deadline" d:LayoutOverrides="HorizontalAlignment"/>
                    <Label Height="28" HorizontalAlignment="Right" Margin="0,9.09,8,0" Name="_labLastDays" VerticalAlignment="Top" Width="120">[Last # Days]</Label>
                </Grid>
			</TabItem>
			<TabItem x:Uid="_tiCharts" x:Name="_tiCharts" Header="Charts" Width="100" Selector.Selected="_tiCharts_Selected" Selector.Unselected="_tiCharts_Unselected">
				
				<Grid x:Uid="Grid_6">
					<Label x:Uid="_lSelectBill" x:Name="_lSelectBill" HorizontalAlignment="Left" Margin="89.999,0,0,0" VerticalAlignment="Top" Content="Select the bill"/>
					<ComboBox x:Uid="_cmbSelectBill" x:Name="_cmbSelectBill" Margin="89.999,25.96,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="120" SelectionChanged="_cmbSelectBill_SelectionChanged" SelectedIndex="0" />
					<Image x:Uid="_iSelect" x:Name="_iSelect" Source="Images\Charts.png" Stretch="Fill" VerticalAlignment="Top" Height="67" Margin="8,0,0,0" HorizontalAlignment="Left" Width="67"/>
					<Label x:Uid="_lInterval" x:Name="_lInterval" Margin="266,0,0,75.04" VerticalAlignment="Bottom" Content="Interval" Height="26" HorizontalAlignment="Left" Width="55" />
					<Button x:Uid="_btnChartNext" x:Name="_btnChartNext" HorizontalAlignment="Right" Margin="0,0,8,8" Style="{DynamicResource NextStyle}" VerticalAlignment="Bottom" Width="39.317" Height="41.08" Content="Add" Click="_btnChartNext_Click" />
					<Button x:Uid="_btnCPrev" x:Name="_btnCPrev" HorizontalAlignment="Right" Margin="0,0,47.317,10" Style="{DynamicResource PrevStyle}" VerticalAlignment="Bottom" Width="39.08" Height="39.08" Content="Button" Click="_btnCPrev_Click" />
					<vc:Chart x:Name="_chart" Margin="8,84,22,105.04" d:LayoutOverrides="Height" Style="{StaticResource ChartStyle}">
					<vc:Chart.Titles>
                		<vc:Title Text="Chart" Style="{StaticResource TitleStyle}"/>
            				</vc:Chart.Titles>
						<vc:Chart.AxesX>
							<vc:Axis IntervalType="Days"/>
						</vc:Chart.AxesX>
        			</vc:Chart>
					<Grid>
					 <avalon:RangeSlider x:Name="rangeSlider" Template="{StaticResource rangeSliderTemplate}" Margin="8,0,8,54.5" VerticalAlignment="Bottom" Height="22.04"  />
					 </Grid>
					<Label x:Name="_labSelectChartType" Margin="223.1,0,0,0" VerticalAlignment="Top" Content="Select chart type" Height="25.96" HorizontalAlignment="Left" Width="114" />
					<ComboBox Margin="223,25.96,0,0" VerticalAlignment="Top" Name="_cmbChartType" SelectedIndex="0" SelectionChanged="_cmbChartType_SelectionChanged" Height="21.96" HorizontalAlignment="Left" Width="114" />
					 
				</Grid>
			</TabItem>
			<TabItem x:Uid="_tiArchive" x:Name="_tiArchive" Header="Archive" Width="100" Selector.Selected="_tiArchive_Selected" >
			<Grid x:Uid="Grid_7">
				<WPFToolkit:DataGrid x:Uid="_dgBillsArchive" Style="{StaticResource DataGrid}" x:Name="_dgBillsArchive" Margin="8,60,8,121.502" CanUserAddRows="False" AutoGenerateColumns="False" IsReadOnly="True">
                        <WPFToolkit:DataGrid.Columns>
                            <WPFToolkit:DataGridTextColumn x:Uid="Custom:DataGridTextColumn_5" Header="Bill" Width="100" Binding="{Binding Name}"/>
                            <WPFToolkit:DataGridTextColumn x:Uid="Custom:DataGridTextColumn_6" Header="Due Date" Width="100" Binding="{Binding DueDate, Converter={StaticResource DateConverter}}"/>
                            <WPFToolkit:DataGridTextColumn x:Uid="Custom:DataGridTextColumn_7" Header="Amount" Width="75" Binding="{Binding Amount}"/>
                            <WPFToolkit:DataGridTextColumn x:Uid="Custom:DataGridTextColumn_8" Header="Added On" Width="100" Binding="{Binding AddedOn, Converter={StaticResource DateConverter}}"/>
                            <WPFToolkit:DataGridComboBoxColumn Header="Status" Width="75" SelectedItemBinding="{Binding BillStatus}" ItemsSource="{Binding Source={StaticResource myEnum}}"/>
                        </WPFToolkit:DataGrid.Columns>
                    </WPFToolkit:DataGrid>
                
				<Label x:Uid="_lArchive" x:Name="_lArchive" HorizontalAlignment="Left" Margin="83.05,8,0,0" VerticalAlignment="Top" Content="Archive"/>
				<Image x:Uid="_iArchive" x:Name="_iArchive" HorizontalAlignment="Left" Margin="8,0,0,0" Width="54" Source="Images\archive.png" Stretch="Fill" VerticalAlignment="Top" Height="54"/>
                    <Button x:Uid="_btnBack" x:Name="_btnABack" HorizontalAlignment="Right" Margin="0,0,47,10" Style="{DynamicResource PrevStyle}" VerticalAlignment="Bottom" Width="39.08" Height="39.08" Content="Button" RenderTransformOrigin="0.189,0.488" Click="_btnBack_Click" />
                    <Button x:Uid="_btnChartNext" x:Name="_btnArchiveNext" HorizontalAlignment="Right" Margin="0,0,8,8" Style="{DynamicResource NextStyle}" VerticalAlignment="Bottom" Width="39.317" Height="41.08" Content="Add" Click="_btnChartNext_Click" />
                    <Expander Header="General information about archive" Height="120.01" Margin="8,0,0,0" Name="_exGeneralInfo" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="517.292">
                        <Grid Width="590.962">
                            <Label Height="28" Name="_labTotalSum" VerticalAlignment="Top" HorizontalAlignment="Left" Width="84.042">Total Sum</Label>
                            <Label HorizontalAlignment="Left" Margin="0,0,0,18.008" Name="_labBiggestBill" Width="84.042" Height="26.308" VerticalAlignment="Bottom">Biggest bill</Label>
                            <Label Margin="222.778,0,210.105,0" Name="_labTotalSumByBillType" Height="27.784" VerticalAlignment="Top">Total sum by bill type</Label>
                            <ComboBox Margin="222.778,0,238.119,47.357" Name="_cmbBillType" Height="22.973" VerticalAlignment="Bottom" SelectionChanged="_cmbBillType_SelectionChanged" />
                            <Label HorizontalAlignment="Left" Margin="0,26.989,0,42.021" Name="_labArchiveSize" Width="84.042">Archive size</Label>
                            <Label Height="28" HorizontalAlignment="Right" Margin="0,0,380.917,0" Name="_labTotalSumValue" VerticalAlignment="Top" Width="120">Label</Label>
                            <Label HorizontalAlignment="Left" Margin="90.045,26.68,0,42.021" Name="_labArchiveSizeValue" Width="120">Label</Label>
                            <Label Height="28" HorizontalAlignment="Left" Margin="90.045,0,0,16.316" Name="_labBiggestBillValue" VerticalAlignment="Bottom" Width="120">Label</Label>
                            <Label Height="28" HorizontalAlignment="Right" Margin="0,0,94.047,0" Name="_labTotalSumByBilTypeValue" VerticalAlignment="Top" Width="120">Label</Label>
                        </Grid>
                    </Expander>
                    <CheckBox Height="16" Margin="0,38.178,8,0" Name="_cbReadOnly" VerticalAlignment="Top" HorizontalAlignment="Right" Width="72.72" IsEnabled="True" IsChecked="True" Click="_cbReadOnly_Click">Read only</CheckBox>
                </Grid>
			</TabItem>
			<TabItem x:Name="_tiMisc" Width="100" Header="Misc" Selector.Selected="_tiMisc_Selected">
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition Height="0.463*"/>
					<RowDefinition Height="0.537*"/>
				</Grid.RowDefinitions>
				<Image HorizontalAlignment="Left" Width="55" Source="Images\settings.png" Stretch="Fill" VerticalAlignment="Top" Height="55" Margin="8,0,0,0" Name="_iSettings" />
				<Label HorizontalAlignment="Left" Margin="67,8,0,0" VerticalAlignment="Top" Content="Settings" Name="_labSettings" />
				<Label HorizontalAlignment="Left" Margin="8,59,0,0" VerticalAlignment="Top" Content="Language" Name="_labLanguage" />
				<ComboBox HorizontalAlignment="Left" Margin="130,59,0,0" VerticalAlignment="Top" Width="120" Name="_cmbLanguages" SelectionChanged="_cmbLanguages_SelectionChanged" />
				<Button x:Uid="_btnExport" x:Name="_btnExport" HorizontalAlignment="Left" Margin="8,0,0,19.12" VerticalAlignment="Bottom" Width="75" Content="Export..." Click="_btnExport_Click" />
				<Label x:Uid="_lFileStorage" x:Name="_lFileStorage" HorizontalAlignment="Left" Margin="8,86.04,0,78.04" Content="File storage" d:LayoutOverrides="Height"/>
				<TextBox x:Uid="_tbFileStorage" x:Name="_tbFileStorage" Margin="8,0,0,51.08" VerticalAlignment="Bottom" TextWrapping="Wrap" IsEnabled="True" HorizontalAlignment="Left" Width="242" IsReadOnly="True" Height="22" />
				<Button x:Uid="_btnChange" x:Name="_btnChange" Margin="175,0,0,19.52" VerticalAlignment="Bottom" Content="Change..." Height="21.96" Width="75" Click="_btnChange_Click" HorizontalAlignment="Left" />
				<Image Margin="8,3.959,0,0" Source="Images\about.png" Stretch="Fill" HorizontalAlignment="Left" Width="55" VerticalAlignment="Top" Height="55" Grid.Row="1" Name="_iAbout" />
				<Label HorizontalAlignment="Left" Margin="76.96,3.934,0,0" VerticalAlignment="Top" Content="About" Grid.Row="1" Name="_labAbout" />
				<Label HorizontalAlignment="Left" Margin="8,62.934,0,0" Content="Product Name" Grid.Row="1" Name="_labTitle" VerticalAlignment="Top" />
				<Button x:Uid="_btnBack" x:Name="_btnMBack" HorizontalAlignment="Right" Margin="0,0,7,10" Style="{DynamicResource PrevStyle}" VerticalAlignment="Bottom" Width="39.08" Height="39.08" Content="Button" RenderTransformOrigin="0.189,0.488" Click="_btnBack_Click" Grid.Row="1" />
				<Label x:Uid="_lBack" x:Name="_lBack" HorizontalAlignment="Right" Margin="0,0,7,51" VerticalAlignment="Bottom" Content="Back" Height="25.96" Width="48.177" Grid.Row="1" />
				<CheckBox Margin="298,92.718,0,80.901" Content="Trace application" d:LayoutOverrides="Width, Height" Name="_chbTrace" Click="_chbTrace_Click" HorizontalAlignment="Left" Width="114" />
				<TextBox Margin="298,0,0,51.08" VerticalAlignment="Bottom" TextWrapping="Wrap" Name="_tbTracePath" IsReadOnly="True" Height="22" HorizontalAlignment="Left" Width="215" />
				<Button Margin="298,0,0,19.12" VerticalAlignment="Bottom" Content="Open..." Height="22" Name="_btnOpenTrace" Click="_btnOpenTrace_Click" HorizontalAlignment="Left" Width="75" />
                    <Label Margin="130,62.933,0,0" Content="Bill Pay Manager" Grid.Row="1" VerticalAlignment="Top" Height="25.96" HorizontalAlignment="Left" Width="383" />
				<Label HorizontalAlignment="Left" Margin="8,88.899,0,105.311" Content="Author" Grid.Row="1" d:LayoutOverrides="Height"/>
				<Label Margin="130,88.899,0,105.311" Content="Ciumac Sergiu (ciumac.sergiu@gmail.com)" Grid.Row="1" d:LayoutOverrides="Height" HorizontalAlignment="Left" Width="383" />
				<Label HorizontalAlignment="Left" Margin="8,0,0,79.351" VerticalAlignment="Bottom" Content="Version" Grid.Row="1" Name="_labVersion" />
				<Label HorizontalAlignment="Left" Margin="8,0,0,53.391" VerticalAlignment="Bottom" Content="Copyright" Grid.Row="1" Name="_labCopyright" />
				<Label HorizontalAlignment="Left" Margin="8,0,0,27.43" Content="Description" Grid.Row="1" VerticalAlignment="Bottom" Name="_labDescription" />
                    <Label Grid.Row="1" Height="28" Margin="130,0,0,76.356" Name="_labVersionValue" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="383">[Version]</Label>
                    <Label Grid.Row="1" Height="28" Margin="130,0,0,50.904" Name="_labCopyrightValue" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="383">[Copyright]</Label>
                    <Label Grid.Row="1" Height="28" Margin="130,0,0,24.543" Name="_labDescriptionValue" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="383">[Description]</Label>
                </Grid>
			</TabItem>
		</TabControl>
    </Grid>
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ciumac Sergiu
Software Developer
Moldova (Republic Of) Moldova (Republic Of)
Interested in computer science, math, research, and everything that relates to innovation. Fan of agnostic programming, don't mind developing under any platform/framework if it explores interesting topics. In search of a better programming paradigm.
Follow on   Twitter   LinkedIn

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 23 Apr 2010
Article Copyright 2010 by Ciumac Sergiu
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid