public void AddNotification(NotifyFlashMessage flash)
 {
     if (flash == null)
     {
         return;
     }
     if (flash.Balloon != null && flash.Balloon.DisplayTime >= 500)
     {
         var existing = notificationBalloons.FirstOrDefault(x => x.TitleText == flash.Balloon.TitleText && x.Icon == flash.Balloon.Icon);
         if (existing == null)
         {
             if (!SnappedToBottom)
             {
                 notificationBalloons.Add(flash.Balloon);
             }
             else
             {
                 notificationBalloons.Insert(0, flash.Balloon);
             }
         }
         else
         {
             if (flash.Balloon.EventType == EventType.Whisper)
             {
                 if (!SnappedToBottom)
                 {
                     notificationBalloons.Add(flash.Balloon);
                 }
                 else
                 {
                     notificationBalloons.Insert(0, flash.Balloon);
                 }
             }
             else
             {
                 existing.UpdateBody(flash.Balloon.BodyText);
                 existing.Refresh();
             }
         }
         Topmost = false;
         Topmost = true;
         if (!IsVisible)
         {
             ShowWindow();
         }
     }
     if (!BasicTeraData.Instance.WindowData.MuteSound && flash.Sound != null)
     {
         Task.Run(() => flash.Sound.Play());
     }
 }
 private void AddResults(List <AllDataSheetPart> results)
 {
     foreach (var item in results)
     {
         PartViewModel viewModel = PartViewModel.FromAllDataSheetPart(item);
         PartViewModel found     = m_savedParts.FirstOrDefault(x => x.Code == viewModel.Code);
         if (found != null)
         {
             viewModel = found;
         }
         PartViewModel.GetDownloadingIfExists(viewModel.Code, ref viewModel);
         if (viewModel.Context.OnlyContext)
         {
             viewModel.Context = item;
         }
         viewModel.LoadImage();
         m_searchResults.Add(viewModel);
     }
 }
示例#3
0
        public void UpdateStats()
        {
            if (IsPartyStats)
            {
                return;
            }

            //update stats
            DamageFraction = _tracker.TotalDealt.Damage == 0 ? 1 : (double)Damage / _tracker.TotalDealt.Damage;
            Dps            = _tracker.CalculateDps(Damage);

            //update personal DPS
            var firstOrDefault = _skillLog.FirstOrDefault(s => _tracker.IsValidAttack(s));
            var lastOrDefault  = _skillLog.LastOrDefault(s => _tracker.IsValidAttack(s));

            PersonalDps = (firstOrDefault != null && lastOrDefault != null)
                ? _tracker.CalculateDps(Damage, lastOrDefault.Time - firstOrDefault.Time)
                : _tracker.CalculateDps(Damage, TimeSpan.Zero);
        }