200 likes | 335 Views
WP7PUBLISH: best practices for developing content apps. OLEKSANDR KRAKOVETSKYI CEO , DevRain Solutions , @ msugvnua. DevRain Solutions. 30+ apps for Windows Phone 5 apps for Windows 8 Best Windows Phone 8 solutions provider in 2012 Windows Phone Next App Star contest finalist
E N D
WP7PUBLISH: best practices for developing content apps OLEKSANDR KRAKOVETSKYI CEO, DevRainSolutions, @msugvnua
DevRain Solutions • 30+ apps for Windows Phone • 5 apps for Windows 8 • Best Windows Phone 8 solutions provider in 2012 • Windows Phone Next App Star contest finalist • 2.5 mlndownloads(April, 2013) • WP7PUBLISH – content platform for Windows Phone and Windows 8 is shortlisted in Ukrainian Startup Contest
Authentically digital • Cloud Connected • In Motion • Typography • Action http://pinterest.com/chsneo/ui-authentically-digital/
RSS reader can be written by student this eveningYou may find a lot of such apps in the market!But you can’t use them…
Features • Working with RSS, Twitter, YouTube feeds (from the box), custom APIs • Native controls, no web browser (HtmlTextBox) • Feeds • Offline work • Localization, branding • Settings • Opa, Metro style! • Real MVVM, optimization best practices • Ads integration
Problems • RSS can be broken, encoding can be wrong or unknown, HTML can be unsupportable (iframe) • Source can be down • Url can be redirected (bash.org.ru -> bash.im) • Native, not web browser • Control size limitation (not more than 2048 px) • Localization • Feeds management • Exception handling • Migration to new versions
Size limitation <Grid x:Name="ContentPanel"Grid.Row="1" Margin="12,0,12,0"><ScrollViewer><TextBlock x:Name="textBlock" TextWrapping="Wrap" /></ScrollViewer> </Grid> privatevoidParseText(string value) {if (this.stackPanel == null) {return; }// Clear previous TextBlocksthis.stackPanel.Children.Clear();// Calculate max char countintmaxTexCount = this.GetMaxTextSize();if (value.Length < maxTexCount) {TextBlocktextBlock = this.GetTextBlock();textBlock.Text = value;this.stackPanel.Children.Add(textBlock); }else {int n = value.Length / maxTexCount;int start = 0;// Add textblocksfor (inti = 0; i < n; i++) { TextBlocktextBlock = this.GetTextBlock();textBlock.Text = value.Substring(start, maxTexCount);this.stackPanel.Children.Add(textBlock); start = maxTexCount; }// Pickup the leftover textif (value.Length % maxTexCount > 0) {TextBlocktextBlock = this.GetTextBlock();textBlock.Text = value.Substring(maxTexCount * n, value.Length - maxTexCount * n);this.stackPanel.Children.Add(textBlock); } } }
RichTextBox privatevoidbtnSetXaml_Click(objectsender, RoutedEventArgs e) { // NOTE: the paragraphs with the actual content are // wrapped in a section that defines the namespace so that the elements can be resolved stringxaml = @"<Section xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""> <Paragraph> <Underline Foreground=""LightBlue"">Some Underline Text Here!</Underline> </Paragraph> <Paragraph Foreground=""Red""> <Bold>Some Bold Text Here!</Bold> </Paragraph> </Section>"; this.richTextBox.Xaml = xaml; }
HtmlTextBlock • HTML parsing (HtmlAgilityPack) • XAML parsing (working with nodes tree) • Detecting size in runtime based on certain text, settings etc. • Exceptions handling • Preprocessors (high level and feed-based)
WP7PUBLISH 2.0 • No navigation buttons (just gestures) • Content, not chrome • Animations between pages • One hand reading • Good performance
Sync (offline) • Offline is not just caching but sync • Testing is difficult • Multithreading (with all future issues)
QA Alex.Krakovetskiy@devrain.com http://devrain.com @msugvnua