MvvmCross Version 4 Custom Binding - xamarin

I have an app that has been running on MvvmCross 3 for about a year. I decided to go for the update and use version 4. I have worked through most of the issues, but I am hung up on the following error:
'MvvmCross.Binding.Bindings.Target.Construction.IMvxTargetBindingFactoryRegistry'
does not contain a definition for 'RegisterCustomBindingFactory' and
no extension method 'RegisterCustomBindingFactory' accepting a first
argument of type
'MvvmCross.Binding.Bindings.Target.Construction.IMvxTargetBindingFactoryRegistry'
could be found (are you missing a using directive or an assembly
reference?)
In my Setup.cs I have this
protected override void FillTargetFactories(
MvvmCross.Binding.Bindings.Target.Construction.IMvxTargetBindingFactoryRegistry registry)
{
base.FillTargetFactories(registry);
registry.RegisterCustomBindingFactory<EditText>("FocusText",
textView => new MvxEditTextFocusBinding(textView));
registry.RegisterCustomBindingFactory<EditText>("FocusChange",
editText => new MvxEditTextFocusChangeBinding(editText));
}
Is there a replacement for RegisterCustomBindingFactory?

PlaceHold3r was correct. I hadn't included
using MvvmCross.Binding.Bindings.Target.Construction;
so the name space was missing.

Related

NEST trying to convert enum to string

Good day:
I have the following code however, I'm getting the following error:
return new ConnectionSettings(pool, (s, v) => s.Converters.Add(new StringEnumConverter())).DefaultIndex(index)
.DefaultMappingFor<Document>(m => m.IndexName(index).TypeName("doc"))
.DefaultMappingFor<FacilityType>(m => m.IndexName(index).TypeName("doc"))
.DefaultMappingFor<Facility>(m => m.IndexName(index).TypeName("doc").RelationName("parent"))
.BasicAuthentication(ConfigurationManager.AppSettings["ElasticUser"], ConfigurationManager.AppSettings["ElasticPassword"]);
Severity Code Description Project File Line Suppression State
Error CS1061 'IElasticsearchSerializer' does not contain a definition for 'Converters' and no extension method 'Converters' accepting a first argument of type 'IElasticsearchSerializer' could be found (are you missing a using directive or an assembly reference?) iserro.API C:\Users\IEUser\source\repos\iserro-api\iserro.API\App_Start\DiContainerConfig.cs 131 Active
I think the error message clearly indicates what the problem is.
It looks like you'd like IElasticsearchSerializer to be a concrete instance that exposes a Converters property, which the JsonNetSerializer type in the Nest.JsonNetSerializer NuGet package exposes so you can hook it up and add custom converters.

FHIR.net Property added to Practitioner

We're currently using FHIR.net library(STU3). The FHIR Server from which we are receiving information has added a practitionerRole property to the Practitioner. Thus when Reading a Practitioner, we get the following Exception:
Encountered unknown member 'practitionerRole' while de-serializing (at path 'line 1, pos 2') in Hl7.Fhir.Rest.HttpToEntryExtensions.parseResource(String bodyText, String contentType, ParserSettings settings, Boolean throwOnFormatException)
The only solution I could think of is to add a practitionerRole property in the Model\Generated\Practitioner.cs class that would go like that:
[FhirElement("practitionerRole", InSummary = true, Order = 115)]
[Cardinality(Min = 0, Max = -1)]
[DataMember]
public List<Hl7.Fhir.Model.PractitionerRole> PractitionerRole
{
get { if (_PractitionerRole == null) _PractitionerRole = new List<Hl7.Fhir.Model.PractitionerRole>(); return _PractitionerRole; }
set { _PractitionerRole = value; OnPropertyChanged("PractitionerRole"); }
}
private List<Hl7.Fhir.Model.PractitionerRole> _PractitionerRole;
Is there any other solution than that? If so, which one?
Thank you in advance
It sounds like you're talking to a DSTU2 server. You'll need some sort of a conversion layer between your system and theirs.
As stated by FHIR employees in https://sea-region.github.com/standardhealth/shr_spec/issues/187 , DSTU2 and STU3 are two different versions of FHIR standard. If you check their last commits (https://www.nuget.org/packages?q=Fhir) as in August 2019, you will see they are maintaining both standards. That is probably due to the hospitals using STU3 version and do not want to adapt to the new version of FHIR, which is DSTU2.
The problem arises when you want to reach a class, let's say Patient, that coexists in two versions. Compiler can not decide which "Patient" class you refer to.
Normally, you could specialize using imports or predescription such as :
Hl7.Fhir.Model.Patient p = new Hl7.Fhir.Model.Patient();
BUT, Patient classes in both versions are described as Hl7.Fhir.Model.Patient. Their namespace is "Hl7.Fhir.Model" and their class name is "Patient".
Normally, you could workaround using keyword:
extern alias
BUT, since model classes in FHIR are read only, you can not use both versions in same project.
You need to uninstall unwanted FHIR version and install wanted version. To do these in Visual Studio,
go to Solution Manager> right click on "Manage Nuget Packages" > Search "Fhir" > uninstall unwanted FHIR version > install wanted version
You can also follow the unanswered question below:
C# T4 Template equivalent for "extern alias"

Xamarin MvvmCross: Cannot Resolve v4.FragmentManager

In my Xamarin Android, I want to resolve v4.fragment manager so, I'm resolving it in the following way
var ss = Mvx.Resolve<Android.Support.V4.App.FragmentManager>();
But, I'm getting error:
MvvmCross.Platform.Exceptions.MvxIoCResolveException: Failed to resolve type Android.Support.V4.App.FragmentManager
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.Resolve (System.Type t) [0x0001c] in D:\git\MvvmCross\MvvmCross\Platform\Platform\IoC\MvxSimpleIoCContainer.cs:199
at MvvmCross.Platform.IoC.MvxSimpleIoCContainer.Resolve[T] () [0x00000] in D:\git\MvvmCross\MvvmCross\Platform\Platform\IoC\MvxSimpleIoCContainer.cs:189
at MvvmCross.Platform.Mvx.Resolve[TService] () [0x00005] in D:\git\MvvmCross\MvvmCross\Platform\Platform\Mvx.cs:34
at TJX.Core.IoC.MvxDependencyResolver.ResolveType[T] () [0x00001] in /Users/ali00261/Loyalty-MultiBanner-Mobile/TJX.Core/IoC/MvxDependencyResolver.cs:11
Can anyone advice what am I doing wrong and how to resolve it ?
Thanks.
UPDATE
I want to replace a FrameLayout in my MvxFragment<TViewModel> with a support.v4.fragment.
ZXingScannerFragment is a support.v4.Fragment provided by 'ZXing' to scan barcode.
var scanFragment = new ZXingScannerFragment();
var ss = Mvx.Resolve<Android.Support.V4.App.FragmentManager>();
ss.BeginTransaction()
.Replace(Resource.Id.fragment_scancontainer, scanFragment)
.Commit();
My aim is to replace a view(frame layout) with a support.v4.Fragment
You can use the ChildFragmentManager to support managing Fragments inside of Fragments.
ChildFragmentManager.BeginTransaction()
.Replace(Resource.Id.fragment_scancontainer, scanFragment)
.Commit();
In terms of App.Fragment vs Support.V4.App.Fragment, it looks like you are using the wrong dependencies.
Mvvmcross offer two MvxFragment class type to match those offered in Android:
Native Fragment - which can be found in MvvmCross.Droid.FullFragging nuget package and offers MvvmCross.Droid.FullFragging.Fragments.MvxFragment. This class matches to the native Android Fragment introduced in API 11.
Support Library Fragmet - which can be found in MvvmCross.Droid.Support.V4 nuget package and offers MvvmCross.Droid.Support.V4.MvxFragment. This class matches to the Android Support Library Fragmets.
You need to use the Support Library Fragment version of MvxFragment in order to use Support.V4.App.Fragment with a ChildFragmentManager.

Laravel Gettext Error Class 'App\Http\Controllers\LaravelGettext' not found

I followed these steps for installing Gettext with laravel
https://github.com/Belphemur/laravel-gettext
However, I am getting Class 'App\Http\Controllers\LaravelGettext' not found
error.
If I include the namespace with classes, it says, that the method is not defined as static, which is true after checking the code.
Am I missing something?
Error place (copied from the gettext plugin page)
public function changeLang($locale=null) {
LaravelGettext::setLocale($locale);
return Redirect::to(URL::previous());
}
Make sure to add use Path\to\LaravelGettext; at the top of your file outside the class.
I am not sure what's the path to LaravelGettext. Maybe it is Xinax\LaravelGettext\Facades\LaravelGettext

cygwin warning: COMDAT symbol does not match section name

I am using g++ (5.4.0) on cygwin, to compile and link some cpp files. Compilation goes through fine, but during linking I get many errors like:
lib.a: warning: COMDAT symbol '.pdata$_ZnwmPv' does not match section name '.pdata'
lib.a: warning: COMDAT symbol '.xdata$_ZnwmPv' does not match section name '.xdata'
I am not able to figure out what this message means, nor how to fix the problem. I tried a google search, and got this link: https://sourceware.org/bugzilla/show_bug.cgi?id=15041
It seems to indicate that the problem is fixed and checked in, way back in 2013.
So does my error message mean that this fix is not available in the gcc of cygwin? Or is there something else that I need to do to fix/bypass this problem?
Also, is there any way I can get more details on what exactly is the mismatch? That may indicate what I need to fix in my code.
Some more details : The warning occurs only in cygwin, and not in ubuntu, so I have also added the cygwin tag to this question and also mentioned cygwin in the question. And it happens only when I add the following code to my classes. If the addObject2 method is deleted, and the private member _obj2Array is made public and its code is moved to the application, then the warning goes away.
myObject1.h:
class myObject1: public myParent {
... // constructors, etc
vector<myObject2*> _obj2Array;
public:
void addObject2(myObject2* obj2);
}
myObject1.cpp:
void myObject1::addObject2(myObject2* obj2) {
_obj2Array.push_back(obj2);
}

Resources