コード例 #1
0
        public MethodTrack(IServiceProvider sp)
        {
            _serviceProvider  = sp;
            _dataService      = sp.GetService(typeof(SSrcMLDataService)) as ISrcMLDataService;
            _srcmlService     = sp.GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService;
            _cursorMonitor    = sp.GetService(typeof(SCursorMonitorService)) as ICursorMonitorService;
            _currentMethod    = new Method();
            _navigatedMethods = new List <Method>();
            _currentCursor    = new CursorPos("", 0, 0);

            if (null != _cursorMonitor)
            {
                _cursorMonitor.PropertyChanged += OnCursorMoving;
            }
            if (null != _srcmlService)
            {
                _srcmlService.SourceFileChanged += OnFileChanged;
            }
        }
コード例 #2
0
        internal static bool WaitForServiceToFinish(ISrcMLDataService service, int millisecondsTimeout)
        {
            AutoResetEvent monitoringStartedResetEvent = new AutoResetEvent(false),
                           updateStartedResetEvent     = new AutoResetEvent(false),
                           updateCompletedResetEvent   = new AutoResetEvent(false);

            EventHandler monitoringStartedEventHandler = GetEventHandler(monitoringStartedResetEvent),
                         updateStartedEventHandler     = GetEventHandler(updateStartedResetEvent),
                         updateCompleteEventHandler    = GetEventHandler(updateCompletedResetEvent);

            service.MonitoringStarted += monitoringStartedEventHandler;
            service.UpdateStarted     += updateStartedEventHandler;
            service.UpdateCompleted   += updateCompleteEventHandler;

            Assert.IsTrue(updateStartedResetEvent.WaitOne(millisecondsTimeout));
            Assert.IsTrue(monitoringStartedResetEvent.WaitOne(millisecondsTimeout));
            Assert.IsTrue(updateCompletedResetEvent.WaitOne(millisecondsTimeout));

            service.MonitoringStarted -= monitoringStartedEventHandler;
            service.UpdateStarted     -= updateStartedEventHandler;
            service.UpdateCompleted   -= updateCompleteEventHandler;

            return(!service.IsUpdating);
        }
コード例 #3
0
ファイル: TestHelpers.cs プロジェクト: akondrahman/SrcML.NET
        internal static bool WaitForServiceToFinish(ISrcMLDataService service, int millisecondsTimeout)
        {
            AutoResetEvent monitoringStartedResetEvent = new AutoResetEvent(false),
                           updateStartedResetEvent = new AutoResetEvent(false),
                           updateCompletedResetEvent = new AutoResetEvent(false);

            EventHandler monitoringStartedEventHandler = GetEventHandler(monitoringStartedResetEvent),
                         updateStartedEventHandler = GetEventHandler(updateStartedResetEvent),
                         updateCompleteEventHandler = GetEventHandler(updateCompletedResetEvent);

            service.MonitoringStarted += monitoringStartedEventHandler;
            service.UpdateStarted += updateStartedEventHandler;
            service.UpdateCompleted += updateCompleteEventHandler;
            
            Assert.IsTrue(updateStartedResetEvent.WaitOne(millisecondsTimeout));
            Assert.IsTrue(monitoringStartedResetEvent.WaitOne(millisecondsTimeout));
            Assert.IsTrue(updateCompletedResetEvent.WaitOne(millisecondsTimeout));

            service.MonitoringStarted -= monitoringStartedEventHandler;
            service.UpdateStarted -= updateStartedEventHandler;
            service.UpdateCompleted -= updateCompleteEventHandler;

            return !service.IsUpdating;
        }
コード例 #4
0
ファイル: MethodTrack.cs プロジェクト: akondrahman/SrcML.NET
 public MethodTrack(IServiceProvider sp)
 {
     _serviceProvider = sp;
     _dataService = sp.GetService(typeof(SSrcMLDataService)) as ISrcMLDataService;
     _srcmlService = sp.GetService(typeof(SSrcMLGlobalService)) as ISrcMLGlobalService;
     _cursorMonitor = sp.GetService(typeof(SCursorMonitorService)) as ICursorMonitorService;
     _currentMethod = new Method();
     _navigatedMethods = new List<Method>();
     _currentCursor = new CursorPos("", 0, 0);
    
     if (null != _cursorMonitor)
         _cursorMonitor.PropertyChanged += OnCursorMoving;
     if(null != _srcmlService)
          _srcmlService.SourceFileChanged += OnFileChanged;
  }