在我的uwp项目中,我在图片上有3种不同的颜色覆盖(绿色、黄色和红色)。这些颜色应该用来表示房间(在这种情况下,房间是一张照片)是否已被预订。
如果房间被预订了,它应该会淡出green color,在red color上淡出,然后7秒后,red color应该淡出yellow color,最后yellow color应该再次淡出green color。
Windows Animation extension for UWP。Green Color设置为默认设置。现在,当一个房间被预定时,第一个淡出正在工作(红色到黄色),但是Yellow到Green没有褪色。
public void RedIndicatorColorToYellowIndicatorColor()
{
StatusColor.Fade(duration: 1000, delay: 2000, value: 0).Start();
StatusColor.Fill = RedBrush;
DispatcherTimer ColorTimer = new DispatcherTimer();
ColorTimer.Interval = TimeSpan.FromSeconds(7);
ColorTimer.Tick += (Sender, args) =>
{
YellowindIcatorColorToGreenIndicatorColor();
ColorTimer.Stop();
};
ColorTimer.Start();
}
public void YellowindIcatorColorToGreenIndicatorColor()
{
StatusColor.Fade(duration: 1000, delay: 0, value: 1).Start();
StatusColor.Fill = YellowBrush;
DispatcherTimer ColorTimer2 = new DispatcherTimer();
ColorTimer2.Interval = TimeSpan.FromSeconds(7);
ColorTimer2.Tick += (Zender, Args) =>
{
StatusColor.Fill = GreenBrush;
ColorTimer2.Stop();
};
ColorTimer2.Start();
}StatusColor是容纳颜色覆盖的矩形。
发布于 2018-05-25 14:18:46
解决了问题!
public void RedIndicatorColorToYellowIndicatorColor()
{
StatusColor.Fill = GreenBrush;
DispatcherTimer ColorTimer = new DispatcherTimer();
ColorTimer.Interval = TimeSpan.FromSeconds(7);
ColorTimer.Tick += async (Sender, args) =>
{
await StatusColor.Fade(duration: 1000, delay: 0, value: 0).StartAsync();
StatusColor.Fill = RedBrush;
await StatusColor.Fade(duration: 1200, delay: 0, value: 1).StartAsync();
YellowindIcatorColorToGreenIndicatorColor();
ColorTimer.Stop();
};
ColorTimer.Start();
}
public void YellowindIcatorColorToGreenIndicatorColor()
{
DispatcherTimer ColorTimer2 = new DispatcherTimer();
ColorTimer2.Interval = TimeSpan.FromSeconds(7);
ColorTimer2.Tick += async (Zender, Args) =>
{
await StatusColor.Fade(duration: 1000, delay: 0, value: 0).StartAsync();
StatusColor.Fill = YellowBrush;
await StatusColor.Fade(duration: 1200, delay: 0, value: 1).StartAsync();
red2green();
ColorTimer2.Stop();
};
ColorTimer2.Start();
}https://stackoverflow.com/questions/50504637
复制相似问题