public CheckTablesInManagerDbTimer(string connectionString,double interval = 5000)
		{
			ManagerDbRepository = new ManagerDbRepository(connectionString);

			JobQueueTimer = new Timer(interval);
			JobQueueTimer.Elapsed += JobQueueTimer_Elapsed;

			JobTimer = new Timer(interval);
			JobTimer.Elapsed += JobTimer_Elapsed;

			JobDetailTimer = new Timer(interval);
			JobDetailTimer.Elapsed += JobDetailTimer_Elapsed;

			LoggingTimer = new Timer(interval);
			LoggingTimer.Elapsed += LoggingTimerOnElapsed;

			WorkerNodeTimer = new Timer(interval);
			WorkerNodeTimer.Elapsed += WorkerNodeTimerOnElapsed;
		}
示例#2
0
		public MainWindowViewModel()
		{
			ManagerDbConnectionString =
				ConfigurationManager.ConnectionStrings["ManagerConnectionString"].ConnectionString;

			ManagerDbRepository =
				new ManagerDbRepository(ManagerDbConnectionString);

			//---------------------------------------
			// Set up Fiddler.
			//---------------------------------------
			FiddlerCaptureUrlConfiguration = new FiddlerCaptureUrlConfiguration();

			FiddlerCapture = new FiddlerCapture(FiddlerCaptureUrlConfiguration);

			FiddlerCapture.NewDataCapturedEventHandler += NewDataCapturedEventHandler;

			StartFiddlerCaptureCommand = new StartFiddlerCaptureCommand(FiddlerCapture);

			StopFiddlerCaptureCommand = new StopFiddlerCaptureCommand(FiddlerCapture);

			FiddlerCaptureInformation = new ObservableCollection<FiddlerCaptureInformation>();

			InstallCertificateCommand = new InstallCertificateCommand();

			UnInstallCertificateCommand = new UnInstallCertificateCommand();

			//---------------------------------------
			// Manager console host.
			//---------------------------------------
			StartHostCommand = new StartHostCommand(this);
			ShutDownHostCommand = new ShutDownHostCommand(this);

			NumberOfManagers = Settings.Default.NumberOfManagers;
			NumberOfNodes = Settings.Default.NumberOfNodes;

			IsConsoleHostStarted = false;

			//---------------------------------------
			// Do the rest.
			//---------------------------------------
			GetData();

			ClearLoggingTableInDatabaseCommand = new ClearLoggingTableInDatabaseCommand(this);

			ClearManagerTablesInDatabaseCommand = new ClearManagerTablesInDatabaseCommand(this);

			ToggleRefreshCommand = new ToggleRefreshCommand(this);

			CreateNewJobCommand = new CreateNewJobCommand();
			Create20NewJobCommand = new CreateNewJobCommand(20);

			StartUpNewManagerCommand = new StartUpNewManagerCommand();
			StartUpNewNodeCommand = new StartUpNewNodeCommand();

			StartDurationTestCommand = new StartDurationTestCommand(this);
			CancelDurationTestCommand = new CancelDurationTestCommand(this);

			RefreshTimer = new Timer(5000);

			RefreshTimer.Elapsed += RefreshTimerOnElapsed;

			RefreshTimer.Start();

			RefreshEnabled = true;

			CheckManagerDbTimer = new Timer(2000);
			CheckManagerDbTimer.Elapsed += CheckManagerDbTimer_Elapsed;
		}
示例#3
0
		public void ClearAllManagerTablesInDatabase()
		{
			Task.Factory.StartNew(() =>
			{
				var managerDbRepository =
					new ManagerDbRepository(ManagerDbConnectionString);

				managerDbRepository.TruncateJobDetailTable();
				managerDbRepository.TruncateJobTable();
				managerDbRepository.TruncateJobQueueTable();
				managerDbRepository.TruncateWorkerNodeTable();

				GetData();
			});
		}