コード例 #1
0
 void EvaluateStatsAroundLevel(int level)
 {
     lock (ToEvaluate)
     {
         for (int i = level - 1; i <= level + 1; i++)
         {
             if (i >= 1 && i <= t.Game.MaxLevel)
             {
                 if (!ToEvaluate.Contains(i))
                 {
                     RHeaders[i - 1][0].Icon = "⋯";
                     ToEvaluate.Add(i);
                 }
             }
         }
     }
     Task.Run(async() =>
     {
         await ss.WaitAsync();
         try
         {
             while (true)
             {
                 int lev = -1;
                 lock (ToEvaluate)
                 {
                     if (ToEvaluate.Count == 0)
                     {
                         return;
                     }
                     lev = ToEvaluate.First();
                     ToEvaluate.Remove(lev);
                 }
                 var lst = EvaluateLevelStats(manager.LevelStatus(t, lev), lev);
                 lock (ToEvaluate)
                 {
                     if (!ToEvaluate.Contains(lev))
                     {
                         RHeaders[lev - 1][0].Status = lst.status;
                         RHeaders[lev - 1][0].Icon   = lst.icon;
                     }
                 }
             }
         }
         finally { ss.Release(); }
     });
 }
コード例 #2
0
        public ParamTypeViewModel(FakeDAL dal, BuildParameterType t, BuildDefinitionManager manager)
        {
            this.dal     = dal;
            this.manager = manager;
            this.t       = t;
            Name         = t.Name;
            Type         = GetType().Name;

            var Popup = new MvxCommand <string>(s => StatusModal = s);

            ClosePopup = new MvxCommand(() => StatusModal = null);

            // Row Headers
            RHeaders = Enumerable.Range(1, t.Game.MaxLevel)
                       .Select(x =>
            {
                var xx = EvaluateLevelStats(manager.LevelStatus(t, x), x);
                return(new[] { new RHVM {
                                   Level = x, Status = xx.status, Icon = xx.icon, StatusTap = Popup
                               } }.ToList() as IList <RHVM>);
            })
                       .ToList();
            manager.ParameterChanged += EvaluateStatsAroundLevel;
        }