-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpinningWheel.xaml.cs
More file actions
48 lines (41 loc) · 1.46 KB
/
Copy pathSpinningWheel.xaml.cs
File metadata and controls
48 lines (41 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#region " Imports definitions "
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
# endregion
namespace ImageMerger
{
/// <summary>
/// Displays a spinning wheel while the program performs time-consuming routines
/// </summary>
public partial class SpinningWheel : UserControl
{
public SpinningWheel()
{
InitializeComponent();
}
// Place ellipses in circular order after control load finished
private void HandleLoaded(object sender, RoutedEventArgs e)
{
const double offset = Math.PI;
const double step = Math.PI * 2 / 10.0;
SetPosition(C0, offset, 0.0, step);
SetPosition(C1, offset, 1.0, step);
SetPosition(C2, offset, 2.0, step);
SetPosition(C3, offset, 3.0, step);
SetPosition(C4, offset, 4.0, step);
SetPosition(C5, offset, 5.0, step);
SetPosition(C6, offset, 6.0, step);
SetPosition(C7, offset, 7.0, step);
SetPosition(C8, offset, 8.0, step);
}
private static void SetPosition(Ellipse ellipse, double offset,
double posOffSet, double step)
{
ellipse.SetValue(Canvas.LeftProperty, 50.0
+ Math.Sin(offset + posOffSet * step) * 50.0);
ellipse.SetValue(Canvas.TopProperty, 50
+ Math.Cos(offset + posOffSet * step) * 50.0);
}
}
}