diff --git a/Lab/Exercise3/01-Start/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml b/Lab/Exercise3/01-Start/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml index 4fb7a79..6b4efd6 100644 --- a/Lab/Exercise3/01-Start/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml +++ b/Lab/Exercise3/01-Start/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml @@ -40,7 +40,7 @@ - + @@ -67,11 +67,11 @@ - + - + - + diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.Package/ContosoExpenses.Package.wapproj b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.Package/ContosoExpenses.Package.wapproj index cbfe31c..6b5199b 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.Package/ContosoExpenses.Package.wapproj +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.Package/ContosoExpenses.Package.wapproj @@ -34,21 +34,20 @@ - f0388f05-addf-498a-b87f-62c88aa49022 + 2d8fd114-a304-45b1-bca2-16949103603e 10.0.17763.0 10.0.17763.0 en-US ContosoExpenses.Package_TemporaryKey.pfx - 840FBCC4422ED8EF0A173F9309A29C681DF0B5EA ..\ContosoExpenses\ContosoExpenses.csproj Designer + - diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.Package/Package.appxmanifest b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.Package/Package.appxmanifest index a01cf89..aba7ddc 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.Package/Package.appxmanifest +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.Package/Package.appxmanifest @@ -1,28 +1,49 @@  - - + + + + + - Contoso Expenses - Windows AppConsult + ContosoExpenses.Package + mpagani Images\StoreLogo.png + + - + + - - - - + + + + - \ No newline at end of file + diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.sln b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.sln index 600e200..2e4933f 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.sln +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 16.0.28407.52 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContosoExpenses", "ContosoExpenses\ContosoExpenses.csproj", "{A3E7CBAC-2DFE-463B-B7F9-0B6477EA7A37}" EndProject -Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "ContosoExpenses.Package", "ContosoExpenses.Package\ContosoExpenses.Package.wapproj", "{F0388F05-ADDF-498A-B87F-62C88AA49022}" +Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "ContosoExpenses.Package", "ContosoExpenses.Package\ContosoExpenses.Package.wapproj", "{2D8FD114-A304-45B1-BCA2-16949103603E}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -29,24 +29,24 @@ Global {A3E7CBAC-2DFE-463B-B7F9-0B6477EA7A37}.Release|x64.Build.0 = Release|Any CPU {A3E7CBAC-2DFE-463B-B7F9-0B6477EA7A37}.Release|x86.ActiveCfg = Release|Any CPU {A3E7CBAC-2DFE-463B-B7F9-0B6477EA7A37}.Release|x86.Build.0 = Release|Any CPU - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|x64.ActiveCfg = Debug|x64 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|x64.Build.0 = Debug|x64 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|x64.Deploy.0 = Debug|x64 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|x86.ActiveCfg = Debug|x86 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|x86.Build.0 = Debug|x86 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Debug|x86.Deploy.0 = Debug|x86 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|Any CPU.Build.0 = Release|Any CPU - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|Any CPU.Deploy.0 = Release|Any CPU - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|x64.ActiveCfg = Release|x64 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|x64.Build.0 = Release|x64 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|x64.Deploy.0 = Release|x64 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|x86.ActiveCfg = Release|x86 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|x86.Build.0 = Release|x86 - {F0388F05-ADDF-498A-B87F-62C88AA49022}.Release|x86.Deploy.0 = Release|x86 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|x64.ActiveCfg = Debug|x64 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|x64.Build.0 = Debug|x64 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|x64.Deploy.0 = Debug|x64 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|x86.ActiveCfg = Debug|x86 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|x86.Build.0 = Debug|x86 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Debug|x86.Deploy.0 = Debug|x86 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|Any CPU.Build.0 = Release|Any CPU + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|Any CPU.Deploy.0 = Release|Any CPU + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|x64.ActiveCfg = Release|x64 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|x64.Build.0 = Release|x64 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|x64.Deploy.0 = Release|x64 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|x86.ActiveCfg = Release|x86 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|x86.Build.0 = Release|x86 + {2D8FD114-A304-45B1-BCA2-16949103603E}.Release|x86.Deploy.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AboutView.xaml b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AboutView.xaml index 01a72f4..438749e 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AboutView.xaml +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AboutView.xaml @@ -18,7 +18,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:toolkit="clr-namespace:Microsoft.Toolkit.Wpf.UI.Controls;assembly=Microsoft.Toolkit.Wpf.UI.Controls.WebView" mc:Ignorable="d" MinHeight="500" MinWidth="700" Height="500" Width="700"> @@ -27,7 +26,10 @@ - About Contoso: - + + Contoso Expenses is a 'modern application of yesterday tomorrow' from Contoso Corp. + + diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AboutView.xaml.cs b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AboutView.xaml.cs index 8502e06..7b508bc 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AboutView.xaml.cs +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AboutView.xaml.cs @@ -12,7 +12,6 @@ // ****************************************************************** -using Microsoft.Toolkit.Wpf.UI.Controls; using System.Linq; using System.Linq.Expressions; @@ -23,18 +22,6 @@ namespace ContosoExpenses public AboutView() { InitializeComponent(); - Loaded += AboutView_Loaded; - } - - private void AboutView_Loaded(object sender, System.Windows.RoutedEventArgs e) - { - // Workaround for scaling issue - var webView = LayoutRoot.Children.OfType().FirstOrDefault(); - - if(webView != null) - { - webView.NavigationCompleted += (s,a) => { webView.Height = this.Height; webView.Width = this.Width; }; - } } } } diff --git a/Lab/Exercise5/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml similarity index 91% rename from Lab/Exercise5/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml rename to Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml index 2a3c6fe..66a33e8 100644 --- a/Lab/Exercise5/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml @@ -59,10 +59,11 @@ - - - + + + diff --git a/Lab/Exercise5/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml.cs b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml.cs similarity index 69% rename from Lab/Exercise5/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml.cs rename to Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml.cs index 380ce35..67e7057 100644 --- a/Lab/Exercise5/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml.cs +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/AddNewExpense.xaml.cs @@ -29,6 +29,8 @@ namespace ContosoExpenses { public int EmployeeId { get; set; } + private DateTime SelectedDate; + public AddNewExpense() { InitializeComponent(); @@ -45,7 +47,7 @@ namespace ContosoExpenses Cost = Convert.ToDouble(txtAmount.Text), Description = txtDescription.Text, Type = txtType.Text, - Date = CalendarUwp.SelectedDates.FirstOrDefault().DateTime, + Date = SelectedDate, EmployeeId = EmployeeId }; @@ -59,14 +61,32 @@ namespace ContosoExpenses } } + private void CalendarUwp_ChildChanged(object sender, EventArgs e) + { + WindowsXamlHost windowsXamlHost = (WindowsXamlHost)sender; + + Windows.UI.Xaml.Controls.CalendarView calendarView = + (Windows.UI.Xaml.Controls.CalendarView)windowsXamlHost.Child; + + if (calendarView != null) + { + calendarView.SelectedDatesChanged += (obj, args) => + { + if (calendarView.SelectedDates.Count > 0) + { + SelectedDate = calendarView.SelectedDates.FirstOrDefault().DateTime; + txtDate.Text = SelectedDate.ToShortDateString(); + } + }; + + calendarView.MinDate = DateTimeOffset.Now.AddYears(-1); + calendarView.MaxDate = DateTimeOffset.Now; + } + } + private void Window_Closed(object sender, EventArgs e) { CalendarUwp.Dispose(); } - - private void CalendarUwp_SelectedDatesChanged(object sender, SelectedDatesChangedEventArgs e) - { - txtDate.Text = e.SelectedDates.FirstOrDefault().DateTime.ToShortDateString(); - } } } diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/App.xaml b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/App.xaml index e87dee4..4bdb029 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/App.xaml +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/App.xaml @@ -1,9 +1,55 @@ - + - + + + + + + + + + + + + + + + + + + diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ContosoExpenses.csproj b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ContosoExpenses.csproj index d4cb9f9..aefd115 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ContosoExpenses.csproj +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ContosoExpenses.csproj @@ -37,7 +37,7 @@ 4 - contoso.ico + Images\contoso.ico @@ -49,9 +49,6 @@ ..\packages\Microsoft.Toolkit.Wpf.UI.Controls.5.0.1\lib\net462\Microsoft.Toolkit.Wpf.UI.Controls.dll - - ..\packages\Microsoft.Toolkit.Wpf.UI.Controls.WebView.5.0.1\lib\net462\Microsoft.Toolkit.Wpf.UI.Controls.WebView.dll - ..\packages\Microsoft.Toolkit.Wpf.UI.XamlHost.5.0.1\lib\net462\Microsoft.Toolkit.Wpf.UI.XamlHost.dll @@ -62,7 +59,7 @@ False - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll + C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Runtime.WindowsRuntime.dll @@ -87,6 +84,9 @@ MSBuild:Compile Designer + + AddNewExpense.xaml + ExpensesList.xaml @@ -95,6 +95,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -152,7 +156,21 @@ - + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + \ No newline at end of file diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml index 99807a9..6b4efd6 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml @@ -1,54 +1,146 @@ - + - + Title="Expense Detail" Height="500" Width="800" + Background="{StaticResource HorizontalBackground}"> - - - - - - - - - - + + + + - + + + + + + + + + + + + - - - - + - - - - + + + + - - - - + + + + - - - - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml.cs b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml.cs index 0b6e06a..4275799 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml.cs +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpenseDetail.xaml.cs @@ -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; @@ -17,8 +31,9 @@ namespace ContosoExpenses public ExpenseDetail() { InitializeComponent(); + Signature.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Pen; + MapService.ServiceToken = "IFFAI5SFOtHV9VBKF8Ea~3FS1XamCV2NM0IqlfoQo6A~AguqcUboJvnqWU1H9E-6MVThouJoCrM4wpv_1R_KX_oQLV_e59vyoK42470JvLsU"; - SignatureCanvas.InkPresenter.InputDeviceTypes = CoreInputDeviceTypes.Mouse | CoreInputDeviceTypes.Pen; } private async void Window_Loaded(object sender, RoutedEventArgs e) @@ -27,24 +42,20 @@ namespace ContosoExpenses txtDescription.Text = SelectedExpense.Description; txtLocation.Text = SelectedExpense.Address; txtAmount.Text = SelectedExpense.Cost.ToString(); - - BasicGeoposition queryHint = new BasicGeoposition(); - queryHint.Latitude = 47.643; - queryHint.Longitude = -122.131; - Geopoint hintPoint = new Geopoint(queryHint); + Chart.Height = (SelectedExpense.Cost * 400) / 1000; var result = await MapLocationFinder.FindLocationsAsync(SelectedExpense.Address, null); var location = result.Locations.FirstOrDefault(); if (location != null) { - await UserLocation.TrySetViewAsync(location.Point, 13); + await ExpenseMap.TrySetViewAsync(location.Point, 13); } } - private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) + private void Window_Closed(object sender, EventArgs e) { - UserLocation.Dispose(); - SignatureCanvas.Dispose(); + Signature.Dispose(); + ExpenseMap.Dispose(); } } } diff --git a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpensesList.xaml b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpensesList.xaml index 7a15781..400d21e 100644 --- a/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpensesList.xaml +++ b/Lab/Exercise3/02-End/ContosoExpenses/ContosoExpenses/ExpensesList.xaml @@ -1,4 +1,19 @@ - + - - + Activated="Window_Activated" + Title="Expenses List" Height="450" Width="800" + Background="{StaticResource ExpensesListBackground}"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + +