Esempio n. 1
0
        public void TestClearAll()
        {
            Project p = Utils.CreateProject();

            try {
                EventsFilter filter = new EventsFilter(p);

                filter.FilterPlayer(p.LocalTeamTemplate.List [0], true);
                Assert.AreEqual(1, filter.VisiblePlays.Count);
                Assert.AreEqual(1, filter.VisiblePlayers.Count);
                filter.ClearAll();
                Assert.AreEqual(3, filter.VisiblePlays.Count);
                Assert.AreEqual(10, filter.VisiblePlayers.Count);

                filter.FilterEventType(p.EventTypes [0], true);
                Assert.AreEqual(1, filter.VisiblePlays.Count);
                Assert.AreEqual(1, filter.VisibleEventTypes.Count);
                filter.ClearAll();
                Assert.AreEqual(3, filter.VisiblePlays.Count);
                Assert.AreEqual(13, filter.VisibleEventTypes.Count);

                filter.FilterEventTag(p.EventTypes [0], (p.EventTypes [0] as AnalysisEventType).Tags [0], true);
                Assert.AreEqual(0, filter.VisiblePlays.Count);
                Assert.AreEqual(1, filter.VisibleEventTypes.Count);
                filter.ClearAll();
                Assert.AreEqual(3, filter.VisiblePlays.Count);
                Assert.AreEqual(13, filter.VisibleEventTypes.Count);
            } finally {
                Utils.DeleteProject(p);
            }
        }
Esempio n. 2
0
        public void TestFilterPlayers()
        {
            Project p = Utils.CreateProject();

            try {
                EventsFilter filter = new EventsFilter(p);

                Assert.AreEqual(10, filter.VisiblePlayers.Count);
                Assert.AreEqual(3, filter.VisiblePlays.Count);
                filter.FilterPlayer(p.LocalTeamTemplate.List [4], true);
                Assert.AreEqual(0, filter.VisiblePlays.Count);
                Assert.AreEqual(1, filter.VisiblePlayers.Count);
                filter.FilterPlayer(p.LocalTeamTemplate.List [0], true);
                Assert.AreEqual(1, filter.VisiblePlays.Count);
                Assert.AreEqual(2, filter.VisiblePlayers.Count);
                filter.FilterPlayer(p.LocalTeamTemplate.List [0], true);
                Assert.AreEqual(1, filter.VisiblePlays.Count);
                Assert.AreEqual(2, filter.VisiblePlayers.Count);
                filter.FilterPlayer(p.LocalTeamTemplate.List [0], false);
                Assert.AreEqual(0, filter.VisiblePlays.Count);
                Assert.AreEqual(1, filter.VisiblePlayers.Count);
                filter.FilterPlayer(p.LocalTeamTemplate.List [4], false);
                Assert.AreEqual(10, filter.VisiblePlayers.Count);
                Assert.AreEqual(3, filter.VisiblePlays.Count);
            } finally {
                Utils.DeleteProject(p);
            }
        }
Esempio n. 3
0
        async Task ExecuteLoadEventsCommand(EventsFilter eventsFilter)
        {
            try
            {
                IsBusy = true;

                var events = await this.EventsService.GetEvents(eventsFilter);

                this.Events.ReplaceRange(events);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                // if there were no local events in db yet, we still wait for data sync
                if (Events == null || Events?.Count == 0)
                {
                    IsBusy = true;
                }
                else
                {
                    IsBusy = false;
                }
            }
        }
Esempio n. 4
0
 public void OpenProject(Project project, ProjectType projectType,
                         CaptureSettings props, EventsFilter filter,
                         out IAnalysisWindow analysisWindow)
 {
     Log.Information("Open project");
     analysisWindow = mainWindow.SetProject(project, projectType, props, filter);
 }
        public void TestFilterPlayersDuplicated()
        {
            LMProject p = Utils.CreateProject();

            p.VisitorTeamTemplate = p.LocalTeamTemplate;

            try {
                EventsFilter filter = new EventsFilter(p);

                Assert.AreEqual(5, filter.VisiblePlayers.Count);
                Assert.AreEqual(3, filter.VisiblePlays.Count);

                foreach (LMPlayer player in p.LocalTeamTemplate.List)
                {
                    filter.FilterPlayer(player, true);
                }
                Assert.AreEqual(5, filter.VisiblePlayers.Count);
                Assert.AreEqual(3, filter.VisiblePlays.Count);

                foreach (LMPlayer player in p.VisitorTeamTemplate.List)
                {
                    filter.FilterPlayer(player, true);
                }
                Assert.AreEqual(5, filter.VisiblePlayers.Count);
                Assert.AreEqual(3, filter.VisiblePlays.Count);


                filter.ClearAll();
                Assert.AreEqual(5, filter.VisiblePlayers.Count);
                Assert.AreEqual(3, filter.VisiblePlays.Count);
            } finally {
                Utils.DeleteProject(p);
            }
        }
Esempio n. 6
0
        public void SetProject(Project project, EventsFilter filter)
        {
            this.project = project;
            timeline.LoadProject(project, filter);
            labels.LoadProject(project, filter);

            if (project == null)
            {
                if (timeoutID != 0)
                {
                    GLib.Source.Remove(timeoutID);
                    timeoutID = 0;
                }
                return;
            }

            if (timeoutID == 0)
            {
                timeoutID = GLib.Timeout.Add(TIMEOUT_MS, UpdateTime);
            }
            focusscale.Value = 6;
            // Can throw an exception if there are no files in set
            timerule.Duration             = project.Description.FileSet.First().Duration;
            timeline.ShowMenuEvent       += HandleShowMenu;
            timeline.ShowTimersMenuEvent += HandleShowTimersMenu;
            timeline.ShowTimerMenuEvent  += HandleShowTimerMenuEvent;
            QueueDraw();
        }
        public async Task <IEnumerable <EventInfo> > GetFilteredAsync(EventsFilter filter, int skip, int take)
        {
            using (var context = _contextFactory.CreateDataContext())
            {
                var affectedAddressHashes = filter.AffectedAddresses
                                            .Where(a => !string.IsNullOrWhiteSpace(a))
                                            .Select(a => Sha3Keccack.Current.CalculateHash(a));

                var items = await context.Events
                            .Include(x => x.Parameters)
                            .Include(x => x.TransactionLog)
                            .ThenInclude(x => x.Transaction)
                            .Where(x =>
                                   (string.IsNullOrEmpty(filter.EventName) || x.EventName == filter.EventName) &&
                                   (string.IsNullOrEmpty(filter.EventSignature) || x.EventSignature == filter.EventSignature) &&
                                   (string.IsNullOrEmpty(filter.Address) || x.TransactionLog.Address == filter.Address) &&
                                   (!filter.AffectedAddresses.Any() || x.Parameters.Any(p =>
                                                                                        p.ParameterType == Consts.AffectedAddressParameterType &&
                                                                                        affectedAddressHashes.Contains(p.ParameterValueHash))))
                            .OrderByDescending(x => x.BlockTimestamp)
                            .Skip(skip)
                            .Take(take)
                            .Select(x => x.ToEventInfo(null))
                            .ToListAsync();

                return(items);
            }
        }
Esempio n. 8
0
        void HandleOpenedProjectChanged(Project project, ProjectType projectType,
                                        EventsFilter filter, IAnalysisWindow analysisWindow)
        {
            this.openedProject = project;
            this.projectType   = projectType;
            this.filter        = filter;

            if (project == null)
            {
                if (framesCapturer != null)
                {
                    framesCapturer.Dispose();
                    framesCapturer = null;
                }
                return;
            }

            if (projectType == ProjectType.FileProject)
            {
                framesCapturer = Config.MultimediaToolkit.GetFramesCapturer();
                framesCapturer.Open(openedProject.Description.FileSet.First().FilePath);
            }
            this.analysisWindow = analysisWindow;
            player   = analysisWindow.Player;
            capturer = analysisWindow.Capturer;
        }
Esempio n. 9
0
 public void SetProject(Project project, ProjectType projectType, EventsFilter filter)
 {
     this.projectType      = projectType;
     this.project          = project;
     buttonswidget.Visible = true;
     if (project != null)
     {
         buttonswidget.Project = project;
     }
     buttonswidget.Mode = DashboardMode.Code;
     teamtagger.Project = project;
     teamtagger.LoadTeams(project.LocalTeamTemplate, project.VisitorTeamTemplate,
                          project.Dashboard.FieldBackground);
     teamtagger.CurrentTime = new Time(0);
     if (projectType == ProjectType.FileProject)
     {
         timeline.SetProject(project, filter);
     }
     else if (projectType == ProjectType.FakeCaptureProject)
     {
         eventslistwidget.SetProject(project, filter);
     }
     eventslistwidget.Visible = projectType == ProjectType.FakeCaptureProject;
     timeline.Visible         = projectType == ProjectType.FileProject;
     playspositionviewer1.LoadProject(project, filter);
 }
 public PlayerEventTypeStats(Project project, EventsFilter filter, Player player, EventType evType)
 {
     this.filter    = filter;
     this.player    = player;
     this.project   = project;
     this.EventType = evType;
 }
Esempio n. 11
0
 public override void SetFilter(EventsFilter filter, Project project)
 {
     this.local       = project.LocalTeamTemplate;
     this.visitor     = project.VisitorTeamTemplate;
     localTeam.Name   = local.TeamName;
     visitorTeam.Name = visitor.TeamName;
     base.SetFilter(filter, project);
 }
Esempio n. 12
0
 public EventTypeStats(ProjectLongoMatch project, EventsFilter filter, EventType evType)
 {
     Name = evType.Name;
     events = new List<TimelineEventLongoMatch> ();
     this.project = project;
     this.filter = filter;
     this.eventType = evType;
 }
Esempio n. 13
0
 public void SetProject(Project project, EventsFilter filter)
 {
     this.project = project;
     eventslistwidget.SetProject(project, filter);
     playersfilter.SetFilter(filter, project);
     categoriesfilter.SetFilter(filter, project);
     playlistwidget.Project = project;
 }
Esempio n. 14
0
 public EventTypeStats(Project project, EventsFilter filter, EventType evType)
 {
     Name           = evType.Name;
     events         = new List <TimelineEvent> ();
     this.project   = project;
     this.filter    = filter;
     this.eventType = evType;
 }
Esempio n. 15
0
 public void SetFilter(EventsFilter filter, LMProject project)
 {
     this.local       = project.LocalTeamTemplate;
     this.visitor     = project.VisitorTeamTemplate;
     localTeam.Name   = local.TeamName;
     visitorTeam.Name = visitor.TeamName;
     this.filter      = filter;
     FillTree();
 }
Esempio n. 16
0
        public void TestFilterCategoryTags()
        {
            Project p = Utils.CreateProject();

            try {
                EventsFilter      filter = new EventsFilter(p);
                AnalysisEventType a;

                Assert.AreEqual(3, filter.VisiblePlays.Count);

                a = p.EventTypes [0] as AnalysisEventType;
                filter.FilterEventTag(a, a.Tags [0], true);
                Assert.AreEqual(1, filter.VisibleEventTypes.Count);
                Assert.AreEqual(0, filter.VisiblePlays.Count);

                a = p.EventTypes [1] as AnalysisEventType;
                filter.FilterEventTag(a, a.Tags [0], true);
                Assert.AreEqual(2, filter.VisibleEventTypes.Count);
                Assert.AreEqual(1, filter.VisiblePlays.Count);

                a = p.EventTypes [2] as AnalysisEventType;
                filter.FilterEventTag(a, a.Tags [0], true);
                Assert.AreEqual(3, filter.VisibleEventTypes.Count);
                Assert.AreEqual(1, filter.VisiblePlays.Count);

                filter.FilterEventTag(a, a.Tags [1], true);
                Assert.AreEqual(2, filter.VisiblePlays.Count);

                a = p.EventTypes [0] as AnalysisEventType;
                filter.FilterEventTag(a, a.Tags [0], false);
                Assert.AreEqual(3, filter.VisiblePlays.Count);

                a = p.EventTypes [1] as AnalysisEventType;
                filter.FilterEventTag(a, a.Tags [0], false);
                filter.FilterEventTag(a, a.Tags [1], true);
                Assert.AreEqual(2, filter.VisiblePlays.Count);
                Assert.AreEqual(p.Timeline [0], filter.VisiblePlays [0]);
                Assert.AreEqual(p.Timeline [2], filter.VisiblePlays [1]);

                /* One tag filtered now, but not the one of this play */
                a = p.EventTypes [2] as AnalysisEventType;
                filter.FilterEventTag(a, a.Tags [1], false);
                Assert.AreEqual(1, filter.VisiblePlays.Count);
                Assert.AreEqual(p.Timeline [0], filter.VisiblePlays [0]);
                /* No more tags filtered, if the category matches we are ok */
                filter.FilterEventTag(a, a.Tags [0], false);
                Assert.AreEqual(2, filter.VisiblePlays.Count);
                Assert.AreEqual(p.Timeline [0], filter.VisiblePlays [0]);
                Assert.AreEqual(p.Timeline [2], filter.VisiblePlays [1]);

                filter.ClearAll();
                Assert.AreEqual(3, filter.VisiblePlays.Count);
            } finally {
                Utils.DeleteProject(p);
            }
        }
Esempio n. 17
0
        bool SetProject(Project project, ProjectType projectType, CaptureSettings props)
        {
            if (OpenedProject != null)
            {
                CloseOpenedProject(true);
            }

            Log.Debug("Loading project " + project.ID + " " + projectType);

            PlaysFilter = new EventsFilter(project);
            project.CleanupTimers();
            guiToolkit.OpenProject(project, projectType, props, PlaysFilter,
                                   out analysisWindow);
            Player            = analysisWindow.Player;
            Capturer          = analysisWindow.Capturer;
            OpenedProject     = project;
            OpenedProjectType = projectType;

            if (projectType == ProjectType.FileProject)
            {
                // Check if the file associated to the project exists
                if (!project.Description.FileSet.CheckFiles())
                {
                    if (!guiToolkit.SelectMediaFiles(project))
                    {
                        CloseOpenedProject(true);
                        return(false);
                    }
                }
                try {
                    Player.Open(project.Description.FileSet);
                } catch (Exception ex) {
                    Log.Exception(ex);
                    guiToolkit.ErrorMessage(Catalog.GetString("An error occurred opening this project:") + "\n" + ex.Message);
                    CloseOpenedProject(false);
                    return(false);
                }
            }
            else if (projectType == ProjectType.CaptureProject ||
                     projectType == ProjectType.URICaptureProject ||
                     projectType == ProjectType.FakeCaptureProject)
            {
                try {
                    Capturer.Run(props, project.Description.FileSet.First());
                } catch (Exception ex) {
                    Log.Exception(ex);
                    guiToolkit.ErrorMessage(ex.Message);
                    CloseOpenedProject(false);
                    return(false);
                }
            }

            EmitProjectChanged();
            return(true);
        }
 public IList <Events> Events(EventsFilter eventsFilter)
 {
     try
     {
         return(_eventsRepository.GetBySearch(eventsFilter).ToList());
     }
     catch
     {
         return(new List <Events>());
     }
 }
Esempio n. 19
0
 public CategoryTimeline(Project project, List <TimelineEvent> plays, Time maxTime,
                         double offsetY, Color background, EventsFilter filter) :
     base(maxTime, StyleConf.TimelineCategoryHeight, offsetY, background)
 {
     this.filter  = filter;
     this.project = project;
     foreach (TimelineEvent p in plays)
     {
         AddPlay(p);
     }
 }
Esempio n. 20
0
 void HandleOpenedProjectChanged(Project project, ProjectType projectType,
                                 EventsFilter filter, IAnalysisWindow analysisWindow)
 {
     openedProject     = project;
     openedProjectType = projectType;
     if (project != null)
     {
         player      = analysisWindow.Player;
         this.filter = filter;
     }
 }
Esempio n. 21
0
        public async Task <IEnumerable <EventViewModel> > GetEvents(EventsFilter eventsFilter = null)
        {
            if (eventsFilter == null)
            {
                eventsFilter = new EventsFilter();
            }

            var eventEntities = await this.EventsDatabase.GetAllEvents(eventsFilter.Predicate, eventsFilter.ShouldSortDescending);

            return(this.EventMapper.MapToViewModel(eventEntities));
        }
Esempio n. 22
0
 public void SetProject(ProjectLongoMatch project, EventsFilter filter)
 {
     this.project = project;
     playsList.Filter = filter;
     localPlayersList.Filter = filter;
     visitorPlayersList.Filter = filter;
     playsList.Project = project;
     visitorPlayersList.Project = project;
     localPlayersList.Project = project;
     LoadIcons ();
     UpdateTeamsModels (new TeamTagsChangedEvent ());
 }
Esempio n. 23
0
 public void LoadProject(Project project, EventsFilter filter)
 {
     ClearObjects();
     this.project = project;
     this.filter  = filter;
     if (project != null)
     {
         FillCanvas();
         UpdateVisibleCategories();
         filter.FilterUpdated += UpdateVisibleCategories;
     }
 }
Esempio n. 24
0
 public void SetProject(Project project, EventsFilter filter)
 {
     this.project               = project;
     playsList.Filter           = filter;
     localPlayersList.Filter    = filter;
     visitorPlayersList.Filter  = filter;
     playsList.Project          = project;
     visitorPlayersList.Project = project;
     localPlayersList.Project   = project;
     SetTabProps(playsList, true);
     SetTabProps(localPlayersList, false);
     SetTabProps(visitorPlayersList, false);
     UpdateTeamsModels();
 }
Esempio n. 25
0
        public void LoadProject(Project project, EventsFilter filter)
        {
            int height;

            this.project = project;
            ClearObjects();
            eventsTimelines.Clear();
            duration    = project.Description.FileSet.Duration;
            playsFilter = filter;
            FillCanvas();
            filter.FilterUpdated += UpdateVisibleCategories;
            height        = Objects.Count * StyleConf.TimelineCategoryHeight;
            widget.Height = height;
        }
Esempio n. 26
0
        public void TestEmptyFilter()
        {
            Project p = Utils.CreateProject();

            try {
                EventsFilter filter = new EventsFilter(p);

                Assert.AreEqual(13, filter.VisibleEventTypes.Count);
                Assert.AreEqual(10, filter.VisiblePlayers.Count);
                Assert.AreEqual(3, filter.VisiblePlays.Count);
            } finally {
                Utils.DeleteProject(p);
            }
        }
Esempio n. 27
0
 public TeamStats(ProjectLongoMatch project, EventsFilter filter, TeamType team)
 {
     this.project = project;
     this.filter = filter;
     this.team = team;
     if (team == TeamType.LOCAL) {
         this.template = project.LocalTeamTemplate;
     } else {
         this.template = project.VisitorTeamTemplate;
     }
     PlayersStats = new List<PlayerStats> ();
     foreach (PlayerLongoMatch p in this.template.List) {
         PlayersStats.Add (new PlayerStats (project, filter, p));
     }
 }
Esempio n. 28
0
 public PlayerStats(LMProject project, EventsFilter filter, LMPlayer player)
 {
     this.project     = project;
     this.filter      = filter;
     this.Player      = player;
     PlayerEventStats = new List <PlayerEventTypeStats> ();
     foreach (EventType evtType in project.EventTypes)
     {
         if (!(evtType is SubstitutionEventType))
         {
             PlayerEventStats.Add(new PlayerEventTypeStats(project, filter, player, evtType));
         }
     }
     UpdateTimePlayed();
 }
Esempio n. 29
0
 void HandleOpenedProjectChanged(Project project, ProjectType projectType,
                                 EventsFilter filter, IAnalysisWindow analysisWindow)
 {
     this.analysisWindow = analysisWindow;
     this.capturer       = analysisWindow.Capturer;
     openedProject       = project;
     this.projectType    = projectType;
     if (project == null)
     {
         dashboard = null;
     }
     else
     {
         dashboard = project.Dashboard;
     }
     ReloadHotkeys();
 }
Esempio n. 30
0
        public async Task <EventsResult> GetFilteredAsync(EventsFilter filter, int currentPage, int pageSize)
        {
            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            var(skip, take) = PagingUtils.GetNextPageParameters(currentPage, pageSize);

            var items = await _eventRepository.GetFilteredAsync(filter, skip, take);

            return(new EventsResult
            {
                CurrentPage = currentPage,
                PageSize = pageSize,
                Events = items
            });
        }
Esempio n. 31
0
        public ActionResult <Poll <EventViewModel> > GetEventPoll([FromQuery] int?offset,
                                                                  [FromQuery] int?count,
                                                                  [FromQuery] string categories,
                                                                  [FromQuery] string tags,
                                                                  [FromQuery] string places)
        {
            var filter = new EventsFilter();

            try
            {
                filter.ParseParameters(categories, tags, places);
            }
            catch (ArgumentException e)
            {
                return(BadRequest(e.ToString()));
            }

            return(eventsRepository.GetEventPoll(filter, offset, count));
        }
Esempio n. 32
0
        public ActionResult GetCalendars(EventsFilter filter)
        {
            JsonResult json = new JsonResult()
            {
                JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet,
                MaxJsonLength       = int.MaxValue
            };

            Guard.ArgumentNotNull(filter, "filter");

            var eventSchedulerModel = EventSchedulerHelper.LoadModel(filter.Id, filter.UICulture, filter.CurrentPageId);

            if (eventSchedulerModel != null)
            {
                json.Data = eventSchedulerModel.GetCalendars(filter);
            }

            return(json);
        }
Esempio n. 33
0
        public void SetProject(Project project, ProjectType projectType, CaptureSettings props, EventsFilter filter)
        {
            openedProject    = project;
            this.projectType = projectType;
            this.filter      = filter;

            codingwidget.SetProject(project, projectType, filter);
            playsSelection.SetProject(project, filter);
            if (projectType == ProjectType.FileProject)
            {
                playercapturer.Mode = PlayerViewOperationMode.Analysis;
            }
            else
            {
                playercapturer.Mode   = playercapturer.Mode = PlayerViewOperationMode.LiveAnalysisReview;
                Capturer.PeriodsNames = project.Dashboard.GamePeriods;
                Capturer.Periods      = project.Periods;
            }
        }
Esempio n. 34
0
        public void LoadProject(ProjectLongoMatch project, EventsFilter filter)
        {
            this.project = project;
            if (project != null) {
                var timeLine = project.Timeline.OfType<TimelineEventLongoMatch> ();

                field.Tagger.Project = project;
                hfield.Tagger.Project = project;
                goal.Tagger.Project = project;
                field.Tagger.Background = project.GetBackground (FieldPositionType.Field);
                hfield.Tagger.Background = project.GetBackground (FieldPositionType.HalfField);
                goal.Tagger.Background = project.GetBackground (FieldPositionType.Goal);
                field.Tagger.Plays = timeLine;
                hfield.Tagger.Plays = timeLine;
                goal.Tagger.Plays = timeLine;
                field.Tagger.Filter = filter;
                hfield.Tagger.Filter = filter;
                goal.Tagger.Filter = filter;
            }
        }
        public SportCategoryTimeline(ProjectLongoMatch project, List<TimelineEvent> plays, Time maxTime,
									  double offsetY, Color background, EventsFilter filter)
            : base(project, plays, maxTime,
																									 offsetY, background, filter)
        {
        }
 public void SetProject(Project project, ProjectType projectType, CaptureSettings props, EventsFilter filter)
 {
     this.project = (ProjectLongoMatch)project;
     codingwidget1.SetProject (this.project, projectType, (LMFilters.EventsFilter)filter);
 }
Esempio n. 37
0
 public void SetProject(ProjectLongoMatch project, ProjectType projectType, EventsFilter filter)
 {
     this.projectType = projectType;
     this.project = project;
     buttonswidget.Visible = true;
     if (project != null) {
         buttonswidget.Project = project;
     }
     buttonswidget.Mode = DashboardMode.Code;
     teamtagger.Project = project;
     teamtagger.LoadTeams (project.LocalTeamTemplate, project.VisitorTeamTemplate,
         project.Dashboard.FieldBackground);
     teamtagger.CurrentTime = new Time (0);
     if (projectType == ProjectType.FileProject) {
         timeline.SetProject (project, filter);
     } else if (projectType == ProjectType.FakeCaptureProject) {
         eventslistwidget.SetProject (project, filter);
     }
     eventslistwidget.Visible = projectType == ProjectType.FakeCaptureProject;
     timeline.Visible = projectType == ProjectType.FileProject;
     playspositionviewer1.LoadProject (project, filter);
 }
Esempio n. 38
0
 public ProjectStats(ProjectLongoMatch project)
 {
     Project = project;
     filter = new EventsFilter (project);
     CreateStats ();
 }