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AAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH8AAP//AAD//wAA/38AAP9/AAD/fwAA/38AAP9/AAD/fwAA/38AAP8AAAD/gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAfwAA//8AAP//AAD/fwAA/38AAP9/AAD/fwAA/38AAP9/AAD/fwAA/wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAAB/AAD//wAA//8AAP9/AAD/fwAA/38AAP9/AAD/fwAA/38AAP9/AAD/AAAA/4CAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH8AAP//AAD//wAA/38AAP9/AAD/fwAA/38AAP9/AAD/fwAA/38AAP8AAAD/gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAfwAA//8AAP//AAD/fwAA/38AAP9/AAD/fwAA/38AAP9/AAD/fwAA/wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAfwAA/38AAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAAB/f3//nM7//5zO//+czv//nM7//5zO//+czv//v7+//wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//nM7//5zO//+czv//nM7//5zO//+/v7//AAAA/4CAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAAB/f3//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+/v7//AAAA/4CAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAf39//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//7+/v/8AAAD/gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//7+/v/8AAAD/gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAf39//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//v7+//wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+/v7//AAAA/4CAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAf39//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+/v7//AAAA/4CAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//7+/v/8AAAD/gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAf39//5zO//+czv//v7+//7+/v/+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//v7+//wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//nM7//7+/v/8AAAD/AAAA/5zO//+czv//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//+/v7//AAAA/4CAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAf39//5zO//+/v7//AAAA/4CAAAB/f3//nM7//5zO//+czv//nM7//5zO//+czv//nM7//5zO//9/f3//nM7//7+/v/8AAAD/gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//v7+//wAAAP+AgAAAgIAAAH9/f/+czv//nM7//39/f/+czv//nM7//39/f/+czv//v7+//wAAAP+czv//v7+//wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAf39//39/f/8AAAD/gIAAAICAAACAgAAAf39//5zO//+/v7//AAAA/5zO//+/v7//AAAA/5zO//+/v7//AAAA/5zO//+/v7//AAAA/4CAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAAB/f3//nM7//7+/v/8AAAD/nM7//7+/v/8AAAD/nM7//7+/v/8AAAD/f39//39/f/+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//v7+//wAAAP+czv//v7+//wAAAP+czv//v7+//wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAf39//5zO//+/v7//AAAA/5zO//+/v7//AAAA/39/f/9/f3//gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAAB/f3//nM7//7+/v/8AAAD/f39//39/f/+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//v7+//wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAf39//5zO//+/v7//AAAA/4CAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAAB/f3//nM7//7+/v/8AAAD/gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/+czv//v7+//wAAAP+AgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAH9/f/9/f3//gIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAAgIAAAICAAACAgAAA///////////+AD///gA///4AP//+AD///gA///8Af///AH///wB///4AP//8AD//+AAf//gAH//wAB//8AAP/+AAD//gAA//wAAP/8IAD/+GAA//jgAP//4AH//+AH///gD///4H///+H////h////4f///+H////z////////8='
10 Paste_b64 ←'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAMAAADXqc3KAAAAeFBMVEUAAAB7e3ucnJy1tbXOpUrOpVLOrVrnzpz39/f////OrWPn5+fOzs7WtWvWvXuEhITnzqXn1qWUlJRaWlq1nGO9zt6MjIyle0KlhDmljFqlpaXWrWOthEKtlFrW1tbexoTnzpS1hDG1lGOUc0KMYxjv7++9vb3GrXO+vRrUAAAAAXRSTlMAQObYZgAAAKNJREFUeF6NzVcOwyAQRVHTi3tL73X/OwzjeISxiZT7hXT0huRbCSVhV4hQSskDXhOo66pqCSFtp5QK4FwUDXTIiwCqPLfv7nbcbqScgXUxjDKGYAcwY2kGEgGdGZAlmJMGQZAeUpa9EKR04HumuwGkC6DHjFkBKADhYFI5ghBREFBwygPnkcVlz3kchiKn1ndoscCY0b4Z9Jj+a/H7j6aclnwANmEWNaPqN4UAAAAASUVORK5CYII='
11 Print_b64 ←'iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz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y52ey56vS5lXQewWrORkBi4GKC3b4DevgEiE466iV4mu0mqx+7a8I+7L4XtUh/5ZEA+euTweMW11/3RaDR+JRgcfWnz99f/G2B68pnnl5tMGWsAurp9dHX7Eoqz7KmV8YWByVEQXyZfeG7Xo2+9uc+/5UcPr1t+dWm9oiiH273n/hDrf8ZT0HQzIMec0yX/PvJo7dcefKDqjXi77rn/PRtX8Lad/U+z2TKvYPacb8zU4eDFi691drS/tWJl2SOyLOcAnDvbetcjNff9CVC+c9fmwl3PPt5G9FJGSfudEuhl04MPVO2L/9/ywwfXyJKELEmMjo7s3/rQD1+4719/8Ms4T5Yknnmq9o4fP3zf15J5p042//6Xv3jkQE9355NxXkHB7Ovjdnc9+3jHlWC6IgeSyes91+kPDLqBof977ZXH4nxJlpFkmbHxsTPvvXuor+1c60gg4H87zpdiB/v/uL/qufHw+NHAkL/u8NsHpt2oLkXT5YAGhIk6GInJyYCJ6FTqXvndnvZXfrfnUeAxJkINhBiWZTk7MDjYGDd2od/XaLPZb9Y0bXhoKJDI7o3f/vq3gDFgPNanGmtrRMNG4xI58Ff6S9P/AxzSkKqndbIyAAAAAElFTkSuQmCC'
14
15
16 _←⍬
17 _,←'<Window'
18 _,←L,' xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
19 _,←L,' xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">'
20 _,←L,'</Window>'
21 NewWindow←_
22
23 _←⍬
24 _,←'<Window'
25 _,←L,' xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
26 _,←L,' xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"'
27 _,←L,' xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"'
28 _,←L,' Height="200"'
29 _,←L,' Width="250"'
30 _,←L,' Title="MainWindow"'
31 _,←L,' WindowStartupLocation="CenterScreen">'
32 _,←L,' <Grid>'
33 _,←L,' <Grid.RowDefinitions>'
34 _,←L,' <RowDefinition Height="0.5*"/>'
35 _,←L,' <RowDefinition Height="0.5*"/>'
36 _,←L,' </Grid.RowDefinitions>'
37 _,←L,' <TextBox'
38 _,←L,' x:Name="textBox1"'
39 _,←L,' Width="130"'
40 _,←L,' HorizontalAlignment="Center"'
41 _,←L,' VerticalAlignment="Center"'
42 _,←L,' Text="TextBox"'
43 _,←L,' TextAlignment="Center"/>'
44 _,←L,' <Button'
45 _,←L,' x:Name="button1"'
46 _,←L,' Height="40"'
47 _,←L,' Width="120"'
48 _,←L,' Grid.Row="1"'
49 _,←L,' HorizontalAlignment="Center"'
50 _,←L,' VerticalAlignment="Center"'
51 _,←L,' Content="Click Me !"/>'
52 _,←L,' </Grid>'
53 _,←L,'</Window>'
54 sample1←_
55
56 _←⍬
57 _,←'<Window'
58 _,←L,' xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
59 _,←L,' xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"'
60 _,←L,' xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"'
61 _,←L,' x:Class="WpfApplication3.MainWindow"'
62 _,←L,' Height="200"'
63 _,←L,' Width="250"'
64 _,←L,' Title="MainWindow"'
65 _,←L,' WindowStartupLocation="CenterScreen">'
66 _,←L,' <Grid>'
67 _,←L,' <Grid.RowDefinitions>'
68 _,←L,' <RowDefinition Height="0.5*"/>'
69 _,←L,' <RowDefinition Height="0.5*"/>'
70 _,←L,' </Grid.RowDefinitions>'
71 _,←L,' <TextBox'
72 _,←L,' x:Name="textBox1"'
73 _,←L,' Width="130"'
74 _,←L,' HorizontalAlignment="Center"'
75 _,←L,' VerticalAlignment="Center"'
76 _,←L,' Text="TextBox"'
77 _,←L,' TextAlignment="Center"/>'
78 _,←L,' <Button'
79 _,←L,' x:Name="button1"'
80 _,←L,' Click="__Button_Click"'
81 _,←L,' Height="40"'
82 _,←L,' Width="120"'
83 _,←L,' Grid.Row="1"'
84 _,←L,' HorizontalAlignment="Center"'
85 _,←L,' VerticalAlignment="Center"'
86 _,←L,' Content="Click Me !"/>'
87 _,←L,' </Grid>'
88 _,←L,'</Window>'
89 sample2←_
90
91 _←⍬
92 _,←'<Window'
93 _,←L,' xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
94 _,←L,' xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"'
95 _,←L,' Width="640"'
96 _,←L,' Height="480"'
97 _,←L,' Title="PuttingItAllTogether"'
98 _,←L,' WindowStartupLocation="CenterScreen">'
99 _,←L,' <DockPanel Width="Auto" Height="Auto" LastChildFill="True">'
100 _,←L,' <!--Top Menu Area-->'
101 _,←L,' <Menu'
102 _,←L,' Width="Auto"'
103 _,←L,' Height="20"'
104 _,←L,' Background="#FFA9D1F4"'
105 _,←L,' DockPanel.Dock="Top">'
106 _,←L,' <!-- File Menu -->'
107 _,←L,' <MenuItem Header="_File">'
108 _,←L,' <MenuItem Header="_Cut" Name="mnuCut">'
109 _,←L,' <MenuItem.Icon>'
110 _,←L,' <Image Name="Cut_b64" Width="16" Height="16"/>'
111 _,←L,' </MenuItem.Icon>'
112 _,←L,' </MenuItem>'
113 _,←L,' <MenuItem Header="_Copy" Name="mnuCopy">'
114 _,←L,' <MenuItem.Icon>'
115 _,←L,' <Image Name="Copy_b64" Width="16" Height="16"/>'
116 _,←L,' </MenuItem.Icon>'
117 _,←L,' </MenuItem>'
118 _,←L,' <MenuItem Header="_Paste" Name="mnuPaste">'
119 _,←L,' <MenuItem.Icon>'
120 _,←L,' <Image Name="Paste_b64" Width="16" Height="16"/>'
121 _,←L,' </MenuItem.Icon>'
122 _,←L,' </MenuItem>'
123 _,←L,' <Separator/>'
124 _,←L,' <MenuItem Header="_Print" Name="mnuPrint">'
125 _,←L,' <MenuItem.Icon>'
126 _,←L,' <Image Name="Print_b64" Width="16" Height="16"/>'
127 _,←L,' </MenuItem.Icon>'
128 _,←L,' </MenuItem>'
129 _,←L,' <Separator/>'
130 _,←L,' <MenuItem Header="_Quit" Name="mnuQuit">'
131 _,←L,' <MenuItem.Icon>'
132 _,←L,' <Image Name="Quit_b64" Width="16" Height="16"/>'
133 _,←L,' </MenuItem.Icon>'
134 _,←L,' </MenuItem>'
135 _,←L,' </MenuItem>'
136 _,←L,' <!-- About Menu -->'
137 _,←L,' <MenuItem Header="_Help">'
138 _,←L,' <MenuItem Header="_About" Name="mnuAbout"/>'
139 _,←L,' </MenuItem>'
140 _,←L,' </Menu>'
141 _,←L,' <!--Bottom Status Bar area, declared before middle section, '
142 _,←L,' as I want it to fill entire bottom of Window, '
143 _,←L,' which it wouldn''t if there was a Left docked panel before it -->'
144 _,←L,' <StackPanel'
145 _,←L,' Width="Auto"'
146 _,←L,' Height="31"'
147 _,←L,' Background="#FFCAC5C5"'
148 _,←L,' DockPanel.Dock="Bottom"'
149 _,←L,' Orientation="Horizontal">'
150 _,←L,' <Label'
151 _,←L,' Name="lStatusBar"'
152 _,←L,' Width="200"'
153 _,←L,' Height="23"'
154 _,←L,' Content="Status Bar Message...."'
155 _,←L,' FontFamily="Arial"'
156 _,←L,' FontSize="12"/>'
157 _,←L,' </StackPanel>'
158 _,←L,' <!--Left Main Content area-->'
159 _,←L,' <StackPanel'
160 _,←L,' Name="buttonPanel"'
161 _,←L,' Width="136"'
162 _,←L,' Height="Auto"'
163 _,←L,' Background="White">'
164 _,←L,' <Button'
165 _,←L,' Name="btnButton1"'
166 _,←L,' Width="Auto"'
167 _,←L,' Height="26"'
168 _,←L,' Margin="5,5,5,5">'
169 _,←L,' <WrapPanel>'
170 _,←L,' <Image Name="Settings_b64" Height="16" Width="16"/>'
171 _,←L,' <TextBlock Text="Button1" Margin="5,0,0,0"/>'
172 _,←L,' </WrapPanel>'
173 _,←L,' </Button>'
174 _,←L,' <Button'
175 _,←L,' Name="btnButton2"'
176 _,←L,' Width="126"'
177 _,←L,' Height="26"'
178 _,←L,' Margin="5,5,5,5"'
179 _,←L,' Content="Button2"/>'
180 _,←L,' <Button'
181 _,←L,' Name="btnButton3"'
182 _,←L,' Width="126"'
183 _,←L,' Height="26"'
184 _,←L,' Margin="5,5,5,5"'
185 _,←L,' Content="Button3"/>'
186 _,←L,' </StackPanel>'
187 _,←L,' <!--Right Main Content area, NOTE HOW this Grid is the last child'
188 _,←L,' so takes all the remaining room -->'
189 _,←L,' <Grid Width="Auto" Height="Auto" Background="#FFCC9393">'
190 _,←L,' <Grid.ColumnDefinitions>'
191 _,←L,' <ColumnDefinition Width="*"/>'
192 _,←L,' <ColumnDefinition Width="*"/>'
193 _,←L,' </Grid.ColumnDefinitions>'
194 _,←L,' <Grid.RowDefinitions>'
195 _,←L,' <RowDefinition Height="*"/>'
196 _,←L,' <RowDefinition Height="*"/>'
197 _,←L,' </Grid.RowDefinitions>'
198 _,←L,' <Rectangle'
199 _,←L,' Grid.Column="0"'
200 _,←L,' Grid.Row="0"'
201 _,←L,' Margin="10,10,10,10"'
202 _,←L,' Fill="Aqua"/>'
203 _,←L,' <Rectangle'
204 _,←L,' Grid.Column="1"'
205 _,←L,' Grid.Row="0"'
206 _,←L,' Margin="10,10,10,10"'
207 _,←L,' Fill="Aqua"/>'
208 _,←L,' <Rectangle'
209 _,←L,' Grid.Column="0"'
210 _,←L,' Grid.Row="1"'
211 _,←L,' Margin="10,10,10,10"'
212 _,←L,' Fill="Aqua"/>'
213 _,←L,' <Rectangle'
214 _,←L,' Grid.Column="1"'
215 _,←L,' Grid.Row="1"'
216 _,←L,' Margin="10,10,10,10"'
217 _,←L,' Fill="Aqua"/>'
218 _,←L,' </Grid>'
219 _,←L,' </DockPanel>'
220 _,←L,'</Window>'
221 sample3←_
222
223 ⎕ex¨ 'L' '_'
224
225 ⍝ === End of variables definition ===
226
227 (⎕IO ⎕ML ⎕WX)←1 3 3
228
229 ∇ cursor←CursorFromBase64String base64String;imageBytes;MS;⎕USING
230 ⍝ Convert a Base64String to a cursor.
231
232 ⎕USING←'System.IO,mscorlib.dll' 'System,mscorlib.dll' 'System.Windows,WPF/PresentationCore.dll'
233
234 ⍝ Convert Base64 String to byte[]
235 imageBytes←Convert.FromBase64String(⊂base64String)
236
237 ⍝ Create a new MemoryStream with the byte[]
238 MS←⎕NEW MemoryStream(⊂imageBytes)
239
240 ⍝ Create the icon
241 cursor←⎕NEW Input.Cursor MS
242
243 ⍝ Erase the MemoryStream
244 MS.Close ⋄ MS.Dispose ⋄ MS←⎕NULL
245 ∇
246
247 ∇ DemoSample3;imgNames
248
249 ⍝ Parse the xaml of the variable sample3
250 win←FixSimpleXaml sample3
251
252 ⍝ Get the names of all the 'Image' object that has been fixed in rootObj
253 imgNames←{((⊂'Image')≡¨(⍵.⍎¨(⍵.⎕NL-9)).GetType.Name)/(⍵.⎕NL-9)}win
254
255 ⍝ Set the Source of all the 'Image'. Each 'Image' must have a Base64 variable of the same name.
256 win{(⍺.⍎⍵).Source←ImageFromBase64String⍎⍵}¨imgNames
257
258 ⍝ Fix manually the Icon of the main window.
259 win.Icon←ImageFromBase64String Settings_b64
260
261 ⍝ Fix manually the Cursor of the main window.
262 win.Cursor←CursorFromBase64String HandCursor_b64
263
264 ⍝ Set Routed Events on the whole Window for ClickEvent when a MenuItem or a Button are clicked.
265 ⎕USING←'System.Windows,WPF/PresentationCore.dll' 'System.Windows.Controls.Primitives,WPF/PresentationFramework.dll'
266 win.AddHandler(Controls.MenuItem.ClickEvent)(⎕NEW RoutedEventHandler(⎕OR'__EventHandler'))
267 win.AddHandler(ButtonBase.ClickEvent)(⎕NEW RoutedEventHandler(⎕OR'__EventHandler'))
268
269 ⍝ Show the window.
270 win.Show
271 ∇
272
273 ∇ base64String←FileToBase64String fileName;bytes;⎕USING
274 ⍝ Converts a file to a Base64 String.
275
276 ⎕USING←'System,mscorlib.dll'
277
278 ⍝ Read the file
279 bytes←IO.File.ReadAllBytes(⊂,fileName)
280
281 ⍝ Convert to a Base64 string
282 base64String←Convert.ToBase64String(⊂bytes)
283 ∇
284
285 ∇ rootObj←FixSimpleXaml xamlString;names;⎕USING
286 ⍝ Parse simple and correctly formed Xaml that contains only names to fix (no events).
287 ⍝ Each named element(s) object will be attached to rootObject.
288 ⍝ You can see the list of attached elements by doing rootObject.⎕NL -9
289 ⍝ It is recommended to do not name the root object in the xaml (to prevent a recursive call).
290 ⍝ For 3rd party dll, ⎕USING must be properly initiated before calling this function.
291 ⍝ For Xaml with event callbacks and error trapping see the function: FixXaml.
292 ⍝
293 ⍝ xamlString = Vector of Characters representing a XAML string
294 ⍝ rootObj = WPF Root Element Object if no error
295 ⍝ = ⎕NULL if error
296
297 :Trap 0
298
299 ⍝ Parse the simple Xaml and obtain the root element object:
300 ⎕USING←'System.Windows.Markup,WPF/PresentationFramework.dll'
301 rootObj←XamlReader.Parse(⊂xamlString)
302
303 ⍝ Extract the names beginning with 'x:Name' or 'Name'
304 names←{{(,⊃0≠⍴¨⍵)/⍵}{1⊃(((⍵[;1]∊⊂'x:Name')∨(⍵[;1]∊⊂'Name'))/⍵[;2]),⊂''}¨(⎕XML ⍵)[;4]}xamlString
305
306 ⍝ Assign the value of each names to the root object:
307 :If 0≠⍴names
308 rootObj{⍎'⍺.',⍵,'←⍺.FindName(⊂,⍵)'}¨names
309 :Else
310 ⍝ Do nothing, there is no names.
311 :End
312
313 :Else
314 ⍝ There is an error.
315 rootObj←⎕NULL
316
317 :EndTrap
318 ∇
319
320 ∇ rootObj←FixXaml xamlString;attribs;caller;data;err;event;events;expr;inter;name;names;ref;⎕USING
321 ⍝ Creates a WPF Object From an APL Character Vector Representing XAML.
322 ⍝ Each named element(s) object will be attached to rootObject.
323 ⍝ You can see the list of attached elements by doing rootObject.⎕NL -9
324 ⍝ The callback functions of events must begin with '__' (ex.: Click="__Button_Click")
325 ⍝ For 3rd party dll, ⎕USING must be properly initiated before calling this function.
326 ⍝ If there is an error parsing the Xaml, the function will return ⎕NULL with an explanation of the error.
327 ⍝ Parts of code is taken from Dyalog.
328 ⍝
329 ⍝ xamlString = Vector of Characters representing a XAML string
330 ⍝ rootObj = WPF Root Element Object if no error
331 ⍝ = ⎕NULL (explanation of error) if error
332 ⍝
333 ⍝ If an Element has an event attribute that begins with '__' and is named, it will be fixed.
334 ⍝ If an Element has an event attribute that begins with '__' and is not named, it will not be fixed and make a warning.
335 ⍝ If an Element has an event attribute that does not begins with '__', it will make an error and return a ⎕NULL rootObj.
336 ⍝ Function of an event attribute must be defined in the WS otherwise it will not be fixed and make a warning.
337 ⍝ Root element with an event must be named, otherwise it is recommended to be nameless.
338 ⍝ Root element name is removed in all cases. Use the rootObj variable directly to access its properties/methods.
339
340 :Trap 0
341 ⍝ Check if Valid XML
342 ⍝ The following line will bug with an explanation if there is a syntax error in xamlString.
343 ⎕USING←'System.Xml,System.Xml.dll'
344 (⎕NEW XmlDocument).LoadXml(⊂xamlString)
345
346 ⍝ The string is valid XML. Clean-it before 'compiling'.
347 data←⎕XML xamlString ⍝ Convert the characters to APL representation of Xml
348 attribs←data[;4] ⍝ Attributes of all the nodes
349 names←{1⊃(((⍵[;1]∊⊂'x:Name')∨(⍵[;1]∊⊂'Name'))/⍵[;2]),⊂''}¨attribs ⍝ Find all 'x:Name' and 'Name' attributes
350 events←⊃⍪/names{(⊂⍺),((⊂'__')≡¨2↑¨⊃¨⍵[;2])⌿⍵}¨attribs ⍝ Events are all attributes with values beginning with '__'
351 data[;4]←{(~(⊂'__')≡¨2↑¨⊃¨⍵[;2])⌿⍵}¨attribs ⍝ Remove the events: attribute definition beginning with '__'
352 data[1;4]←⊂{(~(⊂'x:Class')≡¨7↑¨⊃¨⍵[;1])⌿⍵}⊃data[1;4] ⍝ Remove the x:Class attribute if present in first node
353 xamlString←⎕XML data ⍝ Convert the APL representation of Xml to characters
354 :Else
355 ⍝ There is an Error. Exit.
356 →ERROR
357
358 :EndTrap
359
360 ⍝ Obtain the Root Element Object of the clean-up XAML String.
361 ⍝ You can get an error here if, for example, there is an event that does not begin with '__' and was not remove in Xaml Clean-up.
362 :Trap 0
363 ⎕USING←'System.Windows.Markup,WPF/PresentationFramework.dll'
364 rootObj←XamlReader.Parse(⊂xamlString)
365
366 ⍝ ↓↓↓ Alternative way of doing the same thing.
367 ⍝ ⎕USING ← '' 'System.IO' 'System.Xml,system.xml.dll' 'System.Windows,WPF/PresentationFramework.dll' 'System.Windows.Markup'
368 ⍝ rootObj ← XamlReader.Load ⎕NEW XmlTextReader (⎕NEW StringReader (⊂xamlString))
369
370 rootObj.∆Events←events ⍝ Optional: List the events in the property ∆Events
371 :Else
372 ⍝ There is an error. Exit.
373 →ERROR
374
375 :EndTrap
376
377 ⍝ Fix the events of the rootObj before removing its name:
378 ⍝ Will bug if the rootObj does not have a name.
379 :Trap 0
380 :If 1∊events[;1]∊⊂rootObj.Name ⍝ Check if the rootObj has an event
381 :For (ref event expr) :In ↓(events[;1]∊⊂rootObj.Name)⌿events ⍝ Loop through the events
382 caller←(1⊃⎕NSI),'.' ⍝ Namespace that is calling this function
383 expr←((~'#'∊expr)/caller),expr ⍝ Add the namespace of the caller to the name of the event
384 ⍎'rootObj.on',event,'←''',expr,'''' ⍝ Hook-up the event
385 :EndFor
386 :EndIf
387 :Else
388 ⍝ Do nothing. rootObj does not have a name or events to fix.
389
390 :EndTrap
391
392 ⍝ Create refs to all named child objects
393 :Trap 0
394 names←(,⊃0≠⍴¨names)/names ⍝ Keep only the not empty names
395 names←(0=rootObj.⎕NC↑names)/names ⍝ Only names which do not already have a meaning
396 names←(~names∊⊂rootObj.Name)/names ⍝ Remove the name of the rootObj to prevent a recursive entry.
397 events←(~events[;1]∊⊂rootObj.Name)⌿events ⍝ Remove the event(s) of the rootObj from the list now that they have been fixed.
398 :Else
399 ⍝ Do nothing. The previous 2 lines will bug if rootObj does not have a name.
400
401 :EndTrap
402
403 ⍝ Add a reference of all the named object to the rootObj.
404 ⍝ FindName will not find the names on certain object (like template),
405 ⍝ so we need to iterate and Trap the error when the name is not found.
406 :For name :In names
407 :Trap 0
408 ⍎'rootObj.(',name,')←rootObj.FindName ⊂name'
409
410 :Else
411 ⎕←'FixXaml Warning - Name Not found: ',name
412
413 :EndTrap
414 :EndFor
415
416 ⍝ Show a Warning for Events that begins with '__' that will not be fixed because they are nameless:
417 :If 0≠↑⍴inter←(~events[;1]∊names)⌿events
418 ⎕←(⎕UCS 13),'FixXaml Warning - Following Nameless Event(s) Are Not Fixed:'
419 ⎕←inter
420 :End
421
422 ⍝ Hook-up events
423 events←(events[;1]∊names)⌿events ⍝ Named objects only
424 caller←(1⊃⎕NSI),'.' ⍝ Namespace that is calling this function
425
426 :For (ref event expr) :In ↓events
427 :Trap 0
428 ⍝ Add the namespace of the caller to the name of the event
429 expr←((~'#'∊expr)/caller),expr
430
431 :If 0≠⎕NC expr
432 ⍝ Callback function exist. Hook-up the event.
433 ⍎'rootObj.',ref,'.on',event,'←''',expr,''''
434 :Else
435 ⍝ Callback function does not exist. Show warning and do not fix the event.
436 ⎕←'FixXaml Warning - Function ',expr,' does not exist. The Event ''',event,''' of ''',ref,''' is not fixed.'
437 :End
438
439 :Else
440 ⍝ There is an error. Exit.
441 →ERROR
442
443 :EndTrap
444 :EndFor
445
446 →0 ⍝ rootObj is returned here if there is no error.
447
448 ERROR:
449 ⍝ Build the Error Message
450 :If 90≠⎕EN
451 ⍝ APL Error
452 err←(1⊃⎕DM),': ',{(' '=1↑⍵)↓((1↓a,0)∨a←' '≠⍵)/⍵}(2⊃⎕DM),(⎕UCS 13)
453
454 :Else
455 ⍝ .Net Error
456 :Trap 0
457 ⍝ Show the value of ⎕EXCEPTION.Message if not ⎕NULL.
458 err←('EXCEPTION: ',⎕EXCEPTION.Message),(⎕UCS 13)
459 :Else
460 ⍝ Sometimes ⎕EXCEPTION is (NULL) and will bug here.
461 err←'Exception (NULL): Unknown error',(⎕UCS 13)
462
463 :EndTrap
464
465 :End
466
467 rootObj←⎕NULL err
468 ∇
469
470 ∇ winParent←GetWindowParent object
471 ⍝ Obtain the Windows Parent (Root Object) of a children's element.
472
473 winParent←object
474
475 :While 'System.Windows.Window'≢winParent.GetType.ToString
476 winParent←winParent.Parent
477 :EndWhile
478 ∇
479
480 ∇ bmpimg←ImageFromBase64String base64String;imageBytes;MS;⎕USING
481 ⍝ Convert a Base64String to a System.Windows.Media.Imaging.WriteableBitmap
482
483 ⎕USING←'System.IO,mscorlib.dll' 'System,mscorlib.dll' 'System.Windows.Media.Imaging,WPF/PresentationCore.dll'
484
485 ⍝ Convert Base64 String to byte[] as numbers.
486 imageBytes←Convert.FromBase64String(⊂base64String)
487
488 ⍝ Create a new MemoryStream with the byte[]
489 MS←⎕NEW MemoryStream(⊂imageBytes)
490
491 ⍝ Create a BitmapImage Object from the Memory Stream
492 bmpimg←⎕NEW BitmapImage
493 bmpimg.BeginInit
494 bmpimg.StreamSource←MS
495 bmpimg.EndInit
496
497 ⍝ Create a WriteableBitmap that does not need the MemoryStream to persist
498 ⍝ That way it is possible to erase the MemoryStream after creating the Image
499 bmpimg←⎕NEW WriteableBitmap bmpimg
500
501 ⍝ Erase the MemoryStream
502 MS.Close ⋄ MS.Dispose ⋄ MS←⎕NULL
503 ∇
504
505 ∇ __Button_Click(sender event);rootObject;⎕USING
506 ⍝ Click Event Handler for the Button
507
508 ⍝ Get the Root Object from the Button object (sender)
509 rootObject←GetWindowParent sender
510
511 ⍝ Assign the new text to the TextBox.
512 rootObject.textBox1.Text←'I Was Clicked !'
513
514 ⍝ Change some colors of the TextBox
515 ⎕USING←'System.Windows.Media,WPF/PresentationCore.dll' 'System.Windows,WPF/PresentationFramework.dll'
516 rootObject.textBox1.Background←⎕NEW SolidColorBrush(Colors.Yellow)
517 rootObject.textBox1.BorderBrush←⎕NEW SolidColorBrush(Colors.Red)
518 rootObject.textBox1.BorderThickness←⎕NEW Thickness 3
519 ∇
520
521 ∇ rootObj←ScrubAndFix xamlString;err;names;nodeNumber;reader;stringReader;writer;⎕USING
522 ⍝ Function to remove the Class and Events elements of Xaml and fix the resulting Xaml.
523 ⍝ Each named element(s) object will be attached to rootObject.
524 ⍝ Root element name is removed in all cases. Use the rootObj directly to access its properties/methods.
525 ⍝ This function is most usefull when experimenting with Xaml taken directly from the Web but is slower than FixXaml.
526 ⍝ Inspired from the code of XAMLPAD2009.
527 ⍝
528 ⍝ XamlString = Vector of Characters representing a XAML string
529 ⍝ rootObj = WPF Root Element Object if no error
530 ⍝ = ⎕NULL (explanation of error) if error
531
532 :Trap 0
533
534 ⎕USING←'System.IO' 'System.Windows.Markup,WPF/PresentationFramework.dll' 'System.Xaml,System.Xaml.dll'
535 stringReader←⎕NEW StringReader(⊂xamlString)
536 reader←⎕NEW XamlXmlReader(stringReader XamlReader.GetWpfSchemaContext)
537 writer←⎕NEW XamlObjectWriter(reader.SchemaContext)
538
539 ⎕USING←0⍴⊂''
540 names←'' ⍝ Initial value of the names to fix.
541 nodeNumber←0 ⍝ Initial value of the node number.
542
543 :While reader.Read
544
545 :If 'StartObject'≡⍕reader.NodeType
546 ⍝ Will increment of 1 each time a new node (with a new object) begins.
547 nodeNumber+←1
548 :End
549
550 :If 'StartMember'≡⍕reader.NodeType
551 :AndIf reader.Member.Name≡'Class'
552 {}reader.Read
553 {}reader.Read
554
555 :ElseIf 'StartMember'≡⍕reader.NodeType
556 :AndIf reader.Member.IsEvent
557 {}reader.Read
558 {}reader.Read
559
560 :ElseIf 'StartMember'≡⍕reader.NodeType
561 :AndIf reader.Member.Name≡'Name'
562 writer.WriteNode(reader)
563 {}reader.Read
564 writer.WriteNode(reader)
565
566 ⍝ Check if reader is on first node
567 :If 1≠nodeNumber
568 ⍝ reader is not on first node. Keep the name.
569 names,←⊂reader.Value
570 :Else
571 ⍝ reader is on first node. Don't keep the name.
572 :End
573
574 {}reader.Read
575 writer.WriteNode(reader)
576
577 :Else
578 writer.WriteNode(reader)
579
580 :End
581
582 :EndWhile
583
584 rootObj←writer.Result
585
586 ⍝ Assign the value of each names found to the root object:
587 :If 0≠⍴names
588 rootObj{⍎'⍺.',⍵,'←⍺.FindName(⊂,⍵)'}¨names
589 :Else
590 ⍝ Do nothing, there is no names.
591 :End
592
593 :Else
594 ⍝ Build the Error Message
595 :If 90≠⎕EN
596 ⍝ APL Error
597 err←(1⊃⎕DM),': ',{(' '=1↑⍵)↓((1↓a,0)∨a←' '≠⍵)/⍵}(2⊃⎕DM),(⎕UCS 13)
598
599 :Else
600 ⍝ .Net Error
601 :Trap 0
602 ⍝ Show the value of ⎕EXCEPTION.Message if not ⎕NULL.
603 err←('EXCEPTION: ',⎕EXCEPTION.Message),(⎕UCS 13)
604 :Else
605 ⍝ Sometimes ⎕EXCEPTION is (NULL) and will bug here.
606 err←'Exception (NULL): Unknown error',(⎕UCS 13)
607
608 :EndTrap
609
610 :End
611
612 rootObj←⎕NULL err
613
614 :EndTrap
615 ∇
616
617 ∇ __EventHandler(sender event);name
618 ⍝ Single Event Handler for the Window
619
620 ⍝ Get name of the control that was clicked
621 name←event.Source.Name
622
623 ⍝ sender is the Root Object in this case because
624 ⍝ the routed event was attached to it.
625 sender.lStatusBar.Content←'I Was Clicked: ',name
626
627 ⍝ Select the code to be executed:
628 :Select name
629 :Case 'mnuCut'
630
631 :Case 'mnuCopy'
632
633 :Case 'mnuPaste'
634
635 :Case 'mnuPrint'
636
637 :Case 'mnuQuit'
638
639 :Case 'mnuAbout'
640
641 :Case 'btnButton1'
642
643 :Case 'btnButton2'
644
645 :Case 'btnButton3'
646
647 :Else
648 'Error: Unknow Name'
649 :EndSelect
650 ∇
651
652 :EndNamespace
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.