在我的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
是保存颜色叠加层的矩形。
答案 0 :(得分:0)
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();
}