public void Paste()
        {
            var effectedRows = new SeatBox[_occupationClipboard.Length + 1];

            effectedRows[effectedRows.Length - 1] = SelectedSeat;
            Action applyChanges = () => { };

            for (var i = 0; i < _occupationClipboard.Length; i++)
            {
                var index      = i;
                var occupation = _occupationClipboard[i];
                _seatBoxes[occupation.Seat.Id.ToString()].SaftyInvoke <SeatBox>(o =>
                {
                    if (o.RemoveOccupation(occupation) && SelectedSeat.AddOccupation(occupation))
                    {
                        occupation.Seat = SelectedSeat.Seat;
                        applyChanges    =
                            occupation.Is <SeatArrangement>() ?
                            (() => TrySubmitChanged(false, ((SeatArrangement)occupation).Agent)) : new Action(() =>
                        {
                            _seatDispatcherModel.SubmitChanges();
                            _occupationClipboard = null;
                        });
                    }
                    effectedRows[index] = o;
                });
            }
            applyChanges.Invoke();
            Reload(effectedRows);
            OccupationsReloaded(null);
        }
示例#2
0
 protected override void OnShutdown()
 {
     if (_seatDispatcherModel != null)
     {
         ((IDisposable)_seatDispatcherModel).Dispose();
     }
     base.OnShutdown();
     this._schedule = null;
     if (this._areas != null)
     {
         this._areas.Clear();
         this._areas = null;
     }
     if (this._bindableSeats != null)
     {
         this._bindableSeats.Clear();
         this._bindableSeats = null;
     }
     if (this._seatBoxes != null)
     {
         this._seatBoxes.Clear();
         this._seatBoxes = null;
     }
     if (this._otherAgents != null)
     {
         this._otherAgents.Clear();
         this._otherAgents = null;
     }
     this._parentModel     = null;
     this._selectedArea    = null;
     this._selectedSeat    = null;
     this.TrySubmitChanged = null;
     this.BlockConverter.Dispose();
     this.BlockConverter = null;
 }