Example #1
0
        internal void DisposeTablets()
        {
            if (_tablets != null)
            {
                for (int iTablet = 0, cTablets = _tablets.Length; iTablet < cTablets; iTablet++)
                {
                    if (_tablets[iTablet] != null)
                    {
                        WispTabletDevice removedTablet = _tablets[iTablet].TabletDeviceImpl.As <WispTabletDevice>();

                        // DevDiv:1078091
                        // Dispose the tablet unless there is input waiting
                        removedTablet.DisposeOrDeferDisposal();

                        // This is now a deferred disposal, move it to the deferred list
                        if (removedTablet.IsDisposalPending)
                        {
                            _deferredTablets.Add(removedTablet.TabletDevice);
                        }
                    }
                }
                _tablets      = null;
                TabletDevices = null;
            }
        }
Example #2
0
        void RemoveTablet(uint index)
        {
            System.Diagnostics.Debug.Assert(index < Count && Count > 0);

            WispTabletDevice removeTablet = _tablets[index].As <WispTabletDevice>();

            TabletDevice[] tablets = new TabletDevice[_tablets.Length - 1];

            uint preCopyCount  = index;
            uint postCopyCount = (uint)_tablets.Length - index - 1;

            Array.Copy(_tablets, 0, tablets, 0, preCopyCount);
            Array.Copy(_tablets, index + 1, tablets, index, postCopyCount);

            _tablets      = tablets;
            TabletDevices = new List <TabletDevice>(_tablets);

            // DevDiv:1078091
            // Dispose the tablet unless there is input waiting
            removeTablet.DisposeOrDeferDisposal();

            // This is now a deferred disposal, move it to the deferred list
            if (removeTablet.IsDisposalPending)
            {
                _deferredTablets.Add(removeTablet.TabletDevice);
            }
        }
Example #3
0
        internal WispStylusDevice UpdateStylusDevices(int tabletId, int stylusId)
        {
            if (_tablets == null)
            {
                throw new ObjectDisposedException("TabletDeviceCollection");
            }

            for (int iTablet = 0, cTablets = _tablets.Length; iTablet < cTablets; iTablet++)
            {
                WispTabletDevice tablet = _tablets[iTablet].As <WispTabletDevice>();
                if (tablet.Id == tabletId)
                {
                    return(tablet.UpdateStylusDevices(stylusId));
                }
            }
            return(null);
        }
Example #4
0
        internal void DisposeDeferredTablets()
        {
            List <TabletDevice> tabletTemp = new List <TabletDevice>();

            foreach (TabletDevice tablet in _deferredTablets)
            {
                WispTabletDevice tabletDevice = tablet.TabletDeviceImpl.As <WispTabletDevice>();

                // Attempt disposal again
                tabletDevice.DisposeOrDeferDisposal();

                // If still deferred it was not disposed
                if (tabletDevice.IsDisposalPending)
                {
                    tabletTemp.Add(tablet);
                }
            }

            _deferredTablets = tabletTemp;
        }