Using Prism IEventAggregator cross platform - prism

We have some library project C# code that needs to signal events to the main WPF application. We would like to reuse the library code (.NET core 3.1 based) on Mac and Linux. If we use IEventAggregator in the library code, could this be reused in a net core linux or mac app?
Thanks

The EventAggregator is in the platfrom-independent part of prism, and you can use it from the net framework, net core, xamarin android or ios, whatever you like. For example, publish an event in the library and subscribe to it in the mac app or publish an event in the linux app and subscribe to it in the library...
Make sure, though, that your events are platform-independent, too, because you have to reference them to publish or subscribe.

Related

Which SDK to use WinUI3 or UWP for a native windows app?

For building a native windows app which can launch multiple web applications in a webview , i have tried a poc using WinUI3 .Main usecase for this is usb peripheral integrations from the webapps loaded in webview and Single Sign On . Reading more on microsoft documentation , i see some features not supported and some slowness compared to UWP. Do i need to go with UWP for a new app or is the recommendation to go with WInUI3 for a new app development .
Supported Feature List Doc - https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/what-is-supported
Can see WebAuthenticationBroker also in not supported list .
Any guidance on what sdk to use . UWP or WinUI3
WinUI3 is the new technology for Windows Desktop. Although it is not perfect now, but it will be improved. Currently, not all the WinRT APIs are able to be used in WinUI3 apps, but you could use win32 APIs to achieve what you want. So I'd suggest you use WinUI if you are familiar with win32 API can you use win32 API to bypass the limitations.
Compared to WinUI3, UWP is more stable. UWP could use all the WinRT APIs. But some features on UWP are not up to date. For example, some features from WebView2 controls are missing on UWP but available on WinUI like print. Another thing is that UWP apps have limitations like system isolation for accessing local files and local network resources.

TokBox OpenTok SDK for Xamarin Forms

I have made proof of concept app for a video chat application in Xamarin Native using the below nuget packages (it works like a charm the source code is done by provider available here https://github.com/DreamTeamMobile/Xamarin.Opentok.Samples/tree/code-improvements)
https://www.nuget.org/packages/Xamarin.OpenTok.Android/
https://www.nuget.org/packages/Xamarin.OpenTok.iOS/
These nuget packages are basically a port of the native iOS/Android SDK's by TokBox for Xamarin, Created by DreamTeamMobile. I want to make use of them to for creating a Xamarin Forms application, I need some guidance how I can make the same functionality available to a Forms Project, considering that the package provider doesn't provides Xamarin Forms implementation. Would custom renderers help here.
In my case using Xamarin Forms (Shared Project), I used native views ref to made Room page and I used the given services to streaming from the Sample code ref, basically was copy and paste the services. Each service and whatever I needed from Android or iOS was included with Conditional compiler ref.
I hope it's useful.

Is it possible to create native Android and iOS library with Xamarin? [duplicate]

Currently, we are developing a .NET Standard class library that will be used by different Xamarin.* platforms.
I was wondering if there is a way to use the shared code in a native Android project (maybe produce an AAR/JAR file).
The reason I need this functionality is because our company provides an AAR to one of our customers (that is used by a native Android project), and we would like to keep a single source base instead of two.
Thanks in advance!
Update:
The name changed to ".NET Embedding" and it is at v0.4 at the time of this update.
https://developer.xamarin.com/releases/dotnetembedding/dotnetembedding_0/dotnetembedding_0.4/
New instructions:
Installing .NET Embedding
Original post:
You can use Mono's Embeddinator-4000
It supports various language consumers, so it surfaces .NET code as idiomatic code in the target language. This is the list of supported languages at present:
Objective-C: mapping .NET to idiomatic Objective-C APIs.
Java: mapping .NET to idiomatic Java APIs.
C: mapping .NET to an object-oriented like C APIs.
Embeddinator-4000 is a tool that allows your existing .NET Code (C#, F# and others) to be consumed from other programming languages and in various different environments.
Java is currently in a preview state for macOS, Windows, and Android.
The platform is selected by passing the --platform= command-line argument to the embeddinator. Currently macOS, Windows, and Android are supported.
re: https://mono.github.io/Embeddinator-4000/
As a part of the requires For Android you will need Xamarin.Android 7.4.99+ and Android Studio 3+ (Java 1.8) but if you are building Android apps with Xamarin and Java you would have those already.
Note: This tool is in Preview, so review the open issues and post new if needed.
re: https://github.com/mono/Embeddinator-4000/issues
Note: This is not trans-compiling, but embedding Mono's runtime in a native package that allow CIL code, AOT'd (i.e. iOS) or not to run within a different language/runtime.

Porting android app to xamarin or windows native questions

So, I have been developing an android app for some time, and I was requested to try porting this app to windows phone too. In order to reduce the hassle in trying to maintain two separate versions of the same app, I decided to try to port this app into xamarin, because I have heard that its performance is better than hybrid apps. These are my questions with regard to xamarin:-
I want to maintain the same look and feel which I had in my original app into my cross platform app, and at the same time, make it distinct in the windows version. What are the things I can do to achieve this effect?
Is it rather better for me to port this app to windows phone native, because of added problems in trying to create a common app?
Are there any restrictions with regard to Windows store when publishing xamarin apps?
Xamarin doesn't really cover Windows UWP apps, only in the notion that they have the UI Framework Xamarin.Forms running on that platform. Meaning, that what you are making is a native Windows UWP app.
What Xamarin is great at is when you start targeting more than one platform and you have structured your code in a way that it can be reused on the supported platforms. This could for instance be done by putting most of your logic and behavior into a Portable Class Library/NETStandard library and consume it in your apps.
A Typical pattern for making platform agnostic logic and behavior for your apps, is the pattern known as Model-View-ViewModel, where the View is platform specific, while the Model and ViewModel usually are platform agnostic. The ViewModel is where the behavior resides and it is what ties the Model together with the View.
Usually the ViewModel wouldn't directly know the View, but there would be a layer in between (glue), such as XAML or a binding engine from MvvmCross, MvvmLight or ReactiveUI to name some MVVM libraries.
What Xamarin provides is the ability to write C# code for Android and iOS, which greatly enables you to share code between those two platforms, but also all the Windows platforms. Hence, UI, is very much dependent on each of the platforms on their own.
You can, of course, use Xamarin.Forms as a UI abstraction layer, which produces a native UI using the native UI controls to get a similar app on all the targeted platforms.
First of all you need to know there are different styles of Xamarin development, who will share more or less content.
If you use Xamarin Forms you have a Main project non-related to any platform (where you create the views and clases), and specific platform projects who adapt the controls to each native style.
If you develop using Xamarin Classic, you have a Shared project where you only develop data-related classes, and specific platform project with their own views and classes with native-friendly controls and native similar functions, but I think, there is no direct Xamarin Clasic Windows Project.
So if you only want to have two apps who look native both, but with same structure and functionalities Xamarin Forms will be the best option for you, cause you only develop "one single app" who becomes native-style like this:
If what you want is to have different apps, with different functionalities and diferent content, then you need to go for Xamarin Classic. What I recomend you to do then is develop the windows phone in native, but put all of the code you can in a shared library. Then you can create a Xamarin classic Android app and use the shared library. You will still need to mantain two different apps, but you will only need to change the "core" code only one time.
If you use Xamarin Forms to do a UWP windows app I don't think you have any problem to publish it, think Xamarin is from Microsoft.

Is it possible to write shared libraries between iPhone, Android, Blackberry, Mac and Windows?

I'm tasked with "porting" a few apps from a Windows environment to various mobile platforms and Mac as well.
I plan on writing MVC patterned apps in which I write as many controllers as I can in some sort of universal library, probably in C or C++. Then writing the views in various choice languages (Objective C, Java, .NET, whatever) for the target OSes.
I've never attempted anything like this before, so my questions are: Is it possible to write and compile one library that can be used on iPhone, Android, Blackberry, Windows and Mac? Is it even wise to try this?
I understand that certain native methods simply won't be available on each platform.
You can create a library whose source code is portable, assuming that you properly abstract away any platform-dependent calls. You can't, however, create such a library, compile it, then use it anywhere; you'll have to compile it for each platform.
Your should take a look at the Mono Project. http://www.mono-project.com
...more specifically at :
MonoTouch: To develop iPhone applications in .NET
MonoDroid (BETA): To develop Android applications in .NET
Mono plugin for MeeGo: To develop MeeGo applications in .NET
And you know that you can develop on Windows Mobile in .NET already.
I've haven't found anything related to BlackBerry yet.
There are services like Rhomobile and Appcelerator which will allow you to do this sort of cross compiling.
I've never used either however.

Resources