@@ -481,9 +481,9 @@ private void Window_Loaded(object sender, RoutedEventArgs e) {
481481
482482 private void AnalyzeSql ( object sender , RoutedEventArgs e ) {
483483
484- if ( string . IsNullOrWhiteSpace ( sqlSource ) ) {
485- return ;
486- }
484+ // if (string.IsNullOrWhiteSpace(sqlSource)) {
485+ // return;
486+ // }
487487
488488 try {
489489 Mouse . OverrideCursor = Cursors . Wait ;
@@ -585,7 +585,10 @@ private void ClearEditor(object sender, RoutedEventArgs e) {
585585 }
586586
587587 private void CopyFromEditor ( object sender , RoutedEventArgs e ) {
588- Copy ( sqlSource ) ;
588+
589+ FlowDocument document = SQLSourceEditor . Document ;
590+ string source = new TextRange ( document . ContentStart , document . ContentEnd ) . Text ;
591+ Copy ( source ) ;
589592 }
590593
591594 private void CopyMicrosoftTSQL ( object sender , RoutedEventArgs e ) {
@@ -1006,7 +1009,7 @@ private void FillParserQueryParametersFromList() {
10061009 /// </summary>
10071010 /// <param name="text"></param>
10081011 private void Copy ( string text ) {
1009- Clipboard . SetText ( sqlSource ) ;
1012+ Clipboard . SetText ( text ) ;
10101013 Message = "query copied" ;
10111014 }
10121015
@@ -1015,6 +1018,11 @@ private void Copy(string text) {
10151018 /// </summary>
10161019 /// <param name="document"></param>
10171020 private void Copy ( FlowDocument document ) {
1021+
1022+ if ( document == null ) {
1023+ document = new FlowDocument ( ) ;
1024+ }
1025+
10181026 TextRange range = new TextRange ( document . ContentStart , document . ContentEnd ) ;
10191027
10201028 using ( Stream stream = new MemoryStream ( ) ) {
@@ -1024,9 +1032,8 @@ private void Copy(FlowDocument document) {
10241032 Message = "query copied" ;
10251033 }
10261034
1027-
10281035 #endregion
10291036
1030-
1037+
10311038 }
10321039}
0 commit comments