Equals() public method

public Equals ( Size value ) : bool
value Size
return bool
Beispiel #1
0
		public void Equals ()
		{
			Size s = new Size (10, 20);

			Assert.IsTrue (s.Equals (s));
			Assert.IsTrue (s.Equals (new Size (10, 20)));

			Assert.IsTrue (Size.Equals (s, s));

			Assert.IsFalse (s.Equals (new Size (5, 10)));
			Assert.IsFalse (Size.Equals (s, new Size (5, 10)));

			Assert.IsFalse (s.Equals (new object()));
		}
Beispiel #2
0
		public void QuasiEquality ()
		{
			Size expected = new Size (25, 25);
			Size actual = new Size (25.000000000000001, 25.000000000000001);
			Assert.IsTrue (expected.Equals (actual), "Equals(Size)");
			Assert.IsTrue (actual.Equals ((object)expected), "Equals(object)");

			actual = new Size (25.00000000000001, 25.00000000000001);
			Assert.IsFalse (expected.Equals (actual), "not-Equals(Size)");
			Assert.IsFalse (actual.Equals ((object) expected), "not-Equals(object)");
		}
Beispiel #3
0
        protected override Size MeasureOverride(Size availableSize)
        {
            var idealSize = new Size(0, 0);

            // Allow children as much room as they want - then scale them
            var size = new Size(Double.PositiveInfinity, Double.PositiveInfinity);
            foreach (UIElement child in Children)
            {
                child.Measure(size);
                // first card gets full width, following cards only ask for a fraction to keep scroller reasonable; they take up more if available
                if (idealSize.Equals(new Size(0, 0))) idealSize.Width += child.DesiredSize.Width;
                else idealSize.Width += child.DesiredSize.Width / 3;

                idealSize.Height = Math.Max(idealSize.Height, child.DesiredSize.Height);
            }

            // EID calls us with infinity, but framework doesn't like us to return infinity
            if (double.IsInfinity(availableSize.Height) || double.IsInfinity(availableSize.Width))
                return idealSize;
            return availableSize;
        }
Beispiel #4
0
        /// <summary>
        /// Create the underlying Browser instance, can be overriden to defer control creation
        /// The browser will only be created when size &gt; Size(0,0). If you specify a positive
        /// size then the browser will be created, if the ActualWidth and ActualHeight
        /// properties are in reality still 0 then you'll likely end up with a browser that
        /// won't render.
        /// </summary>
        /// <param name="size">size of the current control, must be greater than Size(0, 0)</param>
        /// <returns>bool to indicate if browser was created. If the browser has already been created then this will return false.</returns>
        protected virtual bool CreateOffscreenBrowser(Size size)
        {
            if (browserCreated || System.ComponentModel.DesignerProperties.GetIsInDesignMode(this) || size.IsEmpty || size.Equals(new Size(0, 0)))
            {
                return false;
            }

            var webBrowserInternal = this as IWebBrowserInternal;
            if (!webBrowserInternal.HasParent)
            {
                managedCefBrowserAdapter.CreateOffscreenBrowser(source == null ? IntPtr.Zero : source.Handle, BrowserSettings, RequestContext, Address);
            }
            browserCreated = true;

            return true;
        }
Beispiel #5
0
		public static bool Equals (Size size1, Size size2)
		{
			return size1.Equals (size2);
		}
 /// <summary>
 /// Writes the attribute.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="value">The value.</param>
 /// <param name="defaultValue">The default value.</param>
 protected void WriteAttribute(string name, Size value, Size defaultValue)
 {
     if (this.settings.WriteDefaultValues || !value.Equals(defaultValue)) {
         this.writer.WriteAttributeString(name, value.Format());
     }
 }
Beispiel #7
0
 public static bool Equals(Size size1, Size size2)
 {
     return(size1.Equals(size2));
 }