Skip to content

Commit 803c3fd

Browse files
authored
:օկ:
1 parent 1c0a00f commit 803c3fd

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
11
<p align="center"><img src="http://aparanblog.do.am/fixed.png"></p></br>
2+
```
3+
private Point CorrespondingPoint(Point pt)
4+
{
5+
double xmin = 0;
6+
double xmax = 6.5;
7+
double ymin = -1.1;
8+
double ymax = 1.1;
9+
10+
var result = new Point
11+
{
12+
X = (pt.X - xmin) * canvas.Width / (xmax - xmin),
13+
Y = canvas.Height - (pt.Y - ymin) * canvas.Height / (ymax - ymin)
14+
};
15+
return result;
16+
}
17+
private void Draw_Graph_Click(object sender, RoutedEventArgs e)
18+
{
19+
HttpClient client = new HttpClient();
20+
JavaScriptSerializer jss = new JavaScriptSerializer();
21+
string url = string.Format("http://localhost:53901/api/plot");
22+
client.GetAsync(url).ContinueWith(resurse =>
23+
{
24+
HttpResponseMessage message = client.GetAsync(url).Result;
25+
string responseText = message.Content.ReadAsStringAsync().Result;
26+
List<Point> list = jss.Deserialize<List<Point>>(responseText);
27+
28+
Dispatcher.BeginInvoke(DispatcherPriority.Normal,
29+
(Action)(() =>
30+
{
31+
foreach (var item in list)
32+
{
33+
polyline.Points.Add(CorrespondingPoint(new Point(item.X, item.Y)));
34+
}
35+
canvas.Children.Add(polyline);
36+
}));
37+
}
38+
39+
40+
41+
);
42+
}
43+
44+
<h4>Author [Tigran Vardanyan](https://github.com/tigranv)<h4>

0 commit comments

Comments
 (0)