Esempio n. 1
0
        private void RejectEverything()
        {
            EventHandler <JumpItemsRejectedEventArgs> handler = JumpItemsRejected;

            if (handler == null)
            {
                _jumpItems.Clear();
                return;
            }

            if (_jumpItems.Count > 0)
            {
                var reasons = new List <JumpItemRejectionReason>(JumpItems.Count);
                for (int i = 0; i < JumpItems.Count; ++i)
                {
                    reasons.Add(JumpItemRejectionReason.InvalidItem);
                }
                // We're rejecting everything,
                // so create an event args with the original list and then clear it.
                var args = new JumpItemsRejectedEventArgs(JumpItems, reasons);
                _jumpItems.Clear();

                handler(this, args);
            }
        }
        private void OnJumpItemsRejected(object sender, JumpItemsRejectedEventArgs e)
        {
            var sb = new StringBuilder();
            sb.AppendFormat("{0} Jump Items Rejected:\n", e.RejectionReasons.Count);
            for (int i = 0; i < e.RejectionReasons.Count; ++i)
            {
                sb.AppendFormat("Reason: {0}\tItem: {1}\n", e.RejectionReasons[i], e.RejectedItems[i]);
            }

            MessageBox.Show(sb.ToString());
        }
Esempio n. 3
0
        private void RejectEverything()
        {
            EventHandler <JumpItemsRejectedEventArgs> jumpItemsRejected = this.JumpItemsRejected;

            if (jumpItemsRejected == null)
            {
                this._jumpItems.Clear();
            }
            else if (this._jumpItems.Count > 0)
            {
                List <JumpItemRejectionReason> reasons = new List <JumpItemRejectionReason>(this.JumpItems.Count);
                for (int i = 0; i < this.JumpItems.Count; i++)
                {
                    reasons.Add(JumpItemRejectionReason.InvalidItem);
                }
                JumpItemsRejectedEventArgs e = new JumpItemsRejectedEventArgs(this.JumpItems, reasons);
                this._jumpItems.Clear();
                jumpItemsRejected(this, e);
            }
        }
Esempio n. 4
0
        private void RejectEverything()
        {
            EventHandler<JumpItemsRejectedEventArgs> handler = JumpItemsRejected;
            if (handler == null)
            {
                _jumpItems.Clear();
                return;
            }

            if (_jumpItems.Count > 0)
            {
                var reasons = new List<JumpItemRejectionReason>(JumpItems.Count);
                for (int i = 0; i < JumpItems.Count; ++i)
                {
                    reasons.Add(JumpItemRejectionReason.InvalidItem);
                }
                // We're rejecting everything,
                // so create an event args with the original list and then clear it.
                var args = new JumpItemsRejectedEventArgs(JumpItems, reasons);
                _jumpItems.Clear();

                handler(this, args);
            }
        }