Пример #1
0
        public ViewAnalogousVM CollectExistingAnalogousReactions()
        {
            var               mainViewModel   = ((MainWindow)(App.Current.MainWindow)).DataContext as MainVM;
            List <RsnVM>      tanRsns         = new List <RsnVM>();
            List <ReactionVM> tanReactions    = new List <ReactionVM>();
            var               tanParticipants = new List <ReactionParticipantVM>();

            AnalogousReactions.Clear();
            AllParticipants.Clear();
            ReactionParticipants.Clear();
            try
            {
                var analogousReactions = mainViewModel.TanVM.Reactions.Where(r => r.AnalogousVMId == SelectedMasterReaction.Id);
                foreach (var existingAnalogousReaction in analogousReactions)
                {
                    AnalogousReactions.Add(existingAnalogousReaction);
                    AllParticipants.AddRange(mainViewModel.TanVM.ReactionParticipants.Where(rp => rp.ReactionVM.Id == existingAnalogousReaction.Id));
                    ReactionParticipants.AddRange(mainViewModel.TanVM.ReactionParticipants.Where(rp => rp.ReactionVM.Id == existingAnalogousReaction.Id));
                    foreach (var rsn in (mainViewModel.TanVM.Rsns.Where(rsn => rsn.Reaction.Id == existingAnalogousReaction.Id)))
                    {
                        Rsns.Add(rsn);
                    }
                }
            }
            catch (Exception ex)
            {
                AppErrorBox.ShowErrorMessage("Error while collecting analogous reactions", ex.Message);
            }
            return(this);
        }
Пример #2
0
 private void Start()
 {
     _mainCamera = Camera.main;
     onExplosiveWeaponActive.Invoke(true);
     _allParticipants = GameObject.FindObjectOfType <AllParticipants>();
     _tilemap         = GameObject.Find("Tilemap").GetComponent <Tilemap>();
 }
        private void ReloadResultList()
        {
            if (File.Exists(RESULT_FILE_PATH))
            {
                var lines        = File.ReadAllLines(RESULT_FILE_PATH);
                var participants = new List <Participant>();

                foreach (var line in lines)
                {
                    var parts = line.Split(';');
                    participants.Add(new Participant
                    {
                        Name   = parts[0],
                        Points = int.Parse(parts[1]),
                        Email  = parts[2]
                    });
                }

                AllParticipants.Clear();
                AllParticipants = participants.OrderByDescending(p => p.Points).ToList();

                ParticipantsTop10.Clear();
                var top10       = AllParticipants.Take(10);
                var rankCounter = 1;
                foreach (var player in top10)
                {
                    player.Name = player.Name.ToUpper();
                    player.Rank = rankCounter;
                    ParticipantsTop10.Add(player);
                    rankCounter++;
                }
            }
        }
Пример #4
0
 private void Start()
 {
     _roundText  = _roundTextObject.GetComponent <Text>();
     _roundState = RoundState.Pause;
     ExplosiveWeapon.onExplosiveWeaponDestroy += StopRound;
     ColdWeapon.onColdWeaponDestroy           += StopRound;
     Participant.onDeath += NullifyRounds;
     _allParticipants     = GameObject.FindObjectOfType <AllParticipants>();
 }
Пример #5
0
        void HandleUpdateViolation(object sender, ProtocolViolationEventArgs e)
        {
            var assdVM = ((List <ParticipantListItemViewModel>)AllParticipants.SourceCollection)
                         .First(p => p.Id == e.Violation.ParticipantId);

            AllParticipants.EditItem(assdVM);
            assdVM.RecalculateDataRequired();
            AllParticipants.CommitEdit();
        }
Пример #6
0
 private void Start()
 {
     _allParticipants = GameObject.FindObjectOfType <AllParticipants>();
     Physics2D.IgnoreCollision(FindObjectOfType <Player>().GetComponent <BoxCollider2D>(), GetComponent <BoxCollider2D>(), true);
     _movement           = GetComponent <Movement>();
     _movement.onMyTurn += FindClosestEnemy;
     BotMovement.onCanAttackWitchColdWeapon      += AttackWithColdWeapon;
     BotMovement.onCanAttackWitchExplosiveWeapon += AttackWithExplosiveWeapon;
     Participant.onDeath += DestoyParticipant;
 }
Пример #7
0
        private void OnParticipantAdded(object sender, ParticipantEventArgs e)
        {
            var partBase = ParticipantBaseMap(e.Participant);

            partBase.StudyCentre = _repository.FindStudyCentre(partBase.CentreId);
            var viewModel = new ParticipantListItemViewModel(partBase, _repository);

            _ageUpdater.AddParticipant(viewModel);
            AllParticipants.AddNewItem(viewModel);
            AllParticipants.CommitNew();
            SetDisplayName();
        }
Пример #8
0
        void HandleAddOrUpdateViolation(object sender, ProtocolViolationEventArgs e)
        {
            var assdVM = ((List <ParticipantListItemViewModel>)AllParticipants.SourceCollection)
                         .First(p => p.Id == e.Violation.ParticipantId);

            AllParticipants.EditItem(assdVM);
            if (e.EventType == CRUD.Updated)
            {
                assdVM.ProtocolViolations.Remove(assdVM.ProtocolViolations.First(v => v.Id == e.Violation.Id));
            }
            assdVM.ProtocolViolations.Add(e.Violation);
            assdVM.RecalculateDataRequired();
            AllParticipants.CommitEdit();
        }
 void OnNewAge(object sender, AgeIncrementingEventArgs e)
 {
     if (!(e.Participant is ParticipantListItemViewModel participant))
     {
         participant         = ((List <ParticipantListItemViewModel>)AllParticipants.SourceCollection).First(p => p.Id == e.Participant.Id);
         participant.AgeDays = e.Participant.AgeDays;
     }
     AllParticipants.EditItem(participant);
     if (participant.IsKnownDead == true || participant.AgeDays > 28)
     {
         e.Remove = true;
     }
     AllParticipants.CommitEdit();
 }
Пример #10
0
    private void Awake()
    {
        _allParticipants = GameObject.FindObjectOfType <AllParticipants>();

        foreach (var participant in _allParticipants.GetParticipants())
        {
            Movement _tempMovement = participant.GetComponent <Movement>();
            if (_tempMovement.IsMyTurn())
            {
                _activeParticipant = participant.gameObject;
                _movement          = _tempMovement;
            }
        }
        _animator = GetComponent <Animator>();
    }
Пример #11
0
        void HandleParticipantUpdate(object sender, ParticipantEventArgs e)
        {
            var assdVM = ((List <ParticipantListItemViewModel>)AllParticipants.SourceCollection)
                         .First(p => p.Id == e.Participant.Id);

            AllParticipants.EditItem(assdVM);
            UpdateDemographics(e.Participant, assdVM);
            assdVM.VaccinesAdministered       = e.Participant.VaccinesAdministered;
            assdVM.UnsuccessfulFollowUps      = e.Participant.UnsuccessfulFollowUps;
            assdVM.OutcomeAt28Days            = e.Participant.OutcomeAt28Days;
            assdVM.DischargeDateTime          = e.Participant.DischargeDateTime;
            assdVM.DeathOrLastContactDateTime = e.Participant.DeathOrLastContactDateTime;
            assdVM.CauseOfDeath             = e.Participant.CauseOfDeath;
            assdVM.FollowUpBabyBCGReaction  = e.Participant.FollowUpBabyBCGReaction;
            assdVM.PermanentlyUncontactable = e.Participant.PermanentlyUncontactable;
            assdVM.MaternalBCGScar          = e.Participant.MaternalBCGScar;

            if (_updateWindow != null && ((ParticipantProgressViewModel)_updateWindow.DataContext).Id == assdVM.Id)
            {
                //this is here for data oversite, when update comes without having entered the data. For data collection sites, values should be the same and so updates will not be notified
                ParticipantProgressViewModel sp = (ParticipantProgressViewModel)_updateWindow.DataContext;
                UpdateDemographics(e.Participant, sp);
                sp.OutcomeAt28Days            = e.Participant.OutcomeAt28Days;
                sp.CauseOfDeath               = e.Participant.CauseOfDeath;
                sp.DeathOrLastContactDateTime = e.Participant.DeathOrLastContactDateTime;
                sp.DischargeDateTime          = e.Participant.DischargeDateTime;
                sp.LastContactWeight          = e.Participant.LastContactWeight;
                sp.LastWeightDate             = e.Participant.LastWeightDate;
                sp.OtherCauseOfDeathDetail    = e.Participant.OtherCauseOfDeathDetail;
                sp.BcgAdverse                = e.Participant.BcgAdverse;
                sp.BcgAdverseDetail          = e.Participant.BcgAdverseDetail;
                sp.BcgPapuleAtDischarge      = e.Participant.BcgPapuleAtDischarge;
                sp.IsParticipantModelChanged = false;
                sp.IsVaccineAdminChanged     = false; //ensure save changes is not enabled
                //assdVM.ParticipantModel = sp.ParticipantModel;
            }
            AllParticipants.CommitEdit();
        }
Пример #12
0
 private void Awake()
 {
     _movement = GetComponent <Movement>();
     GameRound.onRoundStart += CheckRoundNumber;
     _allParticipants        = GameObject.FindObjectOfType <AllParticipants>();
 }
 private void Construct(AllParticipants allParticipants)
 {
     _allParticipants = allParticipants;
 }
Пример #14
0
 public void UpdateAnalogousReactionPreview(ReactionVM SelectedReaction)
 {
     if (AnalogousReactionPreview != null)
     {
         if (SelectedReaction != null)
         {
             AnalogousReactionPreview = ReactionViewBuilder.GetReactionView(SelectedReaction, AllParticipants.ToList());
         }
         else
         {
             AnalogousReactionPreview.Name = "Select Reaction To Preview . .";
         }
     }
 }
Пример #15
0
 public void JudgeByRank()
 {
     RankGroups = AllParticipants.GroupBy(p => p.Hand.Rank).ToList();
 }
Пример #16
0
 public void OrderParticipants()
 {
     AllParticipants = AllParticipants.OrderBy(p => p.Hand.Rank).ToList();
 }