I have two simple questions since I'm very new to Windows Phone programming:
1:
How do I cange the root frame, or show a different Page on startup, in a Windows Phone 8.1 Silverlight application? I have a LoginPage and then I want to check if the user is logged in show MainPage as root frame and if the user is not logged in show the LoginPage.
2:
Windows Phone Silverlight applications seems so different to me compared to the Windows Phone WinRT applications, or maybe I'm just not experienced enough. For example I can't put a placeholder/hint text in a textBox in Silverlight but it's super easy in WinRT, why is it like that? Isn't that something very basic that many IDE's implements? Or have I missed something mayor when I'm developing a Silverlight application for Windows Phone?
I know that Windows Phone WinRT is used to create universal apps and Silverlight is used to create only mobile apps for Windows Phone, but why is developing a mobile app in Silverlight so much different (at least to me) compared to build a Windows Phone app i WinRT?
For your first question, use the UriMapper.
The basic principle is that you check if the user is logged in or not and based on that, navigate to the correct view.
The code is not all that complicated, there is a very good tutorial up on Shawn Kendrot his blog here...
For question 2, how to add some sort of hint/watermark can be done in several different ways.
But a very simple version is presented on MSDN here... it uses events to set and clear the watermark.
Point 1
You have to go to Package.appxmanifest and under the tab called Application the second field contains the startup page name. Currently it should be MainPage.xaml, just change it to LoginPage.xaml.
Point 2
I don't quite understand your question. Silverlight and Windows Runtime are two different platforms, they have in fact many different libraries. The goal of Windows Runtime is to run the same application on several different devices, so different hardware requirements and different resolutions. It was a need to organize the environment differently and of course Microsoft added some minor changes such as the hint text (e.g.).
What is so different to you? I did the porting of an app from SL to WinRT but it's not difficult nor tricky at all.
Related
I have a couple quick questions about Windows Phone applications. How does one know the type of Windows Phone application? For example, is the WP email client XAML or Silverlight?
The reason I am asking is that I have been assigned the task of writing some automated testing scripts for an already developed application (or WP core app) and I'm not sure which automated scripting method to use (CodedUI vs VSTO Test UI). It's my understanding that CodedUI only works for XAML based applications.
Thanks!
From just looking at the app I don't think there is anyway to tell. However, whether it is SilverLight or new Store App (appx) they both support XAML. If you have the source code you can load it in Visual Studio. After the project name you will see:
Windows Phone 8.1 Silverlight
Windows Phone 8.1
The second one is the newer Store App possibly a Universal App.
If you need to know if it is xaml then certianly asking the developer will be the easiest option. I assume they are both XAML no matter what as I am not aware that WinJS is supported for phone.
One other option that could help you get to what you need to know is if you have the executables. Silverlight will be an XAP file extension and the new Store App will be have an APPX file extension.
Good luck & Have fun,
Tom
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.
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.
I'm working on a metro app and am having trouble finding how not to show the application.
We recently deployed tablets to our field reps, and need to add gps tracking. GPS is much easier to deal with in the metro libs (it's like 4 lines of code vs. unmanaged) so we're hoping to be able to push a metro app instead of spending time coding a winforms/wpf desktop app (the tablets are full version windows, so it's an option if we can't hide a metro app. I feel like it should be possible though as the start screen tiles update automatically without opening the main program).
In WPF, it's fairly simple to make a window invisible. I'm creating the metro app in wpf, but it uses different libs than desktop and I may just not know how to do it.
In desktop programs, it's fairly simple. You do something along the lines of:
<Page
x:Class = xxxxxxxx
..
Visibility="Hidden">
Unfortunately, with metro, the only options I have are collapsed and visible. Collapsed doesn't seem to have any effect, unless it's just because it's not deployed and visual studio shows it anyway...
So basically I'm trying to figure out if there's a way to start the program minimized or hidden so that it doesn't interrupt the field reps every time it takes their location.
If you really want to make a metro app and want it to run "minimised" you will need to look at background task. To start the background task the user would still need to start the app at least once, futhermore background task have limitation how how often and how long they can run. Also there is a lot of constraint on deploying a windows store app if you cannot publish it in the store.
If your goal is to just have access to GPS through C# apis, the GPS is actually one of the winRT api you can use from the desktop, you can find a tutorial on how to access winRT api from the desktop here
Here is the complete list of winRT api accessible from the desktop (You can find Geoposition class among them).
Have you looked into creating a background task that transmits GPS? The background task can run without the app running.
I am not entirely certain you can voluntarily minimize a Windows Store App on a user's behalf. I see nothing in IntelliSense about it, nor have I found anything online or see any app do it.
However, be aware that deploying the app without using the Windows Store -- sideloading -- requires Windows 8 Enterprise edition computers joined to the domain OR Windows 8 Pro with a sideloading key ($30 per key, purchased in packs of at least 100.) Perhaps a WPF app with unmanaged code is worth the money and effort.
I wonder how to create Zune-like apps (I mean Metro style). But I don't want them to be Windows Store apps (I have already installed Windows 8 platform with VS2012). Could you tell me if I should download some style pack or something like that? Maybe there are some libraries implementing Metro? If yes, plese make me know which one is the best.
Thanks in advance.
There is a Theme for WPF called Cosmopolitan that emulates the Metro style. Now it just gives you the flattened look on the controls for free. You're on your own with Layout, Animations, and Navigation.
Consider WPF UI framweork for building apps like zune
http://mahapps.com/MahApps.Metro/
Due to naming issues (read: MS didn't want to get sued and apparently couldn't properly trademark the word Metro, go figure) there is no such thing as Metro anymore.
That style was renamed to be "Windows Store". So I'm not 100% certain of what it is you are asking for.
Also, contrary to the name and potentially misleading marketing speak on their site, a Windows Store App does not have to be published and sold through the Windows Store.
You might read this for some "clarification":
http://www.zdnet.com/microsoft-finally-comes-cleaner-on-post-metro-naming-plans-7000004151/