monomac

Happy Halloween with #MonoMac

As a part of this year’s Halloween celebration, I was asked by my lovely family to whip together something interesting to show on the TV – a whole lot of nothing followed by a scary image and a accompanying scary sound, maintaining the mood during the party.

Our TV is connected to a Mac Mini, acting as our media center, so what better thing than writing some MonoMac code to usher the holiday along!

I started out by creating a new Mac (open source) – MonoMac Project in Xamarin Studio, then configuring the main window to have a black background and to cover the entire screen:

Then, I had my wife gather a bunch of scary images and sounds, which I put in the Resources folder of my solution. Having an idea, graphics and sounds, it was now time to add a BackgroundWorker to the MainWindowController, showing a random image and playing a random sound at a random interval. Lots of randoms!

So, how do we actually show an image and play a sound, you ask? It’s easy as pumpkin pie!

We have 20ish images in the scary app, so I defined a constant (100 (percent)) that indicated that we should hide the currently showing image and stop the currently playing sound. The soundPlayer is an instance of NSSound, supporting all sorts of audio file formats, including .aiff, .wav and .mp3.

The last bit – the actual image display, is simply an Image Well (NSImageView) for which I created an outlet in XCode. I set its contents like so:

That’s it! With Xamarin, coding for the Mac is a breeze! Check out the full source code at Github and adjust it to your needs. Happy Halloween!

The Mac is now a first-class .NET platform! #mono #monomac

Yesterday, Xamarin published a new one-hour seminar, outlining the why and how of their fairly recent Xamarin.Mac product.

Xamarin.Mac enables .NET developers to re-use much of their existing skill-set to produce Mac App Store-ready applications in C#, thus complementing their previous offerings in the iOS and Android space.

The goal of the the new product, is to give C# developers all of the functionality in Apple’s Objective-C libraries plus access to the complete .NET framework, resulting in an impressive API surface!

What’s in the box?

Image

If you have previous experience with MonoTouch, you will find that a lot of the classes above are those you have previously worked with, which enables an impressive amount of code-reuse!

How does it work?

Similar in spirit to what Microsoft has done with Windows RT, Xamarin we have created language bindings for (or “projected”, in a sense) the Apple Objective-C APIs to C#. As such, they have built a system where they can continually translate iOS APIs to .NET, enabling access to both Apple-provided APIs as well as third-party libraries.

Xamarin.Mac builds independent applications that have no dependencies on Mono being installed on the target platform. Just like their previous offerings, they intelligently strip out unnecessary code, creating a minimal package that only contains the classes are used. This is a big deal and a practice that is brought in from their iOS and Android platforms.

More information

Learning things the hard way: ZIP your contributions, and the value of feedback

Last month, we were proud to announce AxCrypt for Mac, enabling the world for the first time to open – and create – .axx files on their Macs. However, it seems like some (all?) of you who have tried to actually use the program, have run into issues! Luckily for us, one user gave it more than a glance, and sent us feedback of his experiences, opening our eyes to the fact that something was wrong.

When our user, David, tried to run the app on his Mac, he got an error, saying “You can’t open the application “AxCrypt” because the Classic environment is no longer supported.”

As it turned out, the Mac stores information outside an .app-file itself, so by publishing the .app-file to a website (enabling others to download it), we actually stripped it of some of its information, effectively rendering it useless. With feedback, and the power of internet, however, we were able to rectify this by wrapping the .app-file into a ZIP container and re-publish it.

Thank you, David, for your feedback, and thank you, Rob Keniger at stackoverflow for identifying what was actually wrong.

The link in the article has now been updated.

Introducing AxCrypt for Mac!

AxCrypt is a leading open source file encryption software for Windows, having more than 2.6m registered users worldwide. Using file-level encryption, AxCrypt is an ideal choice for attaching encrypted documents to your e-mails or for storing files onto your USB drives, for example.

As the Mac OSX is gaining in popularity, it’s getting increasingly more likely that AxCrypt’s users would like to be able to access their encrypted files from the MacBook or iMac too, which is what today’s good news is all about!

Using Mono & MonoMac, we have – in cooperation with Axantum – built an AxCrypt application that runs on your Mac! Being built from the same source as the upcoming 2.x version for Windows, it’s 100% compatible with your existing files, which means that you can start using it today.

The application was developed and tested on Mac OS X Mountain Lion and requires the Mono Runtime to execute. We are looking into bundling the necessary runtime into the app, but unfortunately, at the moment, the current toolset is giving us headaches.

As its older sibling, AxCrypt for Mac is open source.

Download app [Updated May 21st, 2013 to v2.0.2.0 - (read more about the latest version)]

 Scroll to top