Skip to content
Permalink
Browse files

CloneMemberValueModule release #345

  • Loading branch information...
apobekiaris committed Mar 25, 2019
1 parent bc779e4 commit c645f5199234bfa3fce48eebc308c13ef2d87696
Showing with 959 additions and 209 deletions.
  1. +1 −0 .gitignore
  2. +6 −16 Build.ps1
  3. +7 −3 go.ps1
  4. +2 −2 src/Extensions/Extensions/Properties/AssemblyInfo.cs
  5. +10 −0 src/Extensions/Extensions/XAF/GetTypeInfo.cs
  6. +1 −0 src/Extensions/Extensions/Xpand.Source.Extensions.csproj
  7. +69 −0 src/Modules/Agnostic/CloneMemberValue/CloneMemberValueService.cs
  8. +13 −0 src/Modules/Agnostic/CloneMemberValue/ModelLogic.cs
  9. +35 −0 src/Modules/Agnostic/CloneMemberValue/Module.Designer.cs
  10. +28 −0 src/Modules/Agnostic/CloneMemberValue/Module.cs
  11. +120 −0 src/Modules/Agnostic/CloneMemberValue/Module.resx
  12. +35 −0 src/Modules/Agnostic/CloneMemberValue/Properties/AssemblyInfo.cs
  13. +56 −0 src/Modules/Agnostic/CloneMemberValue/Readme.md
  14. +104 −0 src/Modules/Agnostic/CloneMemberValue/Xpand.XAF.Modules.CloneMemberValue.csproj
  15. +8 −0 src/Modules/Agnostic/CloneMemberValue/packages.config
  16. +1 −1 src/Modules/Agnostic/ModelViewInheritance/Readme.md
  17. +12 −0 src/Modules/Agnostic/Reactive/Extensions/CommonExtensions.cs
  18. +0 −1 src/Modules/Agnostic/Reactive/Properties/AssemblyInfo.cs
  19. +15 −0 src/Modules/Agnostic/Reactive/Services/ListEditorExtensions.cs
  20. +12 −11 src/Modules/Agnostic/Reactive/Services/RXApp.cs
  21. +66 −25 src/Modules/Agnostic/Reactive/Services/XafApplicationRXExtensions.cs
  22. +1 −0 src/Modules/Agnostic/Reactive/Xpand.XAF.Modules.Reactive.csproj
  23. +11 −0 src/Modules/Modules.sln
  24. +0 −15 src/Specifications/Artifacts/XafApplicationMock.cs
  25. +0 −1 src/Specifications/Properties/licenses.licx
  26. +2 −2 src/{Specifications/Artifacts/BaseSpecs.cs → Tests/Artifacts/BaseTest.cs}
  27. +1 −1 src/{Specifications → Tests}/Artifacts/Extensions.cs
  28. +1 −1 src/{Specifications → Tests}/Artifacts/ModuleMock.cs
  29. +1 −1 src/{Specifications → Tests}/Artifacts/TestModule.cs
  30. +25 −0 src/Tests/Artifacts/XafApplicationMock.cs
  31. +23 −0 src/Tests/Modules/CloneMemberValue/BOModel/ACmv.cs
  32. +9 −0 src/Tests/Modules/CloneMemberValue/BOModel/BCmv.cs
  33. +130 −0 src/Tests/Modules/CloneMemberValue/CloneMemberValueTests.cs
  34. +1 −1 src/{Specifications → Tests}/Modules/ModelViewInheritance/BOModel/ABaseMvi.cs
  35. +1 −1 src/{Specifications → Tests}/Modules/ModelViewInheritance/BOModel/AMvi.cs
  36. +1 −1 src/{Specifications → Tests}/Modules/ModelViewInheritance/BOModel/FileMvi.cs
  37. +1 −1 src/{Specifications → Tests}/Modules/ModelViewInheritance/BOModel/TagMvi.cs
  38. +2 −3 src/{Specifications → Tests}/Modules/ModelViewInheritance/InheritAndModifyBaseView.cs
  39. +6 −7 ...e/ModelViewInheritanceSpecs.cs → Tests/Modules/ModelViewInheritance/ModelViewInheritanceTests.cs}
  40. +1 −1 ...ViewInheritance/ModelViewInheritanceTestData.cs → Tests/Modules/ModelViewInheritance/TestData.cs}
  41. +2 −6 src/{Specifications → Tests}/Properties/AssemblyInfo.cs
  42. +10 −1 src/{Specifications/Specifications.sln → Tests/Tests.sln}
  43. +14 −7 ...{Specifications/Xpand.XAF.Agnostic.Specifications.csproj → Tests/Xpand.XAF.Agnostic.Tests.csproj}
  44. 0 src/{Specifications → Tests}/app.config
  45. +6 −0 src/{Specifications → Tests}/packages.config
  46. +2 −2 tools/Build/CreateNuspec.ps1
  47. +2 −2 tools/Build/PackNuspec.ps1
  48. +55 −0 tools/Build/Pipeline.ps1
  49. +38 −0 tools/Build/Pipeline.yml
  50. +12 −6 tools/Build/{PushNugets.ps1 → PublishNugets.ps1}
  51. +0 −90 tools/Build/lab-pipeline.yml
@@ -329,3 +329,4 @@ ASALocalRun/
# MFractors (Xamarin productivity tool) working folder
.mfractor/
*.bak
**/licenses.licx
@@ -17,14 +17,14 @@ task default -depends DiscoverMSBuild, Clean, Init, UpdateProjects, RestoreNug

Task IndexSources{
InvokeScript{
Update-XSymbols -symbolsFolder "$PSScriptRoot\bin" -user eXpandFramework -repository XAF -branch $branch -sourcesRoot "$PSScriptRoot" -filter "Xpand*.pdb"
Get-ChildItem "$PSScriptRoot\bin" Xpand.XAF.Modules.*.pdb| Update-XSymbols -SourcesRoot "$PSScriptRoot" -TargetRoot "https://raw.githubusercontent.com/eXpandFramework/DevExpress.XAF/$branch"
}
}

task Init {
InvokeScript{
New-Item "$PSScriptRoot\bin" -ItemType Directory -Force |Out-Null
Install-XDX -dxSource $packageSources -binPath "$PSScriptRoot\bin" -sourcePath "$PSScriptRoot\src" -dxVersion $dxVersion
Install-XDevExpress -dxSource $packageSources -binPath "$PSScriptRoot\bin" -sourcePath "$PSScriptRoot\src" -dxVersion $dxVersion
}
}

@@ -40,7 +40,7 @@ task RestoreNuggets {
Push-Location $_.DirectoryName
if ($packageSources){
$sources= "https://api.nuget.org/v3/index.json;$packageSources"
& nuget restore -source $sources
& (Get-XNugetPath) restore -source $sources
}
else {
& nuget restore
@@ -60,19 +60,9 @@ task Compile -precondition {return $compile } {
& $script:msbuild "$PSScriptRoot\src\Modules\Modules.sln" /p:Configuration=Release /fl /v:m
}
InvokeScript{
write-host "Building Specifications" -f "Blue"
& $script:msbuild "$PSScriptRoot\src\Specifications\Specifications.sln" "/p:Configuration=Release;OutputPath=$PSScriptRoot\bin" /fl /v:m
write-host "Building Tests" -f "Blue"
& $script:msbuild "$PSScriptRoot\src\Tests\Tests.sln" "/p:Configuration=Release;OutputPath=$PSScriptRoot\bin" /fl /v:m
}

# Get-ChildItem *.csproj -Recurse|ForEach-Object{
# [xml]$csProj=Get-Content $_.FullName
# $csProj.Project.ItemGroup.Reference|Where{$_.Include -like "DevExpress*"}|ForEach-Object{
# $_.ChildNodes|Where{$_.Name -eq "HintPath"}|ForEach-Object{
# $_.ParentNode.RemoveChild($_)|out-null
# }
# }
# $csProj.Save($_.FullName)
# }
}

Task PublishNuget -precondition {return $nugetApiKey} {
@@ -98,7 +88,7 @@ Task PackNuspec {
Task DiscoverMSBuild {
InvokeScript {
if (!$msbuild) {
$script:msbuild = (Get-XMsBuildLocation)
$script:msbuild = (Get-XMsBuildPath)
}
else {
$script:msbuild = $msbuild
10 go.ps1
@@ -2,21 +2,25 @@ param(
[string]$packageSources = "C:\Program Files (x86)\DevExpress 18.2\Components\System\Components\packages",
[string]$msbuild = $null,
[string]$nugetApiKey = $null,
[string]$dxVersion = "18.2.5",
[string]$dxVersion = "18.2.7",
[bool]$build = $true,
[bool]$cleanBin = $true,
[string]$branch="master"
[string]$branch="master",
[switch]$InstallModules
)
$ErrorActionPreference = "Stop"
@([PSCustomObject]@{
Name = "psake"
Version ="4.7.4"
},[PSCustomObject]@{
Name = "XpandPosh"
Version ="1.0.16"
Version ="1.5.2"
})|ForEach-Object{
& "$PSScriptRoot\tools\build\Install-Module.ps1" $_
}
if ($InstallModules){
return
}
Invoke-XPsake "$PSScriptRoot\Build.ps1" -properties @{
"cleanBin" = $cleanBin;
"msbuild" = $msbuild;
@@ -9,7 +9,7 @@
"623fef5531f8dd29d74f781a9e50743172dbe8d74b0106ceddfcda17f8dd1034f2896a56e1026f"+
"aa2cc0e2def8dc1f519ad13924c44f16339a57ed97981a8777c7fa6025a11e54cc694e504d462a"+
"400681c0")]
[assembly:InternalsVisibleTo("Xpand.XAF.Agnostic.Specifications,PublicKey="+
[assembly:InternalsVisibleTo("Xpand.XAF.Agnostic.Tests,PublicKey="+
"0024000004800000940000000602000000240000525341310004000001000100df18f4f3de9ec4"+
"90707183c78a72914070a526bfb1818e1687442b137c2bfa9bf5e8533859a8efaa62aa2ea28e03"+
"623fef5531f8dd29d74f781a9e50743172dbe8d74b0106ceddfcda17f8dd1034f2896a56e1026f"+
@@ -45,7 +45,7 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.9.0")]

[assembly: AssemblyVersion("1.0.9.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
//[assembly:AllowPartiallyTrustedCallers]
@@ -0,0 +1,10 @@
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.DC;

namespace Xpand.Source.Extensions.XAF{
internal static class Extensions{
public static ITypeInfo GetTypeInfo(this object obj){
return obj != null ? XafTypesInfo.Instance.FindTypeInfo(obj.GetType()) : null;
}
}
}
@@ -89,6 +89,7 @@
<Compile Include="Linq\Split.cs" />
<Compile Include="Linq\TakeAllByLast.cs" />
<Compile Include="XAF\BaseImpl\CustomBaseObject.cs" />
<Compile Include="XAF\GetTypeInfo.cs" />
<Compile Include="XAF\Model\GetNodeByPath.cs" />
<Compile Include="XAF\Model\GetParent.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.DC;
using DevExpress.ExpressApp.Editors;
using DevExpress.ExpressApp.Model;
using Xpand.XAF.Modules.Reactive.Extensions;
using Xpand.XAF.Modules.Reactive.Services;

namespace Xpand.XAF.Modules.CloneMemberValue{
public static class CloneMemberValueService{

public static IEnumerable<IModelCommonMemberViewItemCloneValue> CloneValueMemberViewItems(this IModelObjectView modelObjectView) {
return (modelObjectView is IModelListView view? view.Columns.Cast<IModelCommonMemberViewItemCloneValue>()
: ((IModelDetailView) modelObjectView).Items.OfType<IModelCommonMemberViewItemCloneValue>())
.Where(state => state.CloneValue);
}

public static IObservable<(IModelObjectView modelObjectView, IMemberInfo MemberInfo, IObjectSpaceLink previousObject, IObjectSpaceLink currentObject)> CloneMembers(
this IObservable<(IModelObjectView modelObjectView,IObjectSpaceLink previous, IObjectSpaceLink current)> source){

return source.SelectMany(_ => _.modelObjectView
.CloneValueMemberViewItems()
.Select(value => (_.modelObjectView, ((IModelMemberViewItem) value).ModelMember.MemberInfo,_.previous,_.current).CloneMemberValue()))
;
}

public static IObservable<(IObjectSpaceLink previous, IObjectSpaceLink current)> NewObjectPairs(this ListEditor listEditor){
return listEditor.WhenNewObjectAdding()
.Select(_ => _.e.AddedObject).Cast<IObjectSpaceLink>()
.CombineWithPrevious().Where(_ => _.previous != null);
}

public static IObservable<(DetailView previous, DetailView current)> DetailViewPairs{ get; } = RxApp.Application
.DetailViewCreated()
.Select(_ => _.e.View).Where(view => view.Model.CloneValueMemberViewItems().Any())
.CombineWithPrevious().Where(_ => _.previous != null&&_.current.ObjectSpace.IsNewObject(_.current.CurrentObject))
.Publish().RefCount()
.Select(_ => _);

public static IObservable<ListView> ListViews{ get; }=RxApp.Application
.ListViewCreated().Where(_ => _.e.ListView.Model.CloneValueMemberViewItems().Any())
.Select(_ => _.e.ListView).Where(view => view.Model.AllowEdit)
.Publish().RefCount();

public static IObservable<(IModelObjectView modelObjectView, IMemberInfo MemberInfo, IObjectSpaceLink previousObject, IObjectSpaceLink currentObject)> CloneMemberValues{get;} = DetailViewPairs
.Select(_ => (_.current.Model.AsObjectView,(IObjectSpaceLink)_.previous.CurrentObject,(IObjectSpaceLink)_.current.CurrentObject))
.Merge(ListViews
.ControlsCreated()
.SelectMany(_ => (_.view.Editor
.NewObjectPairs()
.Select(tuple => (_.view.Model.AsObjectView,tuple.previous,tuple.current)))))
.CloneMembers()
.Publish().RefCount();

private static (IModelObjectView modelObjectView,IMemberInfo MemberInfo, IObjectSpaceLink previousObject, IObjectSpaceLink currentObject)
CloneMemberValue(this (IModelObjectView modelObjectView,IMemberInfo MemberInfo, IObjectSpaceLink previousObject, IObjectSpaceLink currentObject) _){

var value = _.MemberInfo.GetValue(_.previousObject);
if (_.MemberInfo.MemberTypeInfo.IsPersistent){
value = _.currentObject.ObjectSpace.GetObject(value);
}
_.MemberInfo.SetValue(_.currentObject, value);
return (_.modelObjectView,_.MemberInfo, _.previousObject, _.currentObject);
}
}
}
@@ -0,0 +1,13 @@
using System.ComponentModel;
using DevExpress.ExpressApp.Model;

namespace Xpand.XAF.Modules.CloneMemberValue{
public interface IModelMemberCloneValue : IModelNode {
[Category("eXpand")]
bool CloneValue { get; set; }
}
[ModelInterfaceImplementor(typeof(IModelMemberCloneValue), "ModelMember")]
public interface IModelCommonMemberViewItemCloneValue : IModelMemberCloneValue {

}
}

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,28 @@
using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Model;
using Xpand.XAF.Modules.Reactive.Extensions;
using Xpand.XAF.Modules.Reactive.Services;

namespace Xpand.XAF.Modules.CloneMemberValue {
public sealed partial class CloneMemberValueModule : ModuleBase {
public CloneMemberValueModule() {
InitializeComponent();
}

public override void Setup(XafApplication application){
base.Setup(application);
CloneMemberValueService.CloneMemberValues
.Tracer(true)
.TakeUntilDisposingMainWindow()
.Subscribe();
}

public override void ExtendModelInterfaces(ModelInterfaceExtenders extenders){
base.ExtendModelInterfaces(extenders);
extenders.Add<IModelMember,IModelMemberCloneValue>();
extenders.Add<IModelPropertyEditor, IModelCommonMemberViewItemCloneValue>();
extenders.Add<IModelColumn, IModelCommonMemberViewItemCloneValue>();
}
}
}

0 comments on commit c645f51

Please sign in to comment.
You can’t perform that action at this time.