Xamarin and Aspect Orientated Programming

This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.I have started implementing my very first AOP like library, which is now available for testing in NuGet.org as a pre-release version. This package is a part of my Xamarin.Forms Toolkit, and it is a good time to say thank you for using all of the three packages more than 500 times.When I had published them, I thought the only user will be me. 🙂 In the first release of the package (1.0.0-pre-01), you can decorate your methods with attributes, in order to listen for Entering the method, and Exiting the method. This can be handy for example, when you need to log your method invocations (Firebase analytics, Basic logging) or when you need to measure the elapsed time of the method run. For example, the following code above will result the output below: This can be achieved implementing IMethodDecorator class like this: Try it in your project Let’s jump to https://github.com/banditoth/Forms.RecurrenceToolkit/ to see the code, or https://www.nuget.org/packages/banditoth.Forms.RecurrenceToolkit.AOP/ to download it as a package Future improvements This package can be improved in a lot of aspects, so stay tuned for more details. Or just simply make a pull request with your ideas 🙂

Xamarin.Forms: Reopening application best pratices

This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.If you have experienced that reopening your application from the phone’s app drawer or launcher is fails because it crashes your application, or displays the first set main page again instead of displaying the latest one, keep reading this article. If you have crashes, or malfunctions, you are probably initializing something in the constructor of the App.xaml.cs, or in the overridden method called ‘OnStart’ like this: Imaginary InitalizeOnlyOnceClass’s Initialize method can be called only once, for the second call, it throws an exception. After you have started your program, sent to background, and bringing it back throws the second Initalization’s exception. This is because the App class gets constructed again when reopening application from the drawer. To handle this, you should make a boolean for the application’s initialization progress. If you receive a blank white screen, you are probably forget to set the Main Page Make sure, that the Application.Current.MainPage always gets a value. If you have implemented the Initialization by your self, or an another way, make sure you have handled correctly the else statement also.Even if the application has been initialized once, the Application.Current.MainPage have to be set always when reconstructing the App. Continue with the last page opened in the application If you want to continue always with the last page opened, you need to store the…

Xamarin: How .NET MAUI will change the life of Xamarin.Forms development

This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind..NET 6 and .NET MAUI is on the sill, but how will it affect the development of Xamarin applications? For today, I have brought you a video by James Montemagno, a Xamarin developer working at Microsoft. Follow James on the following platforms: 🌱 https://montemagno.com 🎙 https://mergeconflict.fm, https://blunders.fm, https://nintendodispatch.com 🦜 https://twitter.com/jamesmontemagno 🎥 https://youtube.com/jamesmontemagno

Xamarin.Forms : Using styles on custom UserControls

This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.To use styles for your custom usercontrol, you have to define the styles TargetType property with an x:Type in your resource dictionary. Declare the clr-namespace where your custom usercontrol lives. Set the target type with x:Type. And boom, done!

[Xamarin.Forms] Custom font handling made easy by MS

This content has 4 years. Some of the information in this post may be out of date or no longer work. Please, read this page keeping its age in your mind.No more sorrow with custom font defining in Xamarin.Forms. Later we had to define a ResourceDictionary for storing platform specific filenames for our ttf files, import for each platform specific project the ttf file, and set a specific build action for them. Now we only need to import the TTF file to our Xamarin.Forms project, and set the build action to BundleResource, and add a new line to assembly.cs: See reference at: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/fonts Appreciate it!