how to use the accelerometer class in a WPF application in .NET? - c#

For some reason everything I've found online says that the Accelerometer class is only for winRT applications and I can't use it unless I code against winRT. I dont understand what winRT is. And my app can't be a metro style app because I need special access to different APIs that I've read can only be accessed in a WPF app. Also windows 8 metro style apps wont work with windows 7 which I would like my app to work for. Also I've only recently started programming so explain it to me like I'm a 4 year old.
Thanks!

The accelerometer you are referring to is a specific WinRT (Windows RunTime) class which is not available in .NET.
WinRT API was made for phones and tablets, but also integrated in Windows 8 / 8.1. It's basically the API for 'Metro' apps and therefore requires such an app. It will definitely not work for Windows 7, since WinRT is not available for this OS. I'm also somehow wondering, why you would need an accelerometer on Win7 (Notebook?), but that is a different topic.
I've once tried to get WinRT stuff working in C#.NET, and to my knowledge, this is not possible.
If you can provide us any additional information about your idea, maybe we can offer you an acceptable alternative.

Related

Windows phone 8.1 Silverlight app on windows 10 tablet

I have a Windows phone 8.1 Silverlight application.
Now I need to make it run also on windows 10 phones and tablets. I checked and the app is available on windows 10 phones, even if deployed for windows 8.1 but it seems like I can't install it on windows 10 tablets.
My question is pretty simple:
Is there a "fast way" for converting the 8.1 project to UWP?
Can I deploy my app for tablets without re-writing all the code?
Thanks all
This question is oddly similar to one that I answered just yesterday. It's not really a duplicate so I will restate the answer here along with a link to the other question (1)
Unfortunately there is no easy and fully automated way to port your Silverlight app to UWP mostly because the API footprint has changed and updated between the 2 platforms. There are a lot of similarities but also a lot of breaking changes that require some manual changes.
here is Microsoft's guidance for this particular upgrade path.
From the article above:
Note This guide is designed to help you port your Windows Phone Silverlight app to Windows 10 manually. In addition to using the information in this guide to port your app, you can try the developer preview of Mobilize.NET's Silverlight Bridge to help automate the porting process. This tool analyzes your app's source code and converts references to Windows Phone Silverlight controls and APIs to their UWP counterparts. Because this tool is still in developer preview, it does not yet handle all conversion scenarios. However, most developers should be able to save some time and effort by starting with this tool. To try the developer preview, visit Mobilize.NET's website.
[1] Can a Silverlight out-of-browser app be converted to Universal Windows Platform (UWP) app?

Migrate Windows phone 8 silverlight app to Windows 8.1 RT

We already have a working and fully functional app working on store in Windows phone 8 silverlight framework. But keeping in Mind windows 10 will be releasing soon we want to be ready. We want to migrate the app to WinRT framework. What would be the best approach to do that.
I see there are a lot of changes at the framework level but still any suggestion would be appreciated.
Thanks
Vinod
There's a MSDN article that targets the describes problem. The most interesting part is probably the mapping of silverlight namespaces to the corresponding WinRT namespaces (if available).
Here is an article about an app by Rudy Huyn to convert Silverlight application to universal apps. That could also be a great help.

Windows Phone Silverlight/Xaml Which one i choose for developing my application [duplicate]

When I create new Windows Phone project I have an option to create a "Windows Phone" or "Windows Phone Silverlight" app. I know that they have different runtimes and different APIs.
I was under the impression that Microsoft wants to unify Windows and Windows Phone platforms so why is there even a Silverlight version? What benefits does it bring?
Also, if I want to create an app just for Windows Phone and never have plans to bring it to Windows, what should I choose, Silverlight or Windows Phone?
I'd suggest you go with "Windows Phone" (non-Silverlight). It's the new API, which works for both Windows and Windows Phone. At some point you may want to port the app or create a new one for Windows and you'll already know the API (and porting will be way easier). Also, the new API will most likely get more updates and features added, and at some point you may even be forced to update to it (either because the old one is no longer supported, or because it does not have some features that you need).
As it was said in the other answers - the Silverlight option is there only for backward compatibility and is likely to be phased out in time. That is - it's good if you already know the API and have many libraries (yours or others) for WP Silverlight, but if you're just starting - you'd better go for the new technology.
Edit
There is one other thing to consider before choosing between the two types of apps. Some features are only available in a Silverlight app, and others (smaller amount) - only in a Xaml app. Here's an article with some info on the differences: Migrating your Windows Phone 8 app to a Windows Runtime XAML app
Windows RT Xaml is quite new and People have to generate some knowledge first.
Silverlight for phone has been around for years and there's a load of tools available: Phone Toolkit, diverse Controls, etc.
Just killing it off would have hurt many developers who built up intellectual property over a long time forcing them to start over.
When starting a project with Silverlight you will have more things around that help you get stuff done.
When starting with WinRT Xaml, you will have better performance, but will have to figure a lot out by yourself.
So the Silverlight option is there to not throw of Silverlight developers.
I recently started a new project on WinRT Xaml and my experience was that I had to recreate a lot of common tools like Caches, etc. But also a lot of things that were in Toolkits previously are now part of the platform itself. Also, when moving over to Windows 8, you get to share a lot of code which is nice.
Unifying the environment(s) would be ideal. In my opinion, it hasn't been very successful. At one point in time, you could only develop under Silverlight, so what you are seeing is just a newer version of the same thing to keep backwards compatibility as well as to keep Silverlight's developers happy. In the future, it will probably be phased out. Plus if you want to support older Phones, Silverlight is basically your only choice (you'll be surprise, how many WP users haven't updated their 8.0 to 8.1)
There really isn't any other real benefit of Silverlight other than maybe the Windows Phone Toolkit which has been tremendously useful (you can see how many SO's answers rely on this simple addon). Once the universal runtime gets fleshed out to the point where the documentation reflects what's actually available -- then I think it would be the default project for developing in Windows going forward.
If you're just starting, I would use Silverlight the knowledge based is much greater. After you get use to the WP environment then switch to runtime.

Silverlight to WINRT or Silverlight to Universal

I have a Windows Phone 8.1 Silverlight application which is in the store now. Since i see that Microsoft is moving all the attention towards WINRT and Universal Apps, i suspect that there will be limited or no support for Silverlight Apps in Windows 10.
There might be a tablet project that i might roll out for the same project in the future. So i am in the dilemma to convert the Silveright projects in my solution to WINRT or convert them into Universal Apps.Also, i hear that converting to Universal projects are pretty hard as well.And I understand that the bulk of the work will be in porting the UI to Hub Style UI.
Any ideas? Comments on the best approach to take here.
A WinRT app is a Windows only app (not for Phone). Other than that, WinRT and Universal apps are quite similar. They have the same namespaces, classes, controls... almost everything. You can use many WinRT libraries in Universal apps without any problem. And so, porting to them is generally the same, too.
Windows Store and Windows Phone apps generally need different UI anyway, so you would have to work on that, no matter what you do.
One difference is that a WinRT app would work on Windows 8.0 and up, and a Universal app would require Windows 8.1 (or WP 8.1 for phones). Actually, a Windows 8.1 app IS a Universal app. Just like a Windows Phone 8.1 app (not the Silverlight variation) is a Universal app.
I'd recommend porting to a Universal app as you would get used to working with these apps, and they work on both platforms (Windows and Phone). For any future project, that's the way to go.
In the company I work for, we switched to Universal apps a few months ago. Figuring out what UI we would use on both platforms and how to do it properly, as well as porting our existing libraries did take some time (not too much), but now making a new app and supporting both platforms is very easy. So, for me, that's the way to go.
It is quite unlikely that Microsoft will stop supporting Silverlight Apps in the Windows 10 version for phones. Even WP8.1 still supports XNA Games from the WP7.0 era.
Depending on the APIs you are using in your libraries the majority of changes when converting from Silverlight to WinRT will be on the UI side, e.g. if your Silverlight App already uses the LocalStorage-APIs instead of the IsolatedStorage-APIs that won't even have to be changed.
My advice would be the following:
evaluate wether all functionality you need is supported in Universal Apps (some functionality is currently only available in Silverlight Apps)
evaluate wether the actual APIs you are using are supported in Universal Apps or need to be replaced (IsolatedStorage => LocalStorage, etc.)
Armed with that knowledge I'd guess you will be able to better plan on when to port your App to the new APIs. If a tablet version is likely in the future and all required APIs are supported in the Universal App Model porting sooner will likely require less effort than porting later.

Can I easily convert windows store desktop app to universal or phone app?

As we know there is posibility to create three types of windows 8.1 applications: desktop, phone, and universal. So, I have a win 8.1 application which was obviusly built for desktop, but I wanna change its type to phone or universal, how can I do it?
Sounds like you are moving towards cross platform development. I recommend using a java base library like libgdx. My app runs on Windows,Macs,Android phones/tablets, and Iphones/Ipads. Its all one code base but for many different platforms. I've very happy with the results. I'm mainly a c# dev so there was a small learning curve moving to java. I dont know if there is something similar that will run on windows phone. Good luck.

Categories

Resources