PageRenderTime 36ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/Tools/ABB.SrcML.Tools.ArchiveUpdater/MainWindow.xaml.cs

https://github.com/nkcsgexi/SrcML.NET
C# | 56 lines | 46 code | 6 blank | 4 comment | 1 complexity | d702f8ccc23130b56973a2b91f6bf2fd MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Data;
  8. using System.Windows.Documents;
  9. using System.Windows.Input;
  10. using System.Windows.Media;
  11. using System.Windows.Media.Imaging;
  12. using System.Windows.Navigation;
  13. using System.Windows.Shapes;
  14. using ABB.SrcML;
  15. using FSPath = System.IO.Path;
  16. namespace ABB.SrcML.Tools.ArchiveUpdater
  17. {
  18. /// <summary>
  19. /// Interaction logic for MainWindow.xaml
  20. /// </summary>
  21. public partial class MainWindow : Window
  22. {
  23. private SrcMLArchive _archive;
  24. private FileSystemFolderMonitor _monitor;
  25. public MainWindow()
  26. {
  27. var archivePath = FSPath.Combine(".", "ARCHIVE");
  28. _monitor = new FileSystemFolderMonitor(".", archivePath, new LastModifiedArchive(archivePath), new SrcMLArchive(archivePath));
  29. _monitor.FileChanged += _archive_SourceFileChanged;
  30. _monitor.StartMonitoring();
  31. InitializeComponent();
  32. }
  33. void _archive_SourceFileChanged(object sender, FileEventRaisedArgs e)
  34. {
  35. textBox1.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal,
  36. new Action(() =>
  37. {
  38. ////if (SourceEventType.Renamed == e.EventType)
  39. string srcMLAvailableText = (e.HasSrcML ? "(SrcML Available)" : String.Empty);
  40. if (FileEventType.FileRenamed== e.EventType)
  41. textBox1.AppendText(String.Format("{0} {1} to {2}\n", e.EventType, e.OldFilePath, e.FilePath, srcMLAvailableText));
  42. else
  43. textBox1.AppendText(String.Format("{0} {1} {2}\n", e.EventType, e.FilePath, srcMLAvailableText));
  44. }));
  45. }
  46. private void Window_Closing_1(object sender, System.ComponentModel.CancelEventArgs e) {
  47. _monitor.Dispose();
  48. }
  49. }
  50. }