Exemple #1
0
 public WallCatalogResource(int APIversion,
     uint version,
     uint unknown2,
     Common common,
     Wall wallType,
     Partition partitionType,
     PartitionFlagsType partitionFlags,
     VerticalSpan verticalSpanType,
     PartitionsBlockedFlagsType partitionsBlockedFlags,
     PartitionsBlockedFlagsType adjacentPartitionsBlockedFlags,
     PartitionTool partitionToolMode,
     ToolUsageFlagsType toolUsageFlags,
     uint defaultPatternIndex,
     WallThickness wallThicknessType,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.unknown2 = unknown2;
     this.wallType = wallType;
     this.partitionType = partitionType;
     this.partitionFlags = partitionFlags;
     this.verticalSpanType = verticalSpanType;
     this.partitionsBlockedFlags = partitionsBlockedFlags;
     this.adjacentPartitionsBlockedFlags = adjacentPartitionsBlockedFlags;
     this.partitionToolMode = partitionToolMode;
     this.toolUsageFlags = toolUsageFlags;
     this.defaultPatternIndex = defaultPatternIndex;
     this.wallThicknessType = wallThicknessType;
 }
        public void Cut()
        {
            VerticalSpan verticalSpan = new VerticalSpan(new Rect(10, 10, 10, 10)).Minus(new Rect(10, 15, 5, 5));

            Assert.Equal(true, verticalSpan.DoesntContain(new Rect(10, 10, 10, 12)));
            Assert.Equal(false, verticalSpan.DoesntContain(new Rect(10, 10, 10, 4)));
        }
Exemple #3
0
        public void CalculateWhenListItemsDropUp()
        {
            var          calculator   = new WPFComboBoxVerticalSpanCalculator(Rectangle(70), Rectangle(10), Rectangle(100), 60);
            VerticalSpan verticalSpan = calculator.VerticalSpan;

            Assert.AreEqual(10, verticalSpan.Start);
            Assert.AreEqual(70, verticalSpan.End);
        }
        public void Calculate()
        {
            var          calculator   = new WPFComboBoxVerticalSpanCalculator(Rectangle(0), Rectangle(10), Rectangle(100), 60);
            VerticalSpan verticalSpan = calculator.VerticalSpan;

            Assert.Equal(10, verticalSpan.Start);
            Assert.Equal(70, verticalSpan.End);
        }
Exemple #5
0
        internal virtual void MakeVisible(VerticalSpanProvider verticalSpanProvider)
        {
            if (verticalScroll == null)
            {
                logger.DebugFormat("Vertical scrollbar not present in parent of {0}", uiItem);
                return;
            }
            if (!verticalScroll.IsScrollable)
            {
                logger.DebugFormat("Vertical scrollbar is not scrollable for parent of {0}", uiItem);
                return;
            }

            VerticalSpan verticalSpan = verticalSpanProvider.VerticalSpan;

            if (verticalSpan.Contains(uiItem.Bounds))
            {
                logger.DebugFormat("UIItem ({0}) whose bounds are ({1}) is within bounds of parent whose vertical span is {2}", uiItem,
                                   uiItem.Bounds, verticalSpan);
                return;
            }

            if (verticalScroll.IsNotMinimum)
            {
                verticalScroll.SetToMinimum();
                verticalSpan = verticalSpanProvider.VerticalSpan;
                logger.DebugFormat("Scroll Position set to minimum value.");
            }

            if (verticalSpan.Contains(uiItem.Bounds))
            {
                logger.DebugFormat("UIItem ({0}) whose bounds are ({1}) is within bounds of parent whose vertical span is {2}", uiItem,
                                   uiItem.Bounds, verticalSpan);
                return;
            }

            logger.DebugFormat("Trying to make visible {0}, item's bounds are {1} and parent's span is {2}", uiItem, uiItem.Bounds, verticalSpan);

            var success = Retry.For(
                () =>
            {
                verticalScroll.ScrollDownLarge();
                var bounds = uiItem.Bounds;
                const string messageFormat = "Trying to make {0} visible, item's bounds are {1} and parent's span is {2}";
                logger.DebugFormat(messageFormat, uiItem, bounds, verticalSpan);
                return(verticalSpan.Contains(bounds));
            }, CoreAppXmlConfiguration.Instance.BusyTimeout(), TimeSpan.FromMilliseconds(0));

            if (!success)
            {
                throw new UIActionException(string.Format("Could not make the {0} visible{1}", uiItem, Constants.BusyMessage));
            }
        }
Exemple #6
0
        internal virtual void MakeVisible(VerticalSpanProvider verticalSpanProvider)
        {
            if (verticalScroll == null)
            {
                WhiteLogger.Instance.DebugFormat("Vertical scrollbar not present in parent of {0}", uiItem);
                return;
            }
            if (!verticalScroll.IsScrollable)
            {
                WhiteLogger.Instance.DebugFormat("Vertical scrollbar is not scrollable for parent of {0}", uiItem);
                return;
            }

            VerticalSpan verticalSpan = verticalSpanProvider.VerticalSpan;

            if (verticalScroll.IsNotMinimum)
            {
                verticalScroll.SetToMinimum();
                verticalSpan = verticalSpanProvider.VerticalSpan;
                WhiteLogger.Instance.DebugFormat("Scroll Position set to minimum value.");
            }

            if (verticalSpan.Contains(uiItem.Bounds))
            {
                WhiteLogger.Instance.DebugFormat("UIItem ({0}) whose bounds are ({1}) is within bounds of parent whose vertical span is {2}", uiItem,
                                                 uiItem.Bounds, verticalSpan);
                return;
            }

            WhiteLogger.Instance.DebugFormat("Trying to make visible {0}, item's bounds are {1} and parent's span is {2}", uiItem, uiItem.Bounds,
                                             verticalSpan);
            var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout, 0);

            clock.RunWhile(() => verticalScroll.ScrollDownLarge(), delegate
            {
                Rect bounds = uiItem.Bounds;
                WhiteLogger.Instance.DebugFormat(
                    "Trying to make     visible {0}, item's bounds are {1} and parent's span is {2}",
                    uiItem, bounds, verticalSpan);
                return(verticalSpan.DoesntContain(bounds));
            },
                           delegate { throw new UIActionException(string.Format("Could not make the {0} visible{1}", uiItem, Constants.BusyMessage)); });
        }
Exemple #7
0
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);

            this.unknown2 = r.ReadUInt32();
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            this.wallType = (Wall)r.ReadUInt32();
            this.partitionType = (Partition)r.ReadUInt32();
            this.partitionFlags = (PartitionFlagsType)r.ReadUInt32();
            this.verticalSpanType = (VerticalSpan)r.ReadUInt32();
            this.partitionsBlockedFlags = (PartitionsBlockedFlagsType)r.ReadUInt32();
            this.adjacentPartitionsBlockedFlags = (PartitionsBlockedFlagsType)r.ReadUInt32();
            this.partitionToolMode = (PartitionTool)r.ReadUInt32();
            this.toolUsageFlags = (ToolUsageFlagsType)r.ReadUInt32();
            this.defaultPatternIndex = r.ReadUInt32();
            this.wallThicknessType = (WallThickness)r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(WallCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }
Exemple #8
0
        public void EmptyIsOutsideTest()
        {
            var verticalSpan = new VerticalSpan(new Rect(10, 10, 10, 10));

            Assert.That(verticalSpan.DoesntContain(Rect.Empty), Is.True);
        }
Exemple #9
0
        public void EmptyIsOutside()
        {
            var verticalSpan = new VerticalSpan(new Rect(10, 10, 10, 10));

            Assert.AreEqual(true, verticalSpan.DoesntContain(Rect.Empty));
        }
Exemple #10
0
 public void UnionTest()
 {
     var verticalSpan = new VerticalSpan(new Rect(10, 10, 0, 10)).Union(new Rect(10, 5, 0, 10));
     Assert.That(verticalSpan.DoesntContain(new Rect(10, 10, 0, 5)), Is.False);
     Assert.That(verticalSpan.DoesntContain(new Rect(10, 10, 0, 10)), Is.False);
 }
Exemple #11
0
 public void EmptyIsOutsideTest()
 {
     var verticalSpan = new VerticalSpan(new Rect(10, 10, 10, 10));
     Assert.That(verticalSpan.DoesntContain(Rect.Empty), Is.True);
 }
Exemple #12
0
 public void CutTest()
 {
     var verticalSpan = new VerticalSpan(new Rect(10, 10, 10, 10)).Minus(new Rect(10, 15, 5, 5));
     Assert.That(verticalSpan.DoesntContain(new Rect(10, 10, 10, 12)), Is.True);
     Assert.That(verticalSpan.DoesntContain(new Rect(10, 10, 10, 4)), Is.False);
 }
Exemple #13
0
 public void Union()
 {
     VerticalSpan verticalSpan = new VerticalSpan(new Rect(10, 10, 0, 10)).Union(new Rect(10, 5, 0, 10));
     Assert.Equal(false, verticalSpan.DoesntContain(new Rect(10, 10, 0, 5)));
     Assert.Equal(false, verticalSpan.DoesntContain(new Rect(10, 10, 0, 10)));
 }
Exemple #14
0
 public void EmptyIsOutside()
 {
     var verticalSpan = new VerticalSpan(new Rect(10, 10, 10, 10));
     Assert.Equal(true, verticalSpan.DoesntContain(Rect.Empty));
 }
Exemple #15
0
 public void Cut()
 {
     VerticalSpan verticalSpan = new VerticalSpan(new Rect(10, 10, 10, 10)).Minus(new Rect(10, 15, 5, 5));
     Assert.Equal(true, verticalSpan.DoesntContain(new Rect(10, 10, 10, 12)));
     Assert.Equal(false, verticalSpan.DoesntContain(new Rect(10, 10, 10, 4)));
 }