diff --git a/.gitignore b/.gitignore index 49e42ad..c67e8f9 100644 --- a/.gitignore +++ b/.gitignore @@ -287,3 +287,4 @@ __pycache__/ *.odx.cs *.xsd.cs /FluentPrismRegionAdapter/phirSOFT.FluentPrismAdapter.Samples +/phirSOFT.FluentPrismAdapter.Samples diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..390cf51 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,5 @@ +assembly-versioning-scheme: MajorMinorPatch +mode: ContinuousDeployment +branches: {} +ignore: + sha: [] diff --git a/appveyor.yml b/appveyor.yml index dbed26c..e63d2bd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,4 @@ -version: 0.0.{build} -branches: - only: - - master -skip_non_tags: true +skip_tags: true image: Visual Studio 2017 configuration: Release skip_commits: @@ -11,14 +7,6 @@ skip_commits: - '**/*.html' - '**/*.md' - appveyor.yml -assembly_info: - patch: true - file: '**\AssemblyInfo.*' - assembly_version: '{version}' - assembly_file_version: '{version}' - assembly_informational_version: '{version}' -before_build: -- cmd: nuget restore build: publish_nuget: true publish_nuget_symbols: true @@ -35,3 +23,17 @@ deploy: secure: I0crkaDLJwNba1txPPCrj0pKaFMbzxKHPIZ7hNYP1Wy6yVJ7s3napz/nEv38L/3/ on: branch: master +install: + - choco install gitversion.portable -pre -y + +assembly_info: + patch: false + +before_build: + - nuget restore + - ps: gitversion /l console /output buildserver /updateAssemblyInfo + +#after_build: +# - cmd: ECHO nuget pack \.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%" +# - cmd: nuget pack \.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%" +# - cmd: appveyor PushArtifact ".%GitVersion_NuGetVersion%.nupkg" diff --git a/phirSOFT.FluentPrismAdapters/ApplicationMenuRegionAdapter.cs b/phirSOFT.FluentPrismAdapters/ApplicationMenuRegionAdapter.cs new file mode 100644 index 0000000..aa93fe5 --- /dev/null +++ b/phirSOFT.FluentPrismAdapters/ApplicationMenuRegionAdapter.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Fluent; +using Prism.Regions; +using phirSOFT.TopologicalComparison; + +namespace phirSOFT.FluentPrismAdapters +{ + /// + /// Provides a region adadpter dor an application menu. + /// + public class ApplicationMenuRegionAdapter : TopologicalSortedRegionAdapterBase + { + public ApplicationMenuRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory) : base(regionBehaviorFactory) + { + } + + protected override IList GetItemCollection(ApplicationMenu container) + { + return container.Items; + } + + public static void DeepMerge(ApplicationMenu target, ApplicationMenu source) + { + var comparer = GetComparer(target); + foreach (var sourceItem in source.Items) + { + if (comparer != null) + target.Items.Insert(sourceItem, comparer); + else + target.Items.Add(sourceItem); + } + } + } +} diff --git a/phirSOFT.FluentPrismAdapters/IUiElementMerger.cs b/phirSOFT.FluentPrismAdapters/IUiElementMerger.cs new file mode 100644 index 0000000..96f8fa3 --- /dev/null +++ b/phirSOFT.FluentPrismAdapters/IUiElementMerger.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace phirSOFT.FluentPrismAdapters +{ + interface IUiElementMerger where T : UIElement + { + void Merge(T target, T other); + + void Split(T target, T other); + } +} diff --git a/phirSOFT.FluentPrismAdapters/RibbonRegionAdapter.cs b/phirSOFT.FluentPrismAdapters/RibbonRegionAdapter.cs index 7127859..6b2f2db 100644 --- a/phirSOFT.FluentPrismAdapters/RibbonRegionAdapter.cs +++ b/phirSOFT.FluentPrismAdapters/RibbonRegionAdapter.cs @@ -1,7 +1,9 @@ using System; using System.Collections; +using System.Collections.Specialized; using System.Windows; using Fluent; +using phirSOFT.TopologicalComparison; using Prism.Regions; namespace phirSOFT.FluentPrismAdapters @@ -27,10 +29,20 @@ protected override IList GetItemCollection(Ribbon container, DependencyObject it return container.QuickAccessItems; case RibbonContextualTabGroup _: return container.ContextualGroups; + case Ribbon ribbon: + DeepMerge(container, ribbon); + break; + case BackstageTabItem _: + return ((container.Menu as Backstage)?.Content as BackstageTabControl)?.Items; case UIElement _: return container.ToolBarItems; } return null; } + + private static void DeepMerge(Ribbon target, Ribbon source) + { + + } } } \ No newline at end of file diff --git a/phirSOFT.FluentPrismAdapters/TopologicalSortedRegionAdapterBase.cs b/phirSOFT.FluentPrismAdapters/TopologicalSortedRegionAdapterBase.cs index f3f6cd4..987d341 100644 --- a/phirSOFT.FluentPrismAdapters/TopologicalSortedRegionAdapterBase.cs +++ b/phirSOFT.FluentPrismAdapters/TopologicalSortedRegionAdapterBase.cs @@ -46,9 +46,9 @@ protected virtual void UpdateRegion(object sender, NotifyCollectionChangedEventA var list = GetItemCollection(regionTarget, item); var comparer = GetComparer(regionTarget); if (comparer != null) - list.Insert(item, comparer); + list?.Insert(item, comparer); else - list.Add(item); + list?.Add(item); } break; @@ -56,7 +56,7 @@ protected virtual void UpdateRegion(object sender, NotifyCollectionChangedEventA foreach (DependencyObject item in args.NewItems) { var list = GetItemCollection(regionTarget, item); - list.Remove(item); + list?.Remove(item); } break; diff --git a/phirSOFT.FluentPrismAdapters/phirSOFT.FluentPrismAdapters.csproj b/phirSOFT.FluentPrismAdapters/phirSOFT.FluentPrismAdapters.csproj index 86a0f46..9051a47 100644 --- a/phirSOFT.FluentPrismAdapters/phirSOFT.FluentPrismAdapters.csproj +++ b/phirSOFT.FluentPrismAdapters/phirSOFT.FluentPrismAdapters.csproj @@ -114,6 +114,7 @@ ..\packages\Prism.Wpf.7.0.0.336-pre\lib\net45\System.Windows.Interactivity.dll + @@ -126,8 +127,10 @@ + + @@ -138,7 +141,7 @@ - + \ No newline at end of file diff --git a/phirSOFT.FluentPrismAdapters/phirSOFT.FluentPrismAdapters.nuspec b/phirSOFT.FluentPrismAdapters/phirSOFT.FluentPrismAdapters.nuspec index f326f80..b90b995 100644 --- a/phirSOFT.FluentPrismAdapters/phirSOFT.FluentPrismAdapters.nuspec +++ b/phirSOFT.FluentPrismAdapters/phirSOFT.FluentPrismAdapters.nuspec @@ -3,9 +3,9 @@ phirSOFT.FluentPrismAdapters $version$ - $title$ - $author$ - $author$ + phirSOFT.FluentPrismAdapters + phirSOFT + phirSOFT https://github.com/phirSOFT/FluentPrismAdapters https://github.com/phirSOFT/FluentPrismAdapters/blob/master/LICENSE false