Exemplo n.º 1
0
        // Returns true if the expected result is right
        // Returns false if the expected result is wrong
        // one delegate object  is booldelegate
        // the other is voiddelegate
        public bool PosTest1()
        {
            bool retVal = true;
            TestLibrary.TestFramework.BeginScenario("PosTest1: hash code of two different delegate object is not equal,the two delegate callback different function. ");

            try
            {
                DelegateGetHashCode delctor = new DelegateGetHashCode();
                booldelegate workDelegate = new booldelegate(new TestClass(1).StartWork_Bool );
                voiddelegate workDelegate1 = new voiddelegate(new TestClass(1).StartWork_Void);
                if (workDelegate.GetHashCode() == workDelegate1.GetHashCode())
                {
                    TestLibrary.TestFramework.LogError("001", "HashCode is not excepted ");
                    retVal = false;
                }
               
                workDelegate();
                workDelegate1();

            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
                retVal = false;
            }

            return retVal;
        }
Exemplo n.º 2
0
        // Returns true if the expected result is right
        // Returns false if the expected result is wrong
        // one delegate object  is booldelegate
        // the other is voiddelegate
        public bool PosTest1()
        {
            bool retVal = true;
            TestLibrary.TestFramework.BeginScenario("PosTest1: hash code of two different delegate object is not equal,the two delegate callback different function. ");

            try
            {
                DelegateGetHashCode delctor = new DelegateGetHashCode();
                booldelegate workDelegate = new booldelegate(new TestClass(1).StartWork_Bool );
                voiddelegate workDelegate1 = new voiddelegate(new TestClass(1).StartWork_Void);
                if (workDelegate.GetHashCode() == workDelegate1.GetHashCode())
                {
                    TestLibrary.TestFramework.LogError("001", "HashCode is not excepted ");
                    retVal = false;
                }
               
                workDelegate();
                workDelegate1();

            }
            catch (Exception e)
            {
                TestLibrary.TestFramework.LogError("002", "Unexpected exception: " + e);
                retVal = false;
            }

            return retVal;
        }
            private voiddelegate invalidate;      // WORKAROUND
            private void Instance_PostRender(DrawingContext dc)
            {
                // The below workaround handles the issue that the OLED screen driver API cannot handle partial screen updates
                // WORKAROUND - when the clipping rectangle is not the full size, invalidate the whole window so we get called again with the full size
                int x, y, width, height;

                dc.GetClippingRectangle(out x, out y, out width, out height);
                if (x != 0 || y != 0 || width != dc.Width || height != dc.Height)
                {
                    //Debug.Print("Paint rectangle: x " + x + "  y " + y + " w " + width + " h " + height);
                    if (invalidate == null)
                    {
                        invalidate = new voiddelegate(WPFWindow.Invalidate); // WORKAROUND
                    }
                    Program.BeginInvoke(invalidate, null);                   // WORKAROUND
                    return;                                                  // WORKAROUND
                }

                Paint(dc.Bitmap);
            }
Exemplo n.º 4
0
 private voiddelegate invalidate; // WORKAROUND
 private void Instance_PostRender(DrawingContext dc)
 {
     
     // The below workaround handles the issue that the OLED screen driver API cannot handle partial screen updates
     // WORKAROUND - when the clipping rectangle is not the full size, invalidate the whole window so we get called again with the full size
     int x, y, width, height;
     dc.GetClippingRectangle(out x, out y, out width, out height);
     if (x != 0 || y != 0 || width != dc.Width || height != dc.Height)
     {
         //Debug.Print("Paint rectangle: x " + x + "  y " + y + " w " + width + " h " + height);
         if (invalidate == null) invalidate = new voiddelegate(WPFWindow.Invalidate);  // WORKAROUND
         Program.BeginInvoke(invalidate, null); // WORKAROUND
         return; // WORKAROUND
     }
  
     Paint(dc.Bitmap);
 }