
Translating my applications to the 8.1 platform, I found that this is a fairly simple task, which does not require much effort.
After translation, typical warnings often occur as a result of platform inconsistencies. Of course, these warnings should be corrected.
Consider the most popular fixes?
When updating, be sure to make a copy of the project directory. Firstly, you will always have a backup, and secondly you can have Windows 8 and Windows 8.1 versions in the Store at the same time.
1. The warning "Windows.ApplicationModel.DataTransfer.DataPackage.SetUri (System.Uri)" is obsolete: "SetUri may be altered or unavailable for release after Windows 8.1. Instead, use SetWebLink or SetApplicationLink. ”The most simple and easily correcting warning. In version 8.1, setUri was divided into various methods SetWebLink and SetApplicationLink. If you have a link to a website, it is enough to replace setUri with SetWebLink
2. The warning “Windows.UI.Notifications.TileTemplateType.TileWideText04” is obsolete: “TileWideText04 may be altered or unavailable for released after Windows 8.1. Instead, use TileWide310x150Text04. "')
Again, simply replace TileWideText04 with TileWide310x150Text04 with either a tile template of any other size.
3. The warning “Windows.UI.Xaml.Controls.ScrollViewer.ScrollToVerticalOffset (double)” is obsolete: “ScrollToVerticalOffset may be altered or unavailable for Windows 8.1. Instead, use ChangeView. ”Means that ScrollToVerticalOffset is now an obsolete method. A code similar to the following should be replaced.
scrollV.ScrollToHorizontalOffset(100);
on
scrollV.ChangeView(100, 0, 1);
4. The warning “Windows.UI.ViewManagement.ApplicationView.Value” is obsolete: “Value may be altered or unavailable for releases after Windows 8.1. Instead, query for window layout sizes directly. "This is the most popular warning that occurs most often.
The ApplicationView object is obsolete. In Windows 8.1, the 50/50 mode is also added to the snap mode. This provides more opportunities for handling the state of the application, but it also forces us to bind to the width of the screen, and not to the name of a particular state.
In C #, do it like this:
Register the event Window.Current. SizeChanged + = Window_SizeChanged;
And further in the event handler code, depending on the size of the device screen, we start the necessary processing:
private void Window_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e) { if (e.Size.Width <= 1000){
As you can see in the example, the orientation (Layout) of the screen can still be determined not by the aspect ratio, but by name. It is possible that in the near future the orientation of the device can only be determined by the ratio of width to height. If the width is greater, then it is landscape, and if less, then portrait. In a similar JavaScript example, let's do this (the example from the official guideline has already refused to work with me):
A nice plus in applications for HTML5 was and is the ability to set styles for different positions and screen sizes. In 8.1, these media styles were slightly changed from styles indicating the state of the application to styles indicating the width in pixels.
That is, such styles as:
@media (-ms-view-state: snapped)
or
@media (-ms-view-state: filled)
were replaced by classic:
@media (min-width: 500px) and (max-width: 1023px)
or
@media (min-width: 1024px)
There are also changes in orientation styles. Now they look like this:
@media (orientation: landscape) { } @media (orientation: portrait) { }
For those who thought it all too easy, I’ll give you another rare mistake that occurs when updating an application created in the developer preview version (it does not threaten most developers).
After the upgrade, the project refused to open, giving the following error:
D: \ TesT \ TesT.csproj: error: The imported project "C: \ Program Files \ MSBuild \ Microsoft \ WindowsXaml \ v11.0 \ Microsoft.Windows.UI.Xaml.CSharp.targets" was not detected. Check the path in the Import declaration and the presence of the file on disk. D: \ TesT \ TesT.csprojOpen the project file and find a similar line in it:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
Replace
v $ (VisualStudioVersion) with the version of our studio we are using. In my case, this is the version of Visual Studio 2013, which means I
’m replacing it with
v12.0Summary:Updating the application is not only possible, but also easy. Dare!
If you have time to do this this year, then you will have the opportunity to participate in the
competition and at the same time promote your application.
There will be plenty of performance improvements in 8.1
There are a lot of changes. He cited only the most popular mistakes he encountered himself. Willingly read about other errors / warnings in the comments.
Official guides and list of changes:
Changes to the Windows 8.1 API (HTML)Changes to the Windows 8.1 API (XAML)