public void EventRepopulate(EventMonitor eventMonitor)
        {
            eventLogTest = EventLog.GetEventLogs(eventMonitor.Server);
            eventMonitorEventsLogTypeDdlWaitLabel.Visible = false;
            eventMonitorEventsLogTypeDdl.Visible = true;
            eventMonitorEventsLogTypeDdlErrorLabel.Text = String.Empty;

            eventMonitorEventsLogTypeDdl.Items.Clear();
            foreach (EventLog el in eventLogTest)
            {
                eventMonitorEventsLogTypeDdl.Items.Add(el.Log);
            }
            alreadyPopulated = true;

            eventMonitorClearLogCb.Checked = eventMonitor.ClearOldLogs;
            eventMonitorSourceFilterTextBox.Text = eventMonitor.EventNameMatch;
            entryType = eventMonitor.EventType;
            eventMonitorEntryTypeFilterCbError.Checked = (eventMonitor.EventType & EventLogEntryType.Error) == EventLogEntryType.Error;
            eventMonitorEntryTypeFilterCbWarning.Checked = (eventMonitor.EventType & EventLogEntryType.Warning) == EventLogEntryType.Warning;
            eventMonitorEntryTypeFilterCbInformation.Checked = (eventMonitor.EventType & EventLogEntryType.Information) == EventLogEntryType.Information;
            eventMonitorEntryTypeFilterCbFailureAudit.Checked = (eventMonitor.EventType & EventLogEntryType.FailureAudit) == EventLogEntryType.FailureAudit;
            eventMonitorEntryTypeFilterCbSuccessAudit.Checked = (eventMonitor.EventType & EventLogEntryType.SuccessAudit) == EventLogEntryType.SuccessAudit;
            eventMonitorEventsLogTypeDdl.Text = eventMonitor.EventLogKind;
            eventMonitorTestDataUpdateFreqTextBox.Text = eventMonitor.UpdateFrequency.ToString();
        }
Exemplo n.º 2
0
 protected WaitingTask(
     EventMonitor eventMonitor,
     string messageToLogPreWait = null,
     string messageToLogPostWait = null)
 {
     _eventMonitor = eventMonitor;
     _messageToLogPreWait = messageToLogPreWait;
     _messageToLogPostWait = messageToLogPostWait;
 }
Exemplo n.º 3
0
        protected override void OnStartup(StartupEventArgs e)
        {
            _window = new UpcomingEventsWindow();

            _eventMonitor = new EventMonitor(Util.Configuration.Instance.Api);
            _eventMonitor.Interval = Util.Configuration.Instance.MonitorInterval;
            _eventMonitor.EventsChanged += new EventHandler<EventsChangedEventArgs>(EventsArrived);
            _eventMonitor.Start();
        }
 private TestTask(EventMonitor eventMonitor) : base(eventMonitor)
 {
 }
Exemplo n.º 5
0
 /// <summary>
 ///   Starts monitoring an object for its <see cref="INotifyPropertyChanged.PropertyChanged"/> events.
 /// </summary>
 /// <exception cref = "ArgumentNullException">Thrown if eventSource is Null.</exception>
 public static void MonitorEvents(this INotifyPropertyChanged eventSource)
 {
     EventMonitor.AddRecordersFor(eventSource, source => BuildRecorders((INotifyPropertyChanged)source));
 }
Exemplo n.º 6
0
 /// <summary>
 ///   Starts monitoring an object for its events.
 /// </summary>
 /// <exception cref = "ArgumentNullException">Thrown if eventSource is Null.</exception>
 public static void MonitorEvents(this object eventSource)
 {
     EventMonitor.AddRecordersFor(eventSource, BuildRecorders);
 }
Exemplo n.º 7
0
		private void CloseProject()
		{
			UpdateTimer.Stop();

			BuildList.Items.Clear();
			BuildList.Groups.Clear();

			SelectedFileName = null;
			SelectedProjectIdentifier = null;
			BranchDirectoryName = null;
			EditorTargetName = null;

			if(NotificationWindow != null)
			{
				NotificationWindow.Dispose();
				NotificationWindow = null;
			}
			if(PerforceMonitor != null)
			{
				PerforceMonitor.Dispose();
				PerforceMonitor = null;
			}
			if(Workspace != null)
			{
				Workspace.Dispose();
				Workspace = null;
			}
			if(EventMonitor != null)
			{
				EventMonitor.Dispose();
				EventMonitor = null;
			}

			ListIndexToChangeIndex = new List<int>();
			SortedChangeNumbers = new List<int>();
			NumChanges = 0;
			ContextMenuChange = null;
			HoverItem = -1;
			PendingSelectedChangeNumber = -1;
			NotifiedBuildTypeToChangeNumber = new Dictionary<string,int>();

			SyncLog.CloseFile();
			SyncLog.Clear();

			UpdateBuildSteps();

			StatusPanel.SetProjectLogo(null);
			UpdateStatusPanel();

			Taskbar.SetState(Handle, TaskbarState.NoProgress);
		}
Exemplo n.º 8
0
    public void W3CTS_DispatchEvent13()
    {
        IDocument document = LoadDocument("hc_staff.xml");
                IEvent @event = ((IDocumentEvent)document).CreateEvent("Events");
                EventMonitor eventMonitor = new EventMonitor();
                EventMonitor otherMonitor = new EventMonitor();
                @event.InitEvent("foo", true, false);
                ArrayList listeners = new ArrayList();
                ArrayList events = new ArrayList();

                ListenerRemover listenerRemover1 = new ListenerRemover(events, listeners);
                ListenerRemover listenerRemover2 = new ListenerRemover(events, listeners);

                listeners.Add(listenerRemover1);
                listeners.Add(listenerRemover2);

                ((IEventTarget)document).AddEventListener("foo", new EventListener(listenerRemover1.EventHandler), false);
                ((IEventTarget)document).AddEventListener("foo", new EventListener(listenerRemover2.EventHandler), false);
                ((IEventTarget)document).DispatchEvent(@event);

                Assert.AreEqual(events.Count, 1);
    }
Exemplo n.º 9
0
 private object LifeCycleTestBeforeStart(TaskManager tm, EventMonitor <TaskManager> tmMon)
 {
     AssertState(tm, isDisposed: false, isRunning: false);
     Assert.AreEqual(0, tm.TaskCount);
     return(null);
 }
Exemplo n.º 10
0
 static void Main(string[] args)
 {
     var eventMonitor = new EventMonitor();
     var observedObject = new ObservedObjectBuilder(eventMonitor).BuildObservedObject();
     observedObject.RaiseEvent();
     observedObject.RaiseCustomEvent();
     System.Console.WriteLine();
     System.Console.WriteLine("Monitored event count: " + eventMonitor.EventsRaised);
     System.Console.ReadLine();
 }
Exemplo n.º 11
0
 public ObservedObjectBuilder(EventMonitor eventMonitor)
 {
     this.eventMonitor = eventMonitor;
 }
 /// <summary>
 ///   Starts monitoring <paramref name="eventSource"/> for events defined in the type parameter <typeparamref name="T"/>.
 /// </summary>
 /// <param name="eventSource">The object for which to monitor the events.</param>
 /// <typeparam name="T">The type defining the events it should monitor.</typeparam>
 /// <exception cref = "ArgumentNullException">Thrown if <paramref name="eventSource"/> is Null.</exception>
 public static void MonitorEvents <T>(this object eventSource)
 {
     // SMELL: This static stuff needs to go at the some point.
     EventMonitor.AddRecordersFor(eventSource, source => BuildRecorders(source, typeof(T)));
 }
Exemplo n.º 13
0
 public void ShowResult(double result)
 {
     EventMonitor.Send(EventType.StartExecuteCallback);
     Thread.Sleep(10000);
     EventMonitor.Send(EventType.EndExecuteCallback);
 }
Exemplo n.º 14
0
 public void Attach(EventMonitor monitor)
 {
     _monitors.Add(monitor);
 }
Exemplo n.º 15
0
 public void Detach(EventMonitor monitor)
 {
     _monitors.Remove(_monitors);
 }
Exemplo n.º 16
0
    public void W3CTS_DispatchEvent09()
    {
        IDocument document = LoadDocument("hc_staff.xml");
                IEvent @event = ((IDocumentEvent)document).CreateEvent("Events");
                EventMonitor eventMonitor = new EventMonitor();
                @event.InitEvent("foo", true, false);

                ((IEventTarget)document).AddEventListener("foo", new EventListener(eventMonitor.EventHandler), true);
                ((IEventTarget)document).DispatchEvent(@event);
        Assert.AreEqual(eventMonitor.AtEvents, 0);
                Assert.AreEqual(eventMonitor.BubbledEvents, 0);
                Assert.AreEqual(eventMonitor.CapturedEvents, 0);
    }
Exemplo n.º 17
0
    public void W3CTS_DispatchEvent12()
    {
        IDocument document = LoadDocument("hc_staff.xml");
                IEvent @event = ((IDocumentEvent)document).CreateEvent("Events");
                EventMonitor eventMonitor = new EventMonitor();
                EventMonitor otherMonitor = new EventMonitor();
                @event.InitEvent("foo", true, false);

                ((IEventTarget)document).AddEventListener("foo", new EventListener(eventMonitor.EventHandler), false);
                ((IEventTarget)document).RemoveEventListener("foo", new EventListener(eventMonitor.EventHandler), true);
                ((IEventTarget)document).RemoveEventListener("food", new EventListener(eventMonitor.EventHandler), false);
                ((IEventTarget)document).RemoveEventListener("foo", new EventListener(otherMonitor.EventHandler), true);
                ((IEventTarget)document).DispatchEvent(@event);
                Assert.AreEqual(eventMonitor.Events, 1);
    }
Exemplo n.º 18
0
 private TaskCloseExceptionTask(EventMonitor monitor) : base(monitor)
 {
 }
Exemplo n.º 19
0
 private TaskCloseHandlerWithException(EventMonitor monitor) : base(
         new TestSerializableException(TaskCloseExceptionMessage),
         close => { monitor.Signal(); })
 {
 }
Exemplo n.º 20
0
		private bool OpenProject(string NewSelectedFileName)
		{
			if(String.IsNullOrWhiteSpace(NewSelectedFileName))
			{
				Log.WriteLine("Trying to open empty project path - closing instead");
				return TryCloseProject();
			}

			Log.WriteLine("Trying to open project {0}", NewSelectedFileName);
			if(!File.Exists(NewSelectedFileName))
			{
				ShowErrorDialog("{0} does not exist.", NewSelectedFileName);
				return false;
			}

			// Detect the project settings in a background thread
			using(DetectProjectSettingsTask DetectSettings = new DetectProjectSettingsTask(NewSelectedFileName, Log))
			{
				string ErrorMessage;
				if(!ModalTaskWindow.Execute(DetectSettings, "Opening Project", "Opening project, please wait...", out ErrorMessage))
				{
					if(!String.IsNullOrEmpty(ErrorMessage))
					{
						ShowErrorDialog("{0}", ErrorMessage);
					}
					return false;
				}

				// Now that we've done everything that can fail, perform the final switch over
				if(!TryCloseProject())
				{
					return false;
				}

				// Set the project logo on the status panel and notification window
				NotificationWindow = new NotificationWindow(Properties.Resources.DefaultNotificationLogo);
				StatusPanel.SetProjectLogo(DetectSettings.ProjectLogo);
				DetectSettings.ProjectLogo = null;

				// Update the user settings for the new project
				Settings.OpenProject(DetectSettings.BranchClientPath, DetectSettings.NewSelectedClientFileName);

				// Commit all the new project info
				PerforceConnection PerforceClient = DetectSettings.PerforceClient;
				SelectedFileName = NewSelectedFileName;
				SelectedProjectIdentifier = DetectSettings.NewSelectedProjectIdentifier;
				EditorTargetName = DetectSettings.NewProjectEditorTarget;
				BranchDirectoryName = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(DetectSettings.BaseEditorTargetPath), "..", ".."));
				StreamName = DetectSettings.StreamName;
				ServerTimeZone = DetectSettings.ServerTimeZone;

				// Check if we've the project we've got open in this workspace is the one we're actually synced to
				int CurrentChangeNumber = -1;
				if(String.Compare(Settings.CurrentWorkspace.CurrentProjectIdentifier, SelectedProjectIdentifier, true) == 0)
				{
					CurrentChangeNumber = Settings.CurrentWorkspace.CurrentChangeNumber;
				}

				string ProjectLogBaseName = Path.Combine(DataFolder, String.Format("{0}@{1}", PerforceClient.ClientName, DetectSettings.BranchClientPath.Replace("//" + PerforceClient.ClientName + "/", "").Trim('/').Replace("/", "$")));

				string TelemetryProjectIdentifier = PerforceUtils.GetClientOrDepotDirectoryName(DetectSettings.NewSelectedProjectIdentifier);

				Workspace = new Workspace(PerforceClient, BranchDirectoryName, SelectedFileName, DetectSettings.BranchClientPath, DetectSettings.NewSelectedClientFileName, CurrentChangeNumber, Settings.CurrentWorkspace.LastBuiltChangeNumber, TelemetryProjectIdentifier, new LogControlTextWriter(SyncLog));
				Workspace.OnUpdateComplete += UpdateCompleteCallback;

				PerforceMonitor = new PerforceMonitor(PerforceClient, DetectSettings.BranchClientPath, DetectSettings.NewSelectedClientFileName, SelectedProjectIdentifier, ProjectLogBaseName + ".p4.log");
				PerforceMonitor.OnUpdate += UpdateBuildListCallback;
				PerforceMonitor.OnUpdateMetadata += UpdateBuildMetadataCallback;
				PerforceMonitor.OnStreamChange += StreamChangedCallbackAsync;

				EventMonitor = new EventMonitor(SqlConnectionString, PerforceUtils.GetClientOrDepotDirectoryName(SelectedProjectIdentifier), DetectSettings.PerforceClient.UserName, ProjectLogBaseName + ".review.log");
				EventMonitor.OnUpdatesReady += UpdateReviewsCallback;

				string LogFileName = Path.Combine(DataFolder, ProjectLogBaseName + ".sync.log");
				SyncLog.OpenFile(LogFileName);

				ProjectList.Text = NewSelectedFileName;
				UpdateProjectList();

				Settings.LastProjectFileName = SelectedFileName;
				Settings.Save();

				BuildList.Items.Clear();
				UpdateBuildList();
				UpdateBuildSteps();
				UpdateSyncActionCheckboxes();
				UpdateStatusPanel();

				if(CurrentChangeNumber != -1)
				{
					SelectChange(CurrentChangeNumber);
				}
			}
			return true;
		}
 public EventMonitor GetEventMonitor()
 {
     EventMonitor eventMonitor = new EventMonitor
                                     {
                                         ClearOldLogs = eventMonitorClearLogCb.Checked,
                                         EventLogKind = eventMonitorEventsLogTypeDdl.Text,
                                         EventNameMatch =
                                             eventMonitorSourceFilterTextBox.Text,
                                         FriendlyName = FriendlyName,
                                         Server = IpOrHostName,
                                         EventType = EntryType,
                                         UpdateFrequency =
                                             Convert.ToInt32(
                                                 eventMonitorTestDataUpdateFreqTextBox.Text),
                                         StartTime = DateTime.Now
                                     };
     return eventMonitor;
 }
 private TestTask(EventMonitor eventMonitor) : base(eventMonitor, "WaitingTask started")
 {
 }