我已经写了一个if语句,我已经在这里发布了一次,现在它正常工作,除了我的颜色变化。应用不同的变量没有问题,但颜色变化没有发生。我假设这也非常简单,我没有抓住它。任何援助都会很棒。我可以先进行颜色更改,但变量永远不会出现在文本块中。
if (e.CmsData.Skill.InQueueInRing > 0)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { callsWaitingData.Text = e.CmsData.Skill.InQueueInRing.ToString(); }));
callsWaitingData.Foreground = new SolidColorBrush(Colors.Red);
}
else if (e.CmsData.Skill.AgentsAvailable > 0)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { callsWaitingData.Text = e.CmsData.Skill.AgentsAvailable.ToString(); }));
callsWaitingData.Foreground = new SolidColorBrush(Colors.Green);
}
else
{
callsWaitingData.Text = "0";
callsWaitingData.Foreground = new SolidColorBrush(Colors.Yellow);
}
答案 0 :(得分:0)
以下是决议。我原本试过这个,但无论出于什么原因它都没用。当我再次尝试它时。对不起,对不起!
if (e.CmsData.Skill.InQueueInRing > 0)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { callsWaitingData.Text = e.CmsData.Skill.InQueueInRing.ToString();
callsWaitingData.Foreground = new SolidColorBrush(Colors.Red); }));
}
else if (e.CmsData.Skill.AgentsAvailable > 0)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { callsWaitingData.Text = e.CmsData.Skill.AgentsAvailable.ToString();
callsWaitingData.Foreground = new SolidColorBrush(Colors.Green);}));
}
else if(e.CmsData.Skill.AgentsAvailable == 0)
{
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => { callsWaitingData.Text = e.CmsData.Skill.AgentsAvailable.ToString();
callsWaitingData.Foreground = new SolidColorBrush(Colors.Yellow); }));
}