Skip to content

Commit

Permalink
merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
GiuseppeNovielli committed Feb 25, 2023
1 parent b3ee4c9 commit 061b759
Show file tree
Hide file tree
Showing 22 changed files with 598 additions and 266 deletions.
3 changes: 3 additions & 0 deletions MVVMCrud/maui_net7/MVVMCrud.Example/FodyWeavers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
74 changes: 74 additions & 0 deletions MVVMCrud/maui_net7/MVVMCrud.Example/FodyWeavers.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="TriggerDependentProperties" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the Dependent properties feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EnableIsChangedProperty" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the IsChanged property feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressWarnings" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings from this weaver.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="SuppressOnPropertyNameChangedWarning" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to turn off build warnings about mismatched On_PropertyName_Changed methods.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
41 changes: 13 additions & 28 deletions MVVMCrud/maui_net7/MVVMCrud.Example/MVVMCrud.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-maccatalyst|AnyCPU'">
<CreatePackage>false</CreatePackage>
<CodesignKey>Mac Developer</CodesignKey>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
<EnableCodeSigning>False</EnableCodeSigning>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
Expand All @@ -50,35 +59,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="CommunityToolkit.Maui" Version="3.1.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MVVMCrud\MVVMCrud.csproj" />
</ItemGroup>
<ItemGroup>
<MauiXaml Update="Views\Post\PostCell.xaml">
<SubType></SubType>
</MauiXaml>
<MauiXaml Update="Views\Post\PostPage.xaml">
<SubType></SubType>
</MauiXaml>
<MauiXaml Update="Views\Comment\CommentPage.xaml">
<SubType></SubType>
</MauiXaml>
<MauiXaml Update="Views\Comment\CommentCell.xaml">
<SubType></SubType>
</MauiXaml>
<MauiXaml Update="Views\PostNewEdit\PostNewEditPage.xaml">
<SubType></SubType>
</MauiXaml>
<MauiXaml Update="Views\PostListView\PostListViewPage.xaml">
<SubType></SubType>
</MauiXaml>
<MauiXaml Update="Views\Main\MainPage.xaml">
<SubType></SubType>
</MauiXaml>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="AppResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand All @@ -91,6 +73,9 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Remove="CommunityToolkit.Maui" />
<None Remove="MvvmCrud.Maui.Prism" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MVVMCrud\MVVMCrud.csproj" />
</ItemGroup>
</Project>
25 changes: 25 additions & 0 deletions MVVMCrud/maui_net7/MVVMCrud.Example/MVVMCrud.Example.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1704.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVVMCrud.Example", "MVVMCrud.Example.csproj", "{2D668148-6AD6-4E7C-8A42-7CCB7F6EC563}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2D668148-6AD6-4E7C-8A42-7CCB7F6EC563}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2D668148-6AD6-4E7C-8A42-7CCB7F6EC563}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2D668148-6AD6-4E7C-8A42-7CCB7F6EC563}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2D668148-6AD6-4E7C-8A42-7CCB7F6EC563}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5A6FE169-79E6-4F86-BCA9-94A419A2B400}
EndGlobalSection
EndGlobal
4 changes: 1 addition & 3 deletions MVVMCrud/maui_net7/MVVMCrud.Example/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CommunityToolkit.Maui;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.Controls.Hosting;
using MVVMCrud.Example.Utils.MVVMCrud;
using Prism.Navigation;
Expand All @@ -22,7 +21,6 @@ public static MauiApp CreateMauiApp()
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseMauiCommunityToolkit()
.UsePrism(prism =>
prism.RegisterTypes(containerRegistry =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Net.Http;
using System.Net.Http.Headers;
using System.Net.Security;
using System.Resources;
using System.Security.Cryptography.X509Certificates;
using MVVMCrud.Models.ItemRoot;
using MVVMCrud.Utils;
Expand All @@ -15,11 +16,12 @@ public class CustomMVVMCrud : MVVMCrudApplication
{
public CustomMVVMCrud()
{
AppResourceManager = AppResources.ResourceManager;
}

public override BaseRequestSetupResponse SetupBaseRequestSetupResponse() => new CustomBaseRequestSetupResponse();

public override ResourceManager SetupAppResourceManager() => AppResources.ResourceManager;

public override HttpClient SetupHttpClient()
{
HttpClientHandler handler = new HttpClientHandler
Expand All @@ -34,12 +36,13 @@ public override HttpClient SetupHttpClient()
return client;
}

private bool CheckSSLConnection(HttpRequestMessage arg1, X509Certificate2 arg2, X509Chain arg3, SslPolicyErrors arg4)
{
return true;
}
private bool CheckSSLConnection(HttpRequestMessage arg1, X509Certificate2 arg2, X509Chain arg3, SslPolicyErrors arg4)
{
return true;
}


public override void SetupRootItemBase(RootItemBase rootItemBase)
public override void SetupRootItemBase(RootItemBase rootItemBase)
{
var httpCode = rootItemBase.HttpResponseCode;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ public PostPageViewModel(
{
}

public override string SetupEndpoint()
{
return Constants.Constants.METHOD_POST;
}
public override string SetupEndpoint() => Constants.Constants.METHOD_POST;

public override async void AddNewItem(PostItem item)
{
Expand Down
49 changes: 40 additions & 9 deletions MVVMCrud/maui_net7/MVVMCrud/Controls/MVVMCrudCollectionView.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Threading.Tasks;
using System.Windows.Input;
using CommunityToolkit.Mvvm.Messaging;
using DryIoc;
using MVVMCrud.ViewModels.Base;


Expand All @@ -20,22 +22,51 @@ public MVVMCrudCollectionView()
SetBinding(FooterProperty, new Binding() { Path = "LoadingMoreView" });
SetBinding(ItemsSourceProperty, new Binding() { Path = "ItemsSource" });

var message = string.Format("ListView_OnScrool {0}", uuid);
MessagingCenter.Subscribe<object, ScroolToItem>(this, message, async (sender, args) =>
//var message = string.Format("ListView_OnScrool {0}", uuid);
//MessagingCenter.Subscribe<object, ScroolToItem>(this, message, async (sender, args) =>
//{
// if (args != null)
// {
// ScrollTo(args.Item, -1, ScrollToPosition.Center);
// await Task.Delay(300);

// if (args.IsAnimate)
// {
// var message2 = string.Format("ListView_ScroolToItemAnimate {0}", uuid);
// MessagingCenter.Send(this as object, message2, args);
// }

// }

//});

// Register a message in some module
WeakReferenceMessenger.Default.Register<ListViewScroolToMessage>(this, async (r, m) =>
{
if (args != null)
if (
m?.Value != null
&&
m?.Uuid == uuid
)
{
ScrollTo(args.Item, -1, ScrollToPosition.Center);
await Task.Delay(300);
var scroolTo = m.Value;
var item = scroolTo.Item;
if (args.IsAnimate)
ScrollTo(item, -1, ScrollToPosition.Center);
if (scroolTo.IsAnimate)
{
var message2 = string.Format("ListView_ScroolToItemAnimate {0}", uuid);
MessagingCenter.Send(this as object, message2, args);
await Task.Delay(500);
//var message3 = string.Format("ListView_ScroolToItemAnimate {0}", uuid);
//MessagingCenter.Send(this as object, message3, args);
// Send a message from some other module
WeakReferenceMessenger.Default.Send(new ListViewScroolToItemAnimateMessage(uuid, item));
}
}
});
}

Expand Down
Loading

0 comments on commit 061b759

Please sign in to comment.