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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;
using Microsoft.Win32;
using System.Collections.ObjectModel;
namespace WpfApplication1
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window, INotifyPropertyChanged
{
System.Windows.Threading.DispatcherTimer dTimer = new System.Windows.Threading.DispatcherTimer();
private string title2="123";
/// <summary>
///
/// </summary>
public virtual string TitleTest
{
get { return title2; }
set
{
if (title2 != value)
{
title2 = value;
NotifyPropertyChanged("TitleTest");
}
}
}
public Test1 test;
public MainWindow()
{
InitializeComponent();
test = new Test1();
//this.graphscan1.DataContext = this;
this.graphscan1.Title = "环形扫描图";
this.graphscan1.SetBinding(FLY.ControlLibrary.GraphScan.TitleProperty, new Binding("TitleTest"));
this.DataContext = this;
this.textBox1.DataContext = test;
//this.graphscan1.SetBinding(FLY.ControlLibrary.GraphScan.Title2Property, new Binding("TitleTest"));
//string title2 = this.graphscan1.Title2;
ObservableCollection<int> datasource = new ObservableCollection<int>();
// Populate series data
Random random = new Random();
int cnt = 160;
for (int i = 0; i < cnt; i++)
{
double angle = 2 * Math.PI * 4 * i / cnt;
double d = Math.Sin(angle) * 15 + random.Next(5) - 2.5;
datasource.Add( (int)(d *100) + this.graphscan1.Target);
}
for (int i = 20; i < 45; i++)
{
datasource[i] = 99999998;
}
this.graphscan1.DataSource = datasource;
stackpanel_graph.DataContext = this.graphscan1;
this.graphscan1.FirstBoltNo = -cnt/2;
this.graphscan1.FirstIndex = -1;
this.graphscan1.LastIndex = cnt;
this.graphscan1.DataFirst = 2;
this.graphscan1.DataLast = cnt-2;
this.graphscan1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
dTimer.Interval = new TimeSpan(0, 0, 1);
dTimer.Tick += new EventHandler(dTimer_Tick);
dTimer.Start();
}
int test_no = 0;
void dTimer_Tick(object sender, EventArgs e)
{
test_no++;
TitleTest = test_no.ToString();
//graphscan1.Title2 = test_no.ToString();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
}
#region INotifyPropertyChanged 成员
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(string propertyname)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyname));
}
}
#endregion
int cnt = 0;
private void textBox1_IsMouseCaptureWithinChanged(object sender, DependencyPropertyChangedEventArgs e)
{
}
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
{
}
private void textBox1_GotFocus(object sender, RoutedEventArgs e)
{
}
private void textBox1_GotMouseCapture(object sender, MouseEventArgs e)
{
}
private void button2_Click(object sender, RoutedEventArgs e)
{
}
}
public class Test1 : INotifyPropertyChanged
{
private double abc;
public double ABC
{
get {
return abc;
}
set {
if (abc != value)
{
abc = value;
NotifyPropertyChanged("ABC");
}
}
}
#region INotifyPropertyChanged 成员
public event PropertyChangedEventHandler PropertyChanged;
protected void NotifyPropertyChanged(string propertyname)
{
if (this.PropertyChanged != null)
{
this.PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyname));
}
}
#endregion
}
public static class FLYUICommands
{
private static RoutedCommand keyboard = new RoutedCommand("Keyboard", typeof(FLYUICommands));
public static RoutedCommand Keyboard { get { return keyboard; } }
}
}