Exemple #1
0
        private bool TryGetTimeToFinish(double value, out TimeSpan t)
        {
            var result = false;
            var time   = DateTime.Now - Start;
            var values = State.GetStates(Key);

            t = TimeSpan.Zero;
            if (values.Count() >= 2)
            {
                var v = GetY(values, value);
                time   = new TimeSpan((time + v).Ticks / 2);
                t      = values.Last().Time - time;
                result = true;
            }

            var exact = values.SingleOrDefault(o => Math.Abs(o.Value - value) < 0.01);

            if (exact == null)
            {
                exact = new StateItem
                {
                    Key   = Key,
                    Value = value,
                    Time  = time
                };
                State.Add(exact);
            }
            else
            {
                exact.Time = time;
            }

            return(result);
        }
Exemple #2
0
        private bool TryGetTimeToFinish(double value, out TimeSpan t)
        {
            var result = false;
            var time = DateTime.Now - Start;
            var values = State.GetStates(Key);
            t = TimeSpan.Zero;
            if (values.Count() >= 2)
            {
                var v = GetY(values, value);
                time = new TimeSpan((time + v).Ticks/2);
                t = values.Last().Time - time;
                result = true;
            }

            var exact = values.SingleOrDefault(o => Math.Abs(o.Value - value) < 0.01);
            if (exact == null)
            {
                exact = new StateItem
                {
                    Key = Key,
                    Value = value,
                    Time = time
                };
                State.Add(exact);
            }
            else
            {
                exact.Time = time;
            }

            return result;
        }
Exemple #3
0
 public void Add(StateItem stateItem)
 {
     _items.Add(stateItem);
 }
Exemple #4
0
 public void Add(StateItem stateItem)
 {
     _items.Add(stateItem);
 }