aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/PathPainter/Program.cs
blob: 5993c852f14de9339b6912b19b51e2bd30688416 (plain)
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
using Crow;
using System;

namespace PathPainter
{
	class Program : SampleBase
	{
		static void Main (string[] args) {
			using (Program app = new Program ())				
				app.Run ();			
		}

        protected override void OnInitialized () {
            base.OnInitialized ();
			Load ("#ui.main.crow").DataSource = this;
		}
		string currentPath = "M 5.5,0.5 L 10.5,10.5 L 0.5,10.5 Z F";
		int currentSize = 11;
		double zoom = 1.0;
		double strokeWidth = 1.0;
		Color foreground = Colors.Black;
		Color background = Colors.White;

		public Measure DesignSize => (int)(zoom * currentSize); 

		public double StrokeWidth {
			get => strokeWidth;
			set {
				if (strokeWidth == value)
					return;
				strokeWidth = value;
				NotifyValueChanged (strokeWidth);
            }
        }
		public string CurrentPath {
			get => currentPath;
			set {
				if (currentPath == value)
					return;
				currentPath = value;
				NotifyValueChanged (currentPath);
			}
		}
		public Size Size => new Size (currentSize);
		public int CurrentSize {
			get => currentSize;
			set {
				if (currentSize == value)
					return;
				currentSize = value;
				NotifyValueChanged (currentSize);
				NotifyValueChanged ("Size", (object)new Size (currentSize));
				NotifyValueChanged ("CurrentPath", (object)CurrentPath);
			}
		}
		public Color Foreground {
			get => foreground;
			set {
				if (foreground == value)
					return;
				foreground = value;
				NotifyValueChanged (foreground);
			}
		}
		public Color Background {
			get => background;
			set {
				if (background == value)
					return;
				background = value;
				NotifyValueChanged (background);
			}
		}

	}
}