Skip to content

Commit a0dd1a0

Browse files
authored
Add files via upload
0 parents  commit a0dd1a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2056
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Concurrent;
3+
4+
namespace POC_Basket.Core.Helpers
5+
{
6+
public static class Singleton<T>
7+
where T : new()
8+
{
9+
private static ConcurrentDictionary<Type, T> _instances = new ConcurrentDictionary<Type, T>();
10+
11+
public static T Instance
12+
{
13+
get
14+
{
15+
return _instances.GetOrAdd(typeof(T), (t) => new T());
16+
}
17+
}
18+
}
19+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
3+
namespace POC_Basket.Core.Models
4+
{
5+
// TODO WTS: Remove this class once your pages/features are using your data.
6+
// This is used by the SampleDataService.
7+
// It is the model class we use to display data on pages like Grid, Chart, and Master Detail.
8+
public class SampleOrder
9+
{
10+
public long OrderId { get; set; }
11+
12+
public DateTime OrderDate { get; set; }
13+
14+
public string Company { get; set; }
15+
16+
public string ShipTo { get; set; }
17+
18+
public double OrderTotal { get; set; }
19+
20+
public string Status { get; set; }
21+
22+
public char Symbol { get; set; }
23+
24+
public bool? isLoading { get; set; }
25+
26+
public object Clone()
27+
{
28+
object copy = this.MemberwiseClone();
29+
((SampleOrder)copy).isLoading = false;
30+
return copy;
31+
}
32+
33+
public override string ToString()
34+
{
35+
return $"{Company} {Status}";
36+
}
37+
}
38+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<RootNamespace>POC_Basket.Core</RootNamespace>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<Folder Include="Models\" />
10+
</ItemGroup>
11+
</Project>
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Collections.ObjectModel;
4+
5+
using POC_Basket.Core.Models;
6+
7+
namespace POC_Basket.Core.Services
8+
{
9+
// This class holds sample data used by some generated pages to show how they can be used.
10+
// TODO WTS: Delete this file once your app is using real data.
11+
public static class SampleDataService
12+
{
13+
private static IEnumerable<SampleOrder> AllOrders()
14+
{
15+
// The following is order summary data
16+
var data = new ObservableCollection<SampleOrder>
17+
{
18+
new SampleOrder
19+
{
20+
OrderId = 70,
21+
OrderDate = new DateTime(2017, 05, 24),
22+
Company = "Company F",
23+
ShipTo = "Francisco Pérez-Olaeta",
24+
OrderTotal = 2490.00,
25+
Status = "Closed",
26+
Symbol = (char)57643,
27+
isLoading = false
28+
},
29+
new SampleOrder
30+
{
31+
OrderId = 71,
32+
OrderDate = new DateTime(2017, 05, 24),
33+
Company = "Company CC",
34+
ShipTo = "Soo Jung Lee",
35+
OrderTotal = 1760.00,
36+
Status = "Closed",
37+
Symbol = (char)57737,
38+
isLoading = false
39+
},
40+
new SampleOrder
41+
{
42+
OrderId = 72,
43+
OrderDate = new DateTime(2017, 06, 03),
44+
Company = "Company Z",
45+
ShipTo = "Run Liu",
46+
OrderTotal = 2310.00,
47+
Status = "Closed",
48+
Symbol = (char)57699,
49+
isLoading = false
50+
},
51+
new SampleOrder
52+
{
53+
OrderId = 73,
54+
OrderDate = new DateTime(2017, 06, 05),
55+
Company = "Company Y",
56+
ShipTo = "John Rodman",
57+
OrderTotal = 665.00,
58+
Status = "Closed",
59+
Symbol = (char)57620,
60+
isLoading = false
61+
},
62+
new SampleOrder
63+
{
64+
OrderId = 74,
65+
OrderDate = new DateTime(2017, 06, 07),
66+
Company = "Company H",
67+
ShipTo = "Elizabeth Andersen",
68+
OrderTotal = 560.00,
69+
Status = "Shipped",
70+
Symbol = (char)57633,
71+
isLoading = false
72+
},
73+
new SampleOrder
74+
{
75+
OrderId = 75,
76+
OrderDate = new DateTime(2017, 06, 07),
77+
Company = "Company F",
78+
ShipTo = "Francisco Pérez-Olaeta",
79+
OrderTotal = 810.00,
80+
Status = "Shipped",
81+
Symbol = (char)57661,
82+
isLoading = false
83+
},
84+
new SampleOrder
85+
{
86+
OrderId = 76,
87+
OrderDate = new DateTime(2017, 06, 11),
88+
Company = "Company I",
89+
ShipTo = "Sven Mortensen",
90+
OrderTotal = 196.50,
91+
Status = "Shipped",
92+
Symbol = (char)57619,
93+
isLoading = false
94+
},
95+
new SampleOrder
96+
{
97+
OrderId = 77,
98+
OrderDate = new DateTime(2017, 06, 14),
99+
Company = "Company BB",
100+
ShipTo = "Amritansh Raghav",
101+
OrderTotal = 270.00,
102+
Status = "New",
103+
Symbol = (char)57615,
104+
isLoading = false
105+
},
106+
new SampleOrder
107+
{
108+
OrderId = 78,
109+
OrderDate = new DateTime(2017, 06, 14),
110+
Company = "Company A",
111+
ShipTo = "Anna Bedecs",
112+
OrderTotal = 736.00,
113+
Status = "New",
114+
Symbol = (char)57625,
115+
isLoading = false
116+
},
117+
new SampleOrder
118+
{
119+
OrderId = 79,
120+
OrderDate = new DateTime(2017, 06, 18),
121+
Company = "Company K",
122+
ShipTo = "Peter Krschne",
123+
OrderTotal = 800.00,
124+
Status = "New",
125+
Symbol = (char)57806,
126+
isLoading = false
127+
},
128+
};
129+
130+
return data;
131+
}
132+
133+
// TODO WTS: Remove this once your grid page is displaying real data.
134+
public static ObservableCollection<SampleOrder> GetGridSampleData()
135+
{
136+
return new ObservableCollection<SampleOrder>(AllOrders());
137+
}
138+
}
139+
}

POC_Basket/POC_Basket.Core/readme.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This core project is a .net standard project.
2+
It's a great place to put all your logic that is not platform dependent (e.g. model/helper classes) so they can be reused.

POC_Basket/POC_Basket.sln

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28606.126
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "POC_Basket", "POC_Basket\POC_Basket.csproj", "{E659E974-B79A-416F-946A-3E1BD9B6719E}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "POC_Basket.Core", "POC_Basket.Core\POC_Basket.Core.csproj", "{198254A3-C99A-4EAF-AE0B-EB4049BD0826}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Debug|ARM = Debug|ARM
14+
Debug|x64 = Debug|x64
15+
Debug|x86 = Debug|x86
16+
Release|Any CPU = Release|Any CPU
17+
Release|ARM = Release|ARM
18+
Release|x64 = Release|x64
19+
Release|x86 = Release|x86
20+
EndGlobalSection
21+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
22+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|Any CPU.ActiveCfg = Debug|x86
23+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|ARM.ActiveCfg = Debug|ARM
24+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|ARM.Build.0 = Debug|ARM
25+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|ARM.Deploy.0 = Debug|ARM
26+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|x64.ActiveCfg = Debug|x64
27+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|x64.Build.0 = Debug|x64
28+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|x64.Deploy.0 = Debug|x64
29+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|x86.ActiveCfg = Debug|x86
30+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|x86.Build.0 = Debug|x86
31+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Debug|x86.Deploy.0 = Debug|x86
32+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|Any CPU.ActiveCfg = Release|x86
33+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|ARM.ActiveCfg = Release|ARM
34+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|ARM.Build.0 = Release|ARM
35+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|ARM.Deploy.0 = Release|ARM
36+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|x64.ActiveCfg = Release|x64
37+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|x64.Build.0 = Release|x64
38+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|x64.Deploy.0 = Release|x64
39+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|x86.ActiveCfg = Release|x86
40+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|x86.Build.0 = Release|x86
41+
{E659E974-B79A-416F-946A-3E1BD9B6719E}.Release|x86.Deploy.0 = Release|x86
42+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Debug|Any CPU.Build.0 = Debug|Any CPU
44+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Debug|ARM.ActiveCfg = Debug|Any CPU
45+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Debug|ARM.Build.0 = Debug|Any CPU
46+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Debug|x64.ActiveCfg = Debug|Any CPU
47+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Debug|x64.Build.0 = Debug|Any CPU
48+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Debug|x86.ActiveCfg = Debug|Any CPU
49+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Debug|x86.Build.0 = Debug|Any CPU
50+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Release|Any CPU.ActiveCfg = Release|Any CPU
51+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Release|Any CPU.Build.0 = Release|Any CPU
52+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Release|ARM.ActiveCfg = Release|Any CPU
53+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Release|ARM.Build.0 = Release|Any CPU
54+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Release|x64.ActiveCfg = Release|Any CPU
55+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Release|x64.Build.0 = Release|Any CPU
56+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Release|x86.ActiveCfg = Release|Any CPU
57+
{198254A3-C99A-4EAF-AE0B-EB4049BD0826}.Release|x86.Build.0 = Release|Any CPU
58+
EndGlobalSection
59+
GlobalSection(SolutionProperties) = preSolution
60+
HideSolutionNode = FALSE
61+
EndGlobalSection
62+
GlobalSection(ExtensibilityGlobals) = postSolution
63+
SolutionGuid = {3F13DB5D-4A5E-4A63-897F-0CE736B03D09}
64+
EndGlobalSection
65+
EndGlobal
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
4+
namespace POC_Basket.Activation
5+
{
6+
// For more information on application activation see https://github.com/Microsoft/WindowsTemplateStudio/blob/master/docs/activation.md
7+
internal abstract class ActivationHandler
8+
{
9+
public abstract bool CanHandle(object args);
10+
11+
public abstract Task HandleAsync(object args);
12+
}
13+
14+
internal abstract class ActivationHandler<T> : ActivationHandler
15+
where T : class
16+
{
17+
protected abstract Task HandleInternalAsync(T args);
18+
19+
public override async Task HandleAsync(object args)
20+
{
21+
await HandleInternalAsync(args as T);
22+
}
23+
24+
public override bool CanHandle(object args)
25+
{
26+
return args is T && CanHandleInternal(args as T);
27+
}
28+
29+
protected virtual bool CanHandleInternal(T args)
30+
{
31+
return true;
32+
}
33+
}
34+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
4+
using POC_Basket.Services;
5+
using POC_Basket.ViewModels;
6+
7+
using Windows.ApplicationModel.Activation;
8+
9+
namespace POC_Basket.Activation
10+
{
11+
internal class DefaultLaunchActivationHandler : ActivationHandler<LaunchActivatedEventArgs>
12+
{
13+
private readonly string _navElement;
14+
15+
public NavigationServiceEx NavigationService => ViewModelLocator.Current.NavigationService;
16+
17+
public DefaultLaunchActivationHandler(Type navElement)
18+
{
19+
_navElement = navElement.FullName;
20+
}
21+
22+
protected override async Task HandleInternalAsync(LaunchActivatedEventArgs args)
23+
{
24+
// When the navigation stack isn't restored, navigate to the first page and configure
25+
// the new page by passing required information in the navigation parameter
26+
NavigationService.Navigate(_navElement, args.Arguments);
27+
28+
await Task.CompletedTask;
29+
}
30+
31+
protected override bool CanHandleInternal(LaunchActivatedEventArgs args)
32+
{
33+
// None of the ActivationHandlers has handled the app activation
34+
return NavigationService.Frame.Content == null;
35+
}
36+
}
37+
}

POC_Basket/POC_Basket/App.xaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Application
2+
x:Class="POC_Basket.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
>
6+
7+
<Application.Resources>
8+
<ResourceDictionary>
9+
<ResourceDictionary.MergedDictionaries>
10+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls"/>
11+
<ResourceDictionary Source="/Styles/_Colors.xaml"/>
12+
<ResourceDictionary Source="/Styles/_FontSizes.xaml"/>
13+
<ResourceDictionary Source="/Styles/_Thickness.xaml"/>
14+
15+
<ResourceDictionary Source="/Styles/TextBlock.xaml"/>
16+
<ResourceDictionary Source="/Styles/Page.xaml"/>
17+
18+
<ResourceDictionary Source="ms-appx:///Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.xaml"/>
19+
</ResourceDictionary.MergedDictionaries>
20+
</ResourceDictionary>
21+
</Application.Resources>
22+
</Application>

0 commit comments

Comments
 (0)