Skip to content

Commit 8306489

Browse files
authored
Merge pull request #30 from MADE-Apps/reshuffle
PR for #29 - Implement common page/navigation model
2 parents 3622d83 + 98dcaa1 commit 8306489

386 files changed

Lines changed: 15703 additions & 25574 deletions

File tree

Some content is hidden

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

Bug_report.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**Describe the bug**
2+
A clear and concise description of what the bug is.
3+
4+
**To reproduce in an app**
5+
Steps to reproduce the behavior:
6+
1. Add API '...'
7+
2. Run app.
8+
2. Click on '....'
9+
3. Scroll down to '....'
10+
4. See error
11+
12+
**Expected behavior**
13+
A clear and concise description of what you expected to happen.
14+
15+
**Screenshots**
16+
If applicable, add screenshots to help explain your problem.
17+
18+
** App (please complete the following information):**
19+
- Platform: [e.g. Windows, Android, iOS]
20+
- Device: [e.g. Surface Pro 4, Samsung S7]
21+
- Platform version: [e.g. Fall Creators Update, Android 24, iOS 8.1]
22+
- MADE version: [e.g. 1.0.0.0]
23+
24+
**Additional context**
25+
Add any other context about the problem here.

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ Project maintainers who do not follow or enforce the Code of Conduct in good fai
4343
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
4444

4545
[homepage]: http://contributor-covenant.org
46-
[version]: http://contributor-covenant.org/version/1/4/
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<img src="ProjectBanner.png" alt="MADE App Components" />
2+
13
# Contributing to MADE App Components
24

35
These guidelines are designed to help you as a contributor to bring your code and skills to the project to make it better.
@@ -28,5 +30,4 @@ Even better, if you know how to fix it, follow up your issue with a pull request
2830

2931
We're including Unit Tests and UI tests for the project. While we will aim to have the best coverage as possible across the entire project, it could always be improved on. If you find an area that is missing tests or could have more tests for, feel free to raise an issue or help out by writing some tests!
3032

31-
As well as testing, we aim to document the entire project in terms of both developer guidelines such as these and our own API documentation. If you find something that is wrong or is missing, again, feel free to raise an issue or contribute towards the documentation.
32-
33+
As well as testing, we aim to document the entire project in terms of both developer guidelines such as these and our own API documentation. If you find something that is wrong or is missing, again, feel free to raise an issue or contribute towards the documentation.

Feature_request.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**Is your feature request related to a problem? Please describe.**
2+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
3+
4+
**Describe the solution you'd like**
5+
A clear and concise description of what you want to happen.
6+
7+
**Describe alternatives you've considered**
8+
A clear and concise description of any alternative solutions or features you've considered.
9+
10+
**Additional context**
11+
Add any other context or screenshots about the feature request here.

MADE App Components - Light.sln

Lines changed: 0 additions & 1092 deletions
This file was deleted.

MADE App Components.sln

Lines changed: 0 additions & 1588 deletions
This file was deleted.

MADE.App.Mvvm/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
###############
2+
# folder #
3+
###############
4+
/**/DROP/
5+
/**/TEMP/
6+
/**/packages/
7+
/**/bin/
8+
/**/obj/
9+
_site

MADE.App.Mvvm/Bindable.cs

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright file="Bindable.cs" company="MADE Apps">
3+
// Copyright (c) MADE Apps.
4+
// </copyright>
5+
// <summary>
6+
// Defines an abstract class for creating bindable objects.
7+
// </summary>
8+
// --------------------------------------------------------------------------------------------------------------------
9+
10+
namespace MADE.App.Mvvm
11+
{
12+
using System;
13+
using System.Collections.Generic;
14+
using System.ComponentModel;
15+
using System.Linq.Expressions;
16+
using System.Reflection;
17+
using System.Runtime.CompilerServices;
18+
19+
/// <summary>
20+
/// Defines an abstract class for creating bindable objects.
21+
/// </summary>
22+
public abstract class Bindable : INotifyPropertyChanged
23+
{
24+
/// <summary>
25+
/// Occurs when a property value changes.
26+
/// </summary>
27+
public event PropertyChangedEventHandler PropertyChanged;
28+
29+
/// <summary>
30+
/// Raises the property changed event for the given property value.
31+
/// </summary>
32+
/// <param name="propertyExpression">
33+
/// The expression containing the property to raise as changed.
34+
/// </param>
35+
/// <typeparam name="T">
36+
/// The type of property.
37+
/// </typeparam>
38+
public virtual void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
39+
{
40+
PropertyChangedEventHandler handler = this.PropertyChanged;
41+
42+
if (handler == null)
43+
{
44+
return;
45+
}
46+
47+
string propertyName = GetPropertyName(propertyExpression);
48+
49+
if (!string.IsNullOrEmpty(propertyName))
50+
{
51+
this.RaisePropertyChanged(propertyName);
52+
}
53+
}
54+
55+
/// <summary>
56+
/// Sets the value of the given property value and raises the property changed event if the value is different to the previously set value.
57+
/// </summary>
58+
/// <param name="propertyExpression">
59+
/// The expression containing the property to raise as changed.
60+
/// </param>
61+
/// <param name="field">
62+
/// The reference field for the property.
63+
/// </param>
64+
/// <param name="value">
65+
/// The value to update the property with.
66+
/// </param>
67+
/// <typeparam name="T">
68+
/// The type of property.
69+
/// </typeparam>
70+
/// <returns>
71+
/// Returns true if the property was updated; otherwise, false.
72+
/// </returns>
73+
protected bool Set<T>(Expression<Func<T>> propertyExpression, ref T field, T value)
74+
{
75+
if (EqualityComparer<T>.Default.Equals(field, value))
76+
{
77+
return false;
78+
}
79+
80+
field = value;
81+
this.RaisePropertyChanged(propertyExpression);
82+
return true;
83+
}
84+
85+
/// <summary>
86+
/// Raises the property changed event for the given property name.
87+
/// </summary>
88+
/// <param name="propertyName">
89+
/// The name of the property to raise as changed.
90+
/// </param>
91+
protected virtual void RaisePropertyChanged([CallerMemberName] string propertyName = null)
92+
{
93+
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
94+
}
95+
96+
private static string GetPropertyName<T>(Expression<Func<T>> propertyExpression)
97+
{
98+
if (object.Equals(propertyExpression, null))
99+
{
100+
throw new ArgumentNullException(nameof(propertyExpression));
101+
}
102+
103+
if (!(propertyExpression.Body is MemberExpression body))
104+
{
105+
throw new ArgumentException("Invalid argument", nameof(propertyExpression));
106+
}
107+
108+
if (!(body.Member is PropertyInfo property))
109+
{
110+
throw new ArgumentException("Argument is not a property", nameof(propertyExpression));
111+
}
112+
113+
return property.Name;
114+
}
115+
}
116+
}

MADE.App.Mvvm/MADE.App.Mvvm.csproj

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
8+
<DocumentationFile>bin\Debug\netstandard2.0\MADE.App.Mvvm.xml</DocumentationFile>
9+
</PropertyGroup>
10+
11+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
12+
<DocumentationFile>bin\Release\netstandard2.0\MADE.App.Mvvm.xml</DocumentationFile>
13+
</PropertyGroup>
14+
15+
<ItemGroup>
16+
<Compile Remove="api\**" />
17+
<Compile Remove="articles\**" />
18+
<Compile Remove="_site\**" />
19+
<EmbeddedResource Remove="api\**" />
20+
<EmbeddedResource Remove="articles\**" />
21+
<EmbeddedResource Remove="_site\**" />
22+
<None Remove="api\**" />
23+
<None Remove="articles\**" />
24+
<None Remove="_site\**" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<None Remove=".gitignore" />
29+
<None Remove="docfx.json" />
30+
<None Remove="index.md" />
31+
<None Remove="log.txt" />
32+
<None Remove="toc.yml" />
33+
</ItemGroup>
34+
35+
<ItemGroup>
36+
<PackageReference Include="docfx.console" Version="2.36.0" PrivateAssets="All" />
37+
</ItemGroup>
38+
39+
</Project>

MADE.App.Mvvm/RelayCommand.cs

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// --------------------------------------------------------------------------------------------------------------------
2+
// <copyright file="RelayCommand.cs" company="MADE Apps">
3+
// Copyright (c) MADE Apps.
4+
// </copyright>
5+
// <summary>
6+
// Defines an implementation of the ICommand for running an action on execution.
7+
// </summary>
8+
// --------------------------------------------------------------------------------------------------------------------
9+
10+
namespace MADE.App.Mvvm
11+
{
12+
using System;
13+
using System.Windows.Input;
14+
15+
/// <summary>
16+
/// Defines an implementation of the <see cref="ICommand"/> for running an action on execution.
17+
/// </summary>
18+
public class RelayCommand : ICommand
19+
{
20+
private readonly Action executeAction;
21+
22+
private readonly Func<bool> canExecute;
23+
24+
/// <summary>
25+
/// Initializes a new instance of the <see cref="RelayCommand"/> class with an action.
26+
/// </summary>
27+
/// <param name="executeAction">
28+
/// The action to execute when the command is fired.
29+
/// </param>
30+
public RelayCommand(Action executeAction)
31+
: this(executeAction, null)
32+
{
33+
}
34+
35+
/// <summary>
36+
/// Initializes a new instance of the <see cref="RelayCommand"/> class with an action and a function to check whether the action can execute.
37+
/// </summary>
38+
/// <param name="executeAction">
39+
/// The action to execute when the command is fired.
40+
/// </param>
41+
/// <param name="canExecute">
42+
/// The function to check whether the action can be executed.
43+
/// </param>
44+
public RelayCommand(Action executeAction, Func<bool> canExecute)
45+
{
46+
this.executeAction = executeAction ?? throw new ArgumentNullException(nameof(executeAction));
47+
this.canExecute = canExecute ?? (() => true);
48+
}
49+
50+
/// <summary>
51+
/// Occurs when changes occur that affect whether or not the command should execute.
52+
/// </summary>
53+
public event EventHandler CanExecuteChanged;
54+
55+
/// <summary>
56+
/// Defines the method that determines whether the command can execute in its current state.
57+
/// </summary>
58+
/// <returns>
59+
/// Returns true if this command can be executed; otherwise, false.
60+
/// </returns>
61+
public bool CanExecute()
62+
{
63+
return this.CanExecute(null);
64+
}
65+
66+
/// <summary>
67+
/// Defines the method that determines whether the command can execute in its current state.
68+
/// </summary>
69+
/// <param name="parameter">
70+
/// Data used by the command.
71+
/// If the command does not require data to be passed, this object can be set to null.
72+
/// </param>
73+
/// <returns>
74+
/// Returns true if this command can be executed; otherwise, false.
75+
/// </returns>
76+
public bool CanExecute(object parameter)
77+
{
78+
return this.canExecute();
79+
}
80+
81+
/// <summary>
82+
/// Defines the method to be called when the command is invoked.
83+
/// </summary>
84+
public void Execute()
85+
{
86+
this.Execute(null);
87+
}
88+
89+
/// <summary>
90+
/// Defines the method to be called when the command is invoked.
91+
/// </summary>
92+
/// <param name="parameter">
93+
/// Data used by the command.
94+
/// If the command does not require data to be passed, this object can be set to null.
95+
/// </param>
96+
public void Execute(object parameter)
97+
{
98+
if (!this.CanExecute(parameter))
99+
{
100+
return;
101+
}
102+
103+
this.executeAction();
104+
}
105+
}
106+
}

0 commit comments

Comments
 (0)