Skip to content

Commit

Permalink
NotifyPropertyChangedBase v1.2.0
Browse files Browse the repository at this point in the history
Merge pull request #5 from bramborman/dev
  • Loading branch information
bramborman authored Apr 1, 2017
2 parents c6b76a9 + 84a1646 commit 10dea07
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 30 deletions.
56 changes: 43 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# User-specific files
*.suo
Expand All @@ -15,19 +17,25 @@
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
[Xx]64/
[Xx]86/
[Bb]uild/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
# Visual Studio 2015 and 2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
Expand All @@ -41,10 +49,11 @@ TestResult.xml
[Rr]eleasePS/
dlldata.c

# DNX
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

*_i.c
*_p.c
Expand Down Expand Up @@ -111,6 +120,10 @@ _TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.*crunch*.local.xml
Expand Down Expand Up @@ -160,7 +173,7 @@ PublishScripts/
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets

Expand All @@ -175,6 +188,7 @@ rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
_scale-*.appx
_language-*.appx
Expand All @@ -187,14 +201,13 @@ _language-*.appx

# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs

# Since there are multiple workflows, uncomment next line to ignore bower_components
Expand All @@ -215,6 +228,7 @@ UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
*.ndf

# Business Intelligence projects
*.rdl.data
Expand All @@ -229,13 +243,20 @@ FakesAssemblies/

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/

# Typescript v1 declaration files
typings/

# Visual Studio 6 build log
*.plg

# Visual Studio 6 workspace options file
*.opt

# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand All @@ -244,10 +265,6 @@ FakesAssemblies/
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# LightSwitch generated files
GeneratedArtifacts/
ModelManifest.xml

# Paket dependency manager
.paket/paket.exe
paket-files/
Expand All @@ -264,4 +281,17 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

# Telerik's JustMock configuration file
*.jmconfig

# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
17 changes: 9 additions & 8 deletions AfterBuild.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
$nugetVersion = $env:APPVEYOR_BUILD_VERSION
$buildVersion = $env:APPVEYOR_BUILD_VERSION

if ($env:APPVEYOR_REPO_BRANCH -eq "master")
if (($env:APPVEYOR_REPO_BRANCH -eq "master") -and ($env:APPVEYOR_PULL_REQUEST_TITLE -eq $null) -and ($env:APPVEYOR_PULL_REQUEST_NUMBER -eq $null))
{
$newVersion = $nugetVersion.Split("-") | Select-Object -first 1
$message = "NuGet version changed from '$nugetVersion' to '$newVersion'"
$newVersion = $buildVersion.Split("-") | Select-Object -first 1
$message = "Build version changed from '$buildVersion' to '$newVersion'"

$buildVersion = $newVersion
Update-AppveyorBuild -Version $buildVersion

Add-AppveyorMessage $message
Write-Host $message

$nugetVersion = $newVersion
}

$projectFolders = Get-ChildItem -Directory -Filter "NotifyPropertyChangedBase*"
Expand All @@ -22,11 +23,11 @@ foreach ($projectFolder in $projectFolders)
continue;
}

$zipFileName = "$projectFolder.$nugetVersion.zip"
$zipFileName = "$projectFolder.$buildVersion.zip"
7z a $zipFileName "$releaseFolder\*"

Push-AppveyorArtifact $zipFileName
}

NuGet pack -Version $nugetVersion
NuGet pack -Version $buildVersion
Push-AppveyorArtifact *.nupkg
2 changes: 1 addition & 1 deletion NotifyPropertyChangedBase.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26228.9
VisualStudioVersion = 15.0.26228.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "NotifyPropertyChangedBase", "NotifyPropertyChangedBase\NotifyPropertyChangedBase.shproj", "{036F1706-A135-46EA-A881-C2B334E9936D}"
EndProject
Expand Down
56 changes: 53 additions & 3 deletions NotifyPropertyChangedBase/NotifyPropertyChanged.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,50 @@ protected void RegisterProperty(string name, Type type, object defaultValue, Pro
backingStore.Add(name, new PropertyData(defaultValue, type, propertyChangedCallback));
}

/// <summary>
/// Registers the <paramref name="propertyChangedCallback"/> as a <see cref="PropertyChangedCallbackHandler"/> to a registered property.
/// </summary>
/// <param name="propertyName">Name of the property.</param>
/// <param name="propertyChangedCallback"><see cref="PropertyChangedCallbackHandler"/> to be registered.</param>
/// <exception cref="ArgumentNullException">
/// <para>
/// Parameter <paramref name="propertyName"/> is <c>null</c> or white space.
/// </para>
/// <para>
/// Actual instance does not contain registered property with name specified in the <paramref name="propertyName"/> parameter.
/// </para>
/// <para>
/// Parameter <paramref name="propertyChangedCallback"/> is <c>null</c>.
/// </para>
/// </exception>
protected void RegisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback)
{
Helpers.ValidateNotNull(propertyChangedCallback, nameof(propertyChangedCallback));
GetPropertyData(propertyName, nameof(propertyName)).PropertyChangedCallback += propertyChangedCallback;
}

/// <summary>
/// Unregisters the <paramref name="propertyChangedCallback"/> from a registered property.
/// </summary>
/// <param name="propertyName">Name of the property.</param>
/// <param name="propertyChangedCallback"><see cref="PropertyChangedCallbackHandler"/> to be unregistered.</param>
/// <exception cref="ArgumentNullException">
/// <para>
/// Parameter <paramref name="propertyName"/> is <c>null</c> or white space.
/// </para>
/// <para>
/// Actual instance does not contain registered property with name specified in the <paramref name="propertyName"/> parameter.
/// </para>
/// <para>
/// Parameter <paramref name="propertyChangedCallback"/> is <c>null</c>.
/// </para>
/// </exception>
protected void UnregisterPropertyChangedCallback(string propertyName, PropertyChangedCallbackHandler propertyChangedCallback)
{
Helpers.ValidateNotNull(propertyChangedCallback, nameof(propertyChangedCallback));
GetPropertyData(propertyName, nameof(propertyName)).PropertyChangedCallback -= propertyChangedCallback;
}

/// <summary>
/// Returns the current value of a registered property.
/// </summary>
Expand Down Expand Up @@ -193,7 +237,7 @@ private void SetValue(object value, string propertyName, bool forceSetValue)

if (IsPropertyChangedCallbackInvokingEnabled)
{
propertyData.PropertyChangedCallback?.Invoke(this, new PropertyChangedCallbackArgs(oldValue, value));
propertyData.InvokePropertyChangedCallback(this, new PropertyChangedCallbackArgs(oldValue, value));
}

if (IsPropertyChangedEventInvokingEnabled)
Expand Down Expand Up @@ -254,13 +298,19 @@ private class PropertyData
{
internal object Value { get; set; }
internal Type Type { get; }
internal PropertyChangedCallbackHandler PropertyChangedCallback { get; }

internal event PropertyChangedCallbackHandler PropertyChangedCallback;

internal PropertyData(object defaultValue, Type type, PropertyChangedCallbackHandler propertyChangedCallback)
{
Value = defaultValue;
Type = type;
PropertyChangedCallback = propertyChangedCallback;
PropertyChangedCallback += propertyChangedCallback;
}

internal void InvokePropertyChangedCallback(NotifyPropertyChanged sender, PropertyChangedCallbackArgs e)
{
PropertyChangedCallback?.Invoke(sender, e);
}
}
}
Expand Down
20 changes: 15 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
version: 1.1.0-{branch}{build}
version: 1.2.0-{branch}{build}
pull_requests:
do_not_increment_build_number: true
branches:
only:
- master
- dev
skip_tags: true
skip_commits:
files:
- .gitattributes
- .gitignore
- LICENSE.md
- README.md
image: Visual Studio 2017
configuration: Release
assembly_info:
patch: true
file: SharedAssemblyInfo.cs
assembly_version: 1.1.0.{build}
assembly_file_version: 1.1.0.{build}
assembly_informational_version: 1.1.0.{build}
assembly_version: 1.2.0.{build}
assembly_file_version: 1.2.0.{build}
assembly_informational_version: 1.2.0.{build}
before_build:
- cmd: nuget restore
build:
verbosity: minimal
after_build:
- ps: '& ".\AfterBuild.ps1"'
- ps: '& .\AfterBuild.ps1'
deploy:
- provider: Environment
name: MyGet
- provider: Environment
name: NuGet
on:
branch: master
- provider: Environment
name: GitHub Releases
on:
branch: master

0 comments on commit 10dea07

Please sign in to comment.