在过去的几个月我一直在写一个新城运动博客系列介绍了如何重新在本地的Windows Phone 7应用程序中找到自己的应用程序内的流体影响。到目前为止,我已覆盖,"剥离"的动画,{A1}和"倾斜"的效果吗??现在呢??我出的主意!
以前的博客文章用一个非常简单的的小应用程序来展示自己的功能,所以我想这可能是一个更有意义的应用程序内把这些影响乐趣。不是简单的重新散列的旧观念,而是像Twitter的应用程序,我决定建立原创的东西,一些启发,探讨了学科领域的一些接近我的心吗??
胃。这是我来到(完全原创)SandwichFlow?应用夹心爱好者!???
SandwichFlow不如三明治移动获得带给你团队分心,ColinDoesIt(AsWell):
随机点的利息
该应用程序的重要位是覆盖在前面的地铁In_motion博客帖子,所以下面仅仅是一个随机一堆东西,您可能会发现这个应用程序的有趣,
食谱小偷
食谱刮神奇的{A2} Web的页面,这是XHTML格式出版,很容易使我抓住每个配方的各组成部分。擦伤的输出保存为一个XML文件,该文件的应用程序使用,以建立一个视图模型,使用LINQ to XML:
跳转然后滑动XDocument doc = XDocument.Parse(xml);
Sandwiches = doc.Descendants("sandwich")
.Select(el => new Sandwich()
{
Title = el.Attribute("title").Value,
Id = id++,
Keywords = el.Descendants("keyword")
.Select(l => Regex.Replace(l.Value, @"\b(\w)", m => m.Value.ToUpper()))
.ToList(),
Ingredients = el.Descendants("ingredient")
.Select(l => l.Value)
.ToList(),
Instructions = el.Descendants("instruction")
.Select(l => new InstructionStep()
{
Text = l.Value,
Step = l.ElementsBeforeSelf().Count() + 1
})
.ToList()
})
.ToList();
应用程序的头版使用{A3}我写了几个月前提供DataTemplates MetroInMotion.AnimationLevel财产上的各种元素的渲染配方或关键字,让他们作为支点控制幻灯片优雅动画从一个项目到下一个:{C}把它带回
我原本添加到每一页的背景图片,然后我意识到一个更好的地方放,这是应用程序框架:<Style x:Key="mainFrameStyle"
TargetType="phone:PhoneApplicationFrame">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="phone:PhoneApplicationFrame">
<Grid Background="White">
<!-- background image -->
<Image Source="background.jpg"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
<Border x:Name="ClientArea"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
VerticalAlignment="{TemplateBinding VerticalAlignment}">
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
应用程序框架仍然是整个应用的生命周期,它承载当前显示的页面。我有一种感觉,应用程序框架下使用小。而不是每一页加入您的应用程序的标题,为什么不把它添加到帧?相同的,但不同
找到类似三明治的代码使用了一个有趣的LINQ的方法,我没有使用之前,相交。它始终是良好的学习新的东西! // locate related sandwiches
foreach (var sandwich in Sandwiches)
{
sandwich.Similar = Sandwiches.Where(s => s != sandwich)
.Select(s =>
new
{
Sandwich = s,
Score = KeywordCorrelation(s.Keywords, sandwich.Keywords)
})
.OrderBy(s => s.Score).Reverse()
.Take(5)
.Select(s => s.Sandwich)
.ToList();
}
private double KeywordCorrelation(List<string> keywordsOne, List<string> keywordsTwo)
{
var commonKeywords = keywordsOne.Intersect(keywordsTwo);
var allKeywords = keywordsOne.Union(keywordsTwo).Distinct();
return (double)commonKeywords.Count() / (double)allKeywords.Count();
}
KeywordCorrelation方法找到关键字,常见的有两种三明治,然后除以鲜明的关键字集合为三明治。美味。湿滑的成分
当您查看配方,成分从右边滑动。我真的没有时间去寻找图像在网络上的所有成分,因此每个配方我最喜欢的成分??奶酪和泡菜三明治。每种成分的幻灯片中使用脚本,用他们的BeginTime交错:<Image Source="tom.png"
Margin="150,70,0,0"
mim:MetroInMotion.AnimationLevel="2">
<Image.RenderTransform>
<TranslateTransform x:Name="tomTrans"
X="400"/>
</Image.RenderTransform>
<Image.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard BeginTime="00:00:0.2">
<DoubleAnimation Duration="00:00:0.7"
Storyboard.TargetName="tomTrans"
Storyboard.TargetProperty="X"
From="400" To="0">
<DoubleAnimation.EasingFunction>
<SineEase EasingMode="EaseOut"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Image.Triggers>
</Image>
他们还MetroInMotion.AnimationLevel附加属性,让他们与支点控制幻灯片。
你能抢到这里的代码:{A4}
方面,科林E.