Trick: Subscribing to any Control Add-in event through pure C/AL

  • Post comments:3 Comments
  • Reading time:15 mins read

So, it worked. I found just enough spare time to try out the crazy idea I mentioned in the last post. It’s about control add-ins and events. In the last post I gave a tip about exposing the actual control as a property decorated with ApplicationVisible, which allowed you to directly access all properties and methods of the control.

However, if you wanted to do the same with the events, you had no other option but to manually create an event handler for each event type, then to add an event handler for the actual event from the original control, and finally to raise the event on your control add-in from the event handler for the actual control. You lost me already, so did I Smile

This is what I am talking about. Imagine a button, and that you want to allow NAV to respond to its Click event. This is what you need to do:

image

Might not seem too much, but consider that you must do this for every single event that you want to use, that it requires some rewrite-restart-redeploy-redesign-rebind workout to implement support for another event you forgot last time, and then it becomes an problem. Probably the ugliest part of it all is the fact that for C/SIDE to properly insert the new event triggers for an updated class, you have to unbind the Control Add-in, and then to re-bind it. This loses any C/AL code in previously existing triggers. Add to the equation the human error variable, which kind of readily pops up whenever manual code duplication is involved, and you’ll have a lot of happy hours fixing the mess and juggling dlls and C/AL code back and forth.

How about this. How about not having to add anything at all to your C# source code, and not having to redeploy anything, and then to support any event you want just through a single line of C/AL code?

image

Yes. That’s what this blog post is about.

(more…)

Continue ReadingTrick: Subscribing to any Control Add-in event through pure C/AL

Generics in .NET Interop for NAV 2013

  • Post comments:25 Comments
  • Reading time:8 mins read

image.NET Framework is full of programming conceptual gems, that are now at the fingertips of us poor C/AL folks. One of those is generics. However, the C/AL support for generics at the first glance seems rather limited, and the help file says that you can’t specify data types, and that all generics will be instantiated with System.Object as their type. However, with Microsoft Dynamics NAV 2013, there is a very simple way which allows you to use generics with other data types, as well. So, if .NET Framework Interoperability interests you a slightest bit, here’s a solution. The example below will be for the System.Collections.Generic.Dictionary<,>, and I will show how to use instances of the Dictionary<,> object with any desired data type, without having to pull in any external assemblies. (more…)

Continue ReadingGenerics in .NET Interop for NAV 2013

Microsoft Dynamics NAV 2009 R2 ships

  • Post comments:2 Comments
  • Reading time:8 mins read

imageI’m growing increasingly impatient as the progress bar on my File Transfer Manager is approaching 100%. Behind the cryptical download title—Dynamics.NAV60R2.HR.1097366.DVD.zip—hides the much awaited Microsoft Dynamics 2009 R2 HR (Croatian) release of Microsoft Dynamics NAV.

Yes, Microsoft Dynamics NAV 2009 has officially shipped, and you can download your copy at Microsoft Dynamics NAV 2009 R2 download page. You can also access the NAV 2009 R2 Launch Portal.

This is the first time ever, that any NAV product has shipped simultaneously in 43 countries in the world. For many countries, mine included, this is also the first release of NAV 2009.

(more…)

Continue ReadingMicrosoft Dynamics NAV 2009 R2 ships

10 reasons that make design absolutely necessary

  • Post comments:6 Comments
  • Reading time:14 mins read

Unfinished buildings, by net_efekt (on Flickr)Design is one of a kind. Other phases in Sure Step are understood and accepted as good and necessary. But design, do we really do that? Is it really necessary? Who’s going to pay for it? Does the customer really need all those documents? Instead of writing documents, you could have it developed in the same, or less time. And so on and so forth.

As a matter of fact, if you asked me to pick one single most important phase in a Sure Step project, then it’s the design. No second thoughts here, whatsoever.

Here I list the ten most important reasons that I believe make design absolutely indispensable.

(more…)

Continue Reading10 reasons that make design absolutely necessary