Currently, developers of Windows Phone 8 are fighting for technical friends. I believe that while developing Windows Phone 8, we are also focusing on Windows 8, I believe that many developers must start on Windows 8 and Windows Phone 8. In fact, the most important update of Windows phone8 is that Windows Phone runtime shares the NT kernel with Windows 8, windows runtime or winrt provides more than 11,000 members to support Windows 8. However, Windows Phone runtime or winprt is a subset of winrt, with more than 2,800 shared members and more than 600 Windows phones.. (For example, voice, VoIP, lock screen management, etc ...) we can see that many AIPS are shared at the API level due to the sharing of the Windows Kernel. What convenience does this shared API bring to our development, I will introduce it to you later. At the same timeYou are welcome to communicate with me here or on Sina Weibo.@ Wang Bo _ Nick
Windows 8 and Windows Phone 8 share the Windows Kernel, which means developers can use common programming models to build applications.ProgramAnd games.
From the perspective of development costs or product planning, developers can use the sameCode/Development language/development tools to create applications and games simultaneously, Windows 8 and Windows Phone 8 fundamentally accelerate development time.
Here, some people will think about the characteristics of winprt. How can we determine the existence of a winrtapi or winprt during development? What are the unique APIs of winprt?
Here I will give you a detailed list of msdn can be found: http://msdn.microsoft.com/en-us/library/windows/apps/jj207212 (V = vs.105). aspx # bkmk_understandingthewinrtdocumentation
We can clearly see that during the development of Windows Phone 8 and Windows 8, we can share those parts. Note that the Javascript + HTML development mode supports APIs in the Windows 8 winrt environment. but in the winprt environment, it is based on ie10 control, by the way, the Windows Phone 8 ie10 control is used to run JavaScript, especially the HTML5 support is greatly improved, including multi-touch support.
Here is a Windows Phone API Quick Start poster (PDF) that everyone liked on teched 2012. (If you didn't get a limited number of students, please download and print them here)
Windows phone8 new features: http://msdn.microsoft.com/en-us/library/windows/apps/jj206940 (V = vs.105). aspx
Secondly, in actual development, many system controls are certainly used. In fact, these controls are very similar. during design, there are many commonalities.
From the figure above, we can see that most of the controls in Windows 8 and Windows Phone 8 are similar, although these controls are not completely based on the same namespace, the write and usage of the XAML are the same. Therefore, many ue operations of the controls are the same when the designer designs the leaf, of course, Windows Phone 8 also has some special controls, such as panorama and ghost, because Windows Phone users have special usage habits. However, in Windows 8, users prefer to use gridview and flipview.
Here I will give a detailed list of msdn for your reference Windows 8 and Windows Phone 8 control differences: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj735581 (V = vs.105). aspx
As mentioned above, some may ask how we do this in actual projects?
1. Use mvvm to split the UI Logic
I have never heard of or used the pattern of mvvm before Silverlight or WPF, if your Windows 8 or Windows Phone project is developed using mvvm, you can choose to share viewmodel to save a lot of time for your development.
Here is a trusted operation method:
Http://msdn.microsoft.com/en-us/library/windows/apps/jj721615 (V = vs.105). aspx
Http://msdn.microsoft.com/en-us/library/windows/apps/gg521153 (V = vs.105). aspx
2. Use portable Class Libraries
I believe my friend has found that both viewmodle and model are placed in a portable/common. Here I will explain the structure of portable class libraries.
Portable class library is a new class library template in vs2012 based on. net4.0 this class library is a subset of Silverlight, Windows Phone, Windows 8, and xbox360 and can be run in the above environment, which undoubtedly shares the same business logic between different platforms, it makes great convenience for developers.
Notes when using portable Class Libraries
- Only supports hosting code development C # Or VB. NET
- Do not use Conditional compilation
- Do not use Windows Runtime API
- Do not use the UI control library
Reference: http://msdn.microsoft.com/en-us/library/windows/apps/jj714086 (V = vs.105). aspx
3. Use link to share code files
The link format has been introduced in my previous WP7 to WP8 cases. This format is also applicable between Windows Phone 8 and Windows 8. The practice is very simple.
Reference: http://msdn.microsoft.com/en-us/library/windows/apps/jj714082 (V = vs.105). aspx
4. Use Windows runtime Components
When developing winrt or winprt applications, Windows runtime components is required to encapsulate and support all development languages when some functions are not open to the language we are using. call
Benefits of using Windows runtime Components
- Benefits of C ++
- Supports multiple-purpose voice calls.
- Supports direct3d, Win32, or com APIs (partially)
- Call a third-party class library
Reference: http://msdn.microsoft.com/en-us/library/windows/apps/jj714080 (V = vs.105). aspx
5. Share the XAML UI
This function may be used less for pages, and encapsulation controls should be more useful (personal feeling)
Interested students can spend some time digesting: http://channel9.msdn.com/Events/Build/2012/3-043R
Reference: http://msdn.microsoft.com/en-us/library/windows/apps/jj714088 (V = vs.105). aspx
6. Use Conditional compilation to compile the command
Finally, I also introduced in the previous WP7 to WP8 to differentiate compilation between different projects during file sharing and use it with Link code.
namespace ProjectB
{
public class MyClass
{
public void CommonMethodA()
{
// code that is common to Windows Phone 8 and Windows 8
}
public int CommonMethodB()
{
int result = 0;
// code that is common to Windows Phone 8 and Windows 8
return result;
}
public void PlatformSpecificMethod()
{
#if NETFX_CORE
// code for Windows 8
#else
// code for Windows Phone 8
#endif
}
}
}
Reference: http://msdn.microsoft.com/en-us/library/windows/apps/jj714084 (V = vs.105). aspx
Also refer to my previous blog post: http://www.cnblogs.com/sonic1abc/archive/2012/11/17/2775292.html
You are welcome to communicate with me here or on Sina Weibo.@ Wang Bo _ Nick