Beispiel #1
0
 public AdContext(ClipContext clipContext)
 {
     if (clipContext == null)
     {
         throw new ArgumentNullException("clipContext");
     }
     _clipContext = clipContext;
 }
 public LinearAdContext(ClipContext clipContext, SmoothStreamingMediaElement ssme)
     : base(clipContext)
 {
     if (ssme == null)
     {
         throw new ArgumentNullException("ssme");
     }
     _ssme = ssme;
 }
        public void process_left_clip_of_feature_expect_clipped_feature()
        {
            var features = this.getSimplePointFeatures();
            var context  = new ClipContext(Constants.ClipType.Left, 64d / 4096d);

            foreach (var feature in features)
            {
                var clipper = new Clip(feature, context);
                Assert.IsNull(clipper.ClippedFeature);
            }
        }
        public void generate_clip_expect_proper_type_discernment()
        {
            IClipContext clip = new ClipContext(Constants.ClipType.Left, 64d / 4096d);

            Assert.AreEqual(0, clip.Axis);
            Assert.AreEqual(-1.015625d, clip.K1);
            Assert.AreEqual(0.015625d, clip.K2);
            Assert.AreEqual(-1, clip.MinAll);
            Assert.AreEqual(2, clip.MaxAll);
            Assert.AreEqual(1, clip.Scale);
            Assert.AreEqual(Constants.ClipType.Left, clip.Type);
        }
Beispiel #5
0
        public async Task <List <SelectedApp> > GetSelectedApps()
        {
            using (var context = new ClipContext())
            {
                context.SelectedClips.Add(new SelectedApp("firefox"));
                await context.SaveChangesAsync();

                List <SelectedApp> apps = await(from a in context.SelectedClips select a).ToListAsync();
                foreach (var app in apps)
                {
                    _selectedApps.Add(app.AppName);
                }
                return(apps);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Repaints cursor on the screen.
        /// </summary>
        ///
        internal void RepaintCursor(Screen screen)
        {
            if (screen == null)
            {
                return;
            }

            // When RepaintCurosr() is called for root window of the screen
            // (having no parent), we need to setup a default cursor (which is an
            // invisible cursor at position ( 0, 0 ).
            //
            if (Parent == null)
            {
                screen.SetCursorPosition(0, 0);
                screen.CursorVisible = false;
            }

            ClipContext clipContext = new ClipContext(screen, Left, Top);

            clipContext.Clip(ClientWidth, ClientHeight);

            if (children.Count > 0)
            {
                ActiveChild.RepaintCursor(screen);
            }
            else
            {
                if (CursorVisible && screen.IsVisible(CursorLeft, CursorTop))
                {
                    screen.SetCursorPosition(
                        screen.Offset.X + CursorLeft, screen.Offset.Y + CursorTop);
                    screen.CursorVisible = true;
                }
            }

            clipContext.Restore();
        }
Beispiel #7
0
 public ClipRepository(ClipContext context) : base(context)
 {
 }
 public AdContext(ClipContext clipContext)
 {
     if (clipContext == null) throw new ArgumentNullException("clipContext");
     _clipContext = clipContext;
 }
 public LinearAdContext(ClipContext clipContext, SmoothStreamingMediaElement ssme)
     : base(clipContext)
 {
     if (ssme == null) throw new ArgumentNullException("ssme");
     _ssme = ssme;
 }
Beispiel #10
0
        /////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Repaints window contents on the screen.
        /// </summary>
        ///
        internal bool Repaint(Screen screen, bool parentHasFocus = true)
        {
            if (screen == null)   // FIXME: screen null OR INVISIBLE
            {
                return(false);
            }

            if (!Visible)
            {
                Invalidated = false;
                return(false);
            }

            bool hasFocus = Parent == null || /* root window always has focus */
                            (parentHasFocus && Parent.ActiveChild == this);

            if (Invalidated)
            {
                OnCalculateSize(hasFocus);
            }

            // Setup clipping region and drawing offset
            //
            ClipContext clipContext = new ClipContext(screen, Left, Top);

            clipContext.Clip(ClientWidth, ClientHeight);

            bool repainted  = false;
            bool drawBorder = false;

            if (Invalidated)
            {
                // Setup default cursor position and drawing colors first, then
                // erase background and draw contents
                //
                screen.SetCursorPosition(0, 0);

                if (hasFocus)
                {
                    screen.BackColor = BackColor;
                    screen.ForeColor = ForeColor;
                }
                else
                {
                    screen.BackColor = BackColorInact;
                    screen.ForeColor = ForeColorInact;
                }

                ColorContext savedColor = new ColorContext(screen);

                OnEraseBackground(screen);

                savedColor.Restore();

                OnDrawContents(screen, hasFocus);

                savedColor.Restore();

                drawBorder  = true;
                repainted   = true;
                Invalidated = false;
            }

            // Repaint children.
            // Algorithm: At the beginning, 'repainted' flag is usually false.
            // First child, which returns that it has repainted itself, turns-on
            // 'repainted' flag further on so the all consecutive siblings are
            // invalidated (and repainted).
            //
            foreach (Window subWindow in children)
            {
                if (repainted)
                {
                    subWindow.Invalidate();  // Force child to be Repaint()-ed
                }

                if (subWindow.Repaint(screen, hasFocus))
                {
                    repainted = true;
                }
            }

            // Draw window edges (with parent's offset but without clipping!)
            //
            if (drawBorder)
            {
                clipContext.RestoreClipRegion();

                if (hasFocus)
                {
                    screen.BackColor = BorderBackColor;
                    screen.ForeColor = BorderForeColor;
                }
                else
                {
                    screen.BackColor = BorderBackColorInact;
                    screen.ForeColor = BorderForeColorInact;
                }

                OnDrawBorder(screen, hasFocus);
            }

            // Restore clipping region and drawing offset
            //
            clipContext.Restore();

            return(repainted);
        }