@@ -33,10 +33,7 @@ public partial class MainWindow : Window
3333 private bool hasChanged = true ;
3434 private bool isLoading = false ;
3535 private string oldText = null ;
36-
3736 private bool isShowingExamples ;
38- private Point startPos ;
39- System . Windows . Forms . Screen [ ] screens = System . Windows . Forms . Screen . AllScreens ;
4037
4138 public MainWindow ( )
4239 {
@@ -78,121 +75,6 @@ public MainWindow()
7875 BuildExample ( Serializer . GetExamples ( ) ) ;
7976 }
8077
81- private void InputArea_Loaded ( object sender , RoutedEventArgs e )
82- {
83- throw new NotImplementedException ( ) ;
84- }
85-
86- private void Window_LocationChanged ( object sender , EventArgs e )
87- {
88- int sum = 0 ;
89- foreach ( var item in screens )
90- {
91- sum += item . WorkingArea . Width ;
92- if ( sum >= this . Left + this . Width / 2 )
93- {
94- this . MaxHeight = item . WorkingArea . Height + 7 ;
95- break ;
96- }
97- }
98- }
99-
100- private void System_MouseDown ( object sender , MouseButtonEventArgs e )
101- {
102- if ( e . ChangedButton == MouseButton . Left )
103- {
104- if ( e . ClickCount >= 2 )
105- {
106- this . WindowState = ( this . WindowState == WindowState . Normal ) ? WindowState . Maximized : WindowState . Normal ;
107- }
108- else
109- {
110- startPos = e . GetPosition ( null ) ;
111- }
112- }
113- else if ( e . ChangedButton == MouseButton . Right )
114- {
115- var pos = PointToScreen ( e . GetPosition ( this ) ) ;
116- IntPtr hWnd = new System . Windows . Interop . WindowInteropHelper ( this ) . Handle ;
117- IntPtr hMenu = GetSystemMenu ( hWnd , false ) ;
118- int cmd = TrackPopupMenu ( hMenu , 0x100 , ( int ) pos . X , ( int ) pos . Y , 0 , hWnd , IntPtr . Zero ) ;
119- if ( cmd > 0 ) SendMessage ( hWnd , 0x112 , ( IntPtr ) cmd , IntPtr . Zero ) ;
120- }
121- }
122-
123- [ DllImport ( "user32.dll" ) ]
124- static extern IntPtr SendMessage ( IntPtr hWnd , int msg , IntPtr wp , IntPtr lp ) ;
125- [ DllImport ( "user32.dll" ) ]
126- static extern IntPtr GetSystemMenu ( IntPtr hWnd , bool bRevert ) ;
127- [ DllImport ( "user32.dll" ) ]
128- static extern int TrackPopupMenu ( IntPtr hMenu , uint uFlags , int x , int y , int nReserved , IntPtr hWnd , IntPtr prcRect ) ;
129-
130- private void System_MouseMove ( object sender , MouseEventArgs e )
131- {
132- if ( e . LeftButton == MouseButtonState . Pressed )
133- {
134- if ( this . WindowState == WindowState . Maximized && Math . Abs ( startPos . Y - e . GetPosition ( null ) . Y ) > 2 )
135- {
136- var point = PointToScreen ( e . GetPosition ( null ) ) ;
137-
138- this . WindowState = WindowState . Normal ;
139-
140- this . Left = point . X - this . ActualWidth / 2 ;
141- this . Top = point . Y - border . ActualHeight / 2 ;
142- }
143- DragMove ( ) ;
144- }
145- }
146-
147- private void Maximize_Click ( object sender , RoutedEventArgs e )
148- {
149- this . WindowState = ( this . WindowState == WindowState . Normal ) ? WindowState . Maximized : WindowState . Normal ;
150- }
151-
152- private void Close_Click ( object sender , RoutedEventArgs e )
153- {
154- if ( ! settings . AskBeforeClosing )
155- {
156- this . Close ( ) ;
157- return ;
158- }
159-
160- if ( string . IsNullOrEmpty ( InputArea . Text ) || InputArea . Text . Trim ( ) == "Enter your code here ..." )
161- {
162- this . Close ( ) ;
163- return ;
164- }
165-
166- MessageBoxResult result = MessageBox . Show ( "Do you want to close this window? Any text you entered will be lost." , "Are you sure?" , MessageBoxButton . YesNo ) ;
167- if ( result == MessageBoxResult . Yes )
168- {
169- this . Close ( ) ;
170- }
171- }
172-
173- private void Mimimize_Click ( object sender , RoutedEventArgs e )
174- {
175- this . WindowState = WindowState . Minimized ;
176- }
177-
178- private void Window_StateChanged ( object sender , EventArgs e )
179- {
180- if ( this . WindowState == WindowState . Maximized )
181- {
182- main . BorderThickness = new Thickness ( 0 ) ;
183- main . Margin = new Thickness ( 7 , 7 , 7 , 0 ) ;
184- rectMax . Visibility = Visibility . Hidden ;
185- rectMin . Visibility = Visibility . Visible ;
186- }
187- else
188- {
189- main . BorderThickness = new Thickness ( 1 ) ;
190- main . Margin = new Thickness ( 0 ) ;
191- rectMax . Visibility = Visibility . Visible ;
192- rectMin . Visibility = Visibility . Hidden ;
193- }
194- }
195-
19678 private void SeeExamplesButtonPressed ( object sender , EventArgs e )
19779 {
19880 isShowingExamples = ! isShowingExamples ;
@@ -296,14 +178,7 @@ private string GetFullPath(string path)
296178
297179 private async Task Compile ( string templateContent )
298180 {
299-
300- var engine = new RazorLightEngineBuilder ( )
301- // required to have a default RazorLightProject type,
302- // but not required to create a template from string.
303- . UseEmbeddedResourcesProject ( typeof ( Window ) )
304- . UseMemoryCachingProvider ( )
305- . Build ( ) ;
306-
181+ var engine = GCodeRazor . EngineBuilder . Builder . GetBuilder ( ) ;
307182
308183 bool isError = false ;
309184 string result = string . Empty ;
0 commit comments