コード例 #1
0
        public void DisplayNextImage(object state)
        {
            using (SuspendPainting suspend = new SuspendPainting(_application.Root))
            {
                if (_background.ImageResource != null)
                {
                    // release old images
                    _background.ImageResource.Close();
                }
                _background.ImageResource = _foreground.ImageResource;

                _background.Transparency = 0;
                _foreground.Transparency = 1;

                _foreground.ImageResource = _application.GetImageResource(imageNames[_currentImageIndex]);

                _foreground.Animate(Animation.Fade(0, 0, FadeTime));
                _background.Animate(Animation.Fade(1, 0, FadeTime));
            }
            _currentImageIndex = (_currentImageIndex + 1) % imageNames.Count;
        }
コード例 #2
0
ファイル: BaseList.cs プロジェクト: ljvankuiken/tivo-sdks
        private void Update(bool animate)
        {
            using (SuspendPainting suspend = new SuspendPainting(this))
            {
                if (_selected == -1 && Count != 0)
                {
                    _selected = 0;
                    OnSelectionChanged();
                }

                //
                // 1. update "top" so that selected is still visible
                //
                _top = Math.Max(Math.Min(_top, Count - _numberOfVisibleRows), 0);

                int max = Math.Min(_top + _numberOfVisibleRows, Count) - 1;
                if (_selected < _top)
                {
                    _top = Math.Max(0, _selected);
                }
                else if (_selected > max)
                {
                    int end = Math.Min(_selected + 1, Count);
                    _top = Math.Max(end - _numberOfVisibleRows, 0);
                }
                max = Math.Min(_top + _numberOfVisibleRows, Count) - 1;

                //
                // 2. populate rows and put them at the correct height
                //

                for (int i = _top; i <= max; ++i)
                {
                    View v = _rows[i];
                    if (v == null)
                    {
                        v        = CreateRow(i);
                        _rows[i] = v;
                    }
                    else
                    {
                        v.Location = new System.Drawing.Point(v.Location.X, i * _rowHeight);
                    }
                }

                //
                // 3. fix "dirty" rows
                //

                if (_dirty != -1)
                {
                    max = Math.Min(_dirty + _numberOfVisibleRows, Count) - 1;
                    for (int i = _dirty; i <= max; ++i)
                    {
                        View v = _rows[i];
                        if (v != null)
                        {
                            v.Location = new System.Drawing.Point(v.Location.X, i * _rowHeight);
                        }
                    }
                    _dirty = -1;
                }

                //
                // 4. translate to the right location
                //

                this.Animate(Animation.Translate(new System.Drawing.Point(0, -_top * _rowHeight), 0, animTime));

                //
                // 5. move the selector
                //

                if (_selected >= 0)
                {
                    _selector.Visible = true;
                    _selector.Animate(Animation.Move(new System.Drawing.Point(0, _selected * _rowHeight), 0, animTime));
                }
                else
                {
                    _selector.Visible = false;
                }
            }
        }