Пример #1
0
        private void Work_Timer_Tick(object state)
        {
            TryCount++;

            if (IsPermission && this.cursor != null)
            {
                workTimer.Dispose();
                workTimer = null;

                string mmsId = string.Empty;

                Coupon coupon = new Coupon();

                try
                {
                    foreach (var key in Keys.Where(x => x.Value == false))
                    {
                        if (Values.TryGetValue(key.Key, out coupon))
                        {
                            coupon.Bind();
                            if (coupon.IsBinding)
                            {
                                Sender.Enqueue(coupon);
                            }
                        }

                        Keys.AddOrUpdate(key.Key, true, (x, y) => true);
                    }

                    progressText.Text = $"{Sender.Count()} / {Values.Count()} / {Keys.Count()}";
                    workTimer         = new Timer(Work_Timer_Tick, null, WorkingTime, Timeout.Infinite);
                }
                catch (System.Exception ex)
                {
                    msgText.Text = ex.Message;
                }
                finally
                {
                    postionText.Text = $"Count : {this.TryCount}";
                }
            }
        }