Port for Universal Apps?

Aug 16, 2014 at 11:25 PM
Hi There,

First, thanks for creating this library- I was planning to have a go at something similar myself, though I'm a very inexperienced developer and it would have taken me ages.

I'd like to try to use this library in a new Universal App for Windows and Windows Phone 8.1. I find I can't reference the library directly because it targets the full .net 4.5 framework, as opposed to the ".net core" used in universal apps.

I tried to simply "drag and drop" the source code from the mios project over to a new project targeting a Portable Class Library for Universal apps and unsurprisingly it fails... but perhaps not by much.

I looks like it's having a problem with the AsReadOnly() extension method (Readonly collections) in MIosControlles.cs - I'm missing a reference? A quick look on msdn here suggests that it is supported on all the platforms. So I'm wondering if it might be possible. Does anyone have any thoughts?

Many Thanks

Tim
Developer
Aug 18, 2014 at 3:56 PM

I’m not sure. I’d have to look again. Maybe we can work together to make this work.
Currently I don’t see any instances anywhere for AsReadOnly in my project files. Might be in the Mios core library.

Aug 20, 2014 at 12:16 PM
Hi Electricessence,

Thanks for the reply- I'd be very keen to work with you on this. Like I said, I've not really done any "real programming" in anger before (though I'm pretty well versed in the concepts and frameworks and very keen to learn!).

The issue, as you suggested, was in the Mios Core Library:
        public ReadOnlyCollection<MiosControllerInfo> Controllers
        {
            get { return this._miosControllers.AsReadOnly(); }
        }
It seems the AsReadonly() Extension method is not currently available for Universal Apps. By changing it to the following, I managed to get it to build as a Universal App PCL, which I could then reference in a Universal App:
        public ReadOnlyCollection<MiosControllerInfo> Controllers
        {
            get {
                return new ReadOnlyCollection<MiosControllerInfo>(this._miosControllers);
                }
        }
I have no idea if this is the right thing to do, but seemed to make it work ;) I now need to actually test the functionality in a Universal App...

If we were to work together on a universal version of Vera.net, how would we do it? (Excuse my ignorance...) Should we host it as a fork?

I'll let you know how I get on with the testing.
Developer
Aug 20, 2014 at 2:46 PM
Well for starters we should probably move to github :P

But why even try, when there are awesome apps like Grasshopper?

Aug 23, 2014 at 9:46 AM
Totally agree, Grasshopper is a great app- I use it all the time at the moment.

My personal reasons for building a universal App for Vera are really as a bit of a hobby project, to get myself into programing a bit more, I'd like to do a couple of things:
  1. Introduce a different UI concept to the one offered by Grasshopper
  2. Take advantage of some of the new platform features e.g. Cortana in phones
  3. Get ready for when they finally enable universal apps for Xbox One (could be a big opportunity for home automation I think)
I'm pretty sure that Amgine will get it done before me given my newness and hobbyist status (so it may not go anywhere), but I think it's still a good idea to have an open source library for creating universal apps that interface with Vera - good for Vera and good for the community. I'd like to build on the great work already started here.