-2
我有一個WPF應用程序,其中一個啓動按鈕執行一些Web服務調用,它返回一些結果,我使用oxyplot在圖上繪製。我在UI上有一個圖像,我希望將其用作「微調器」,直到任務完成。如何在後臺運行任務時在WPF中旋轉圖像?
我可以使用按鈕點擊路由事件旋轉我的圖像,但我希望它保持旋轉,直到我的Web服務調用完成。有什麼建議麼?
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="capIcon" Storyboard.TargetProperty="RenderTransform.Angle" By="90" Duration="0:0:1" />
<DoubleAnimation Storyboard.TargetName="capIcon" Storyboard.TargetProperty="RenderTransform.Angle" By="90" Duration="0:0:1" />
<DoubleAnimation Storyboard.TargetName="capIcon" Storyboard.TargetProperty="RenderTransform.Angle" By="90" Duration="0:0:1" />
<DoubleAnimation Storyboard.TargetName="capIcon" Storyboard.TargetProperty="RenderTransform.Angle" By="90" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
,這裏是我的按鈕單擊方法:
private void Button_Click_1(object sender, RoutedEventArgs e)
{
if (!validateThreadCount())
return;
RunTimes.runTimes.Clear();
//this.Plot.InvalidateFlag = 1;
int threads = Convert.ToInt16(this.ThreadCount.Text);
Task[] tasks = new Task[threads];
for (int i = 0; i < threads; i++)
{
DealClient dealClient = new DealClient();
var t = Task.Factory.StartNew(() => dealClient.NewDeal(1));
tasks[i] = t;
}
Task.WaitAll(tasks);
var points = new List<ScatterPoint>();
for (int i = 0; i < RunTimes.runTimes.Count; i++)
{
points.Add(new ScatterPoint(RunTimes.runTimes[i].Milliseconds, i, 3));
}
this.pts.ItemsSource = points;
}
謝謝,這幫助了,現在我只需要弄清楚如何從C#旋轉圖像 – user6849787