示例#1
0
        private void ButtonBase1_OnClick(object sender, RoutedEventArgs e)
        {
            object a = null;

            this.Dispatcher.BeginInvoke((Action)(() =>
            {
                MessageBox.Show("b");
            }));

            MessageBox.Show("a");
            System.Threading.Thread.Sleep(5000);
            Test1     test  = new Test1();
            TestEnum2 enum1 = TestEnum2.Test1;

            switch (enum1)
            {
            case TestEnum2.Test1:
                break;

            case TestEnum2.Test2:
                break;

            case TestEnum2.Test3:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#2
0
 private PropertyValidationResult ValidateNotJ(TestEnum2 arg)
 {
     if (arg == TestEnum2.OptionJ)
     {
         return(new PropertyValidationResult(ValidationResult.Warning, "You chose J."));
     }
     return(new PropertyValidationResult(ValidationResult.Ok));
 }
示例#3
0
        public static void Test05()
        {
            TestEnum  a = TestEnum.Enum4;
            TestEnum2 b = (TestEnum2)a;

            Console.WriteLine("b=" + b);
            TestEnum3 c = (TestEnum3)EnumTest.b;

            Console.WriteLine("c=" + c);
        }
        public static Complex dnaEnumParameters(TestEnum1 val1, TestEnum2 val2)
        {
            //return val.HasValue ? val.Value : TestEnum.Zero;
            double r = 0;

            if (val1 == TestEnum1.Negative)
            {
                r = -1;
            }
            else if (val1 == TestEnum1.Positive)
            {
                r = +1;
            }
            double c = 0;

            if (val2 == TestEnum2.Imaginary)
            {
                c = 1;
            }
            return(new Complex(r, c));
        }
示例#5
0
        public void No_collision_between_types()
        {
            // arrange
            const TestEnum  test  = TestEnum.Value2;
            const TestEnum2 test2 = TestEnum2.Value2;

            // act
            var result1 = test.StringValue();
            var result2 = test2.StringValue();

            // assert
            result1
            .Should()
            .Be("bar");
            result2
            .Should()
            .Be("bar-2");
            "bar".EnumValue <TestEnum>()
            .Should()
            .Be(TestEnum.Value2);
            "bar-2".EnumValue <TestEnum2>()
            .Should()
            .Be(TestEnum2.Value2);
        }
示例#6
0
文件: test-478.cs 项目: nobled/mono
		public TestAttribute( TestEnum2 value ) {
		}
示例#7
0
 public abstract TestEnum2 ShowEnum(TestEnum2 val);
示例#8
0
 public TestScenePropertyManagement()
 {
     Add(new FillFlowContainer
     {
         RelativeSizeAxes = Axes.Both,
         Children         = new Drawable[]
         {
             flow = new FillFlowContainer <PropertyEditor>
             {
                 RelativeSizeAxes = Axes.X,
                 AutoSizeAxes     = Axes.Y,
                 Children         = new PropertyEditor[]
                 {
                     new LimitedNumericPropertyEditor <int>(new LimitedNumericProperty <int>("Limited integer", "A whole number with minimum and maximum values (-10, 50). Can't be 42.", -10, 50, () => integer, v => integer = v, ValidateIntegerNot42))
                     {
                         Padding = new MarginPadding(12), Width = 400
                     },
                     new EnumPropertyEditor <TestEnum>(new EnumProperty <TestEnum>("Test enum property 1", "We're testing enumerable properties here. Selecting one results in an error", () => theEnum, v => theEnum = v, ValidateEnumNotOne))
                     {
                         Padding = new MarginPadding(12), Width = 400
                     },
                     new EnumPropertyEditor <TestEnum2>(new EnumProperty <TestEnum2>("Test enum property 2", "More, the searchbox should be shown now. Selecting the last option results in a warning.", () => secondEnum, v => secondEnum = v, ValidateNotJ))
                     {
                         Padding = new MarginPadding(12), Width = 400
                     },
                     new StringPropertyEditor(new StringProperty("Text property", "A string of letters. Length between 3 and 9 inclusive, can only contain either numbers or letters, but not both. Allowable length should be displayed in the future", () => text, v => text = v, ValidateText))
                     {
                         Padding = new MarginPadding(12), Width = 400
                     },
                 }
             },
             infoText = new TextFlowContainer
             {
                 AutoSizeAxes = Axes.Both
             }
         }
     });
     AddSliderStep("Spacing+padding X", 0, 20f, 0, v => SetSpacing(v, true));
     AddSliderStep("Spacing+padding Y", 0, 20f, 0, v => SetSpacing(v, false));
     AddToggleStep("Toggle autosave", ToggleAutosave);
     AddStep("Save properties", Save);
 }
 public static Complex dnaNullableEnum(TestEnum1? val1, TestEnum2? val2)
 {
     //return val.HasValue ? val.Value : TestEnum.Zero;
     double r = 0;
     if (val1.HasValue && val1 == TestEnum1.Negative)
         r = -1;
     else if (val1 == TestEnum1.Positive)
         r = +1;
     double c = 0;
     if (val2.HasValue && val2 == TestEnum2.Imaginary)
         c = 1;
     return new Complex(r, c);
 }
示例#10
0
 public TestAttribute(TestEnum2 value)
 {
 }
示例#11
0
 public ObjectReference2(TestEnum2 targetType, int tagetId)
 {
     TargetType = targetType;
     TargetID   = tagetId;
 }
示例#12
0
 public abstract TestEnum2 ShowEnum(TestEnum2 val, string wrong);
示例#13
0
 public abstract string ShowEnum(TestEnum2 val);
 public static Complex dnaEnumParameters(TestEnum1 val1, TestEnum2 val2)
 {
     //return val.HasValue ? val.Value : TestEnum.Zero;
     double r = 0;
     if (val1 == TestEnum1.Negative)
         r = -1;
     else if (val1 == TestEnum1.Positive)
         r = +1;
     double c = 0;
     if (val2 == TestEnum2.Imaginary)
         c = 1;
     return new Complex(r, c);
 }
 public EnumsCombined(TestEnum2 v)
 {
     Enum2 = v;
 }
 public virtual TestEnum2 NotShowEnum(TestEnum2 val) => default;
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3: Equals should return false when comparing with instance of different classes");

        try
        {
            TestEmptyClass    classInstance1       = new TestEmptyClass();
            TestClass         classInstance2       = new TestClass();
            RuntimeTypeHandle classInstanceHandle1 = classInstance1.GetType().TypeHandle;
            RuntimeTypeHandle classInstanceHandle2 = classInstance2.GetType().TypeHandle;

            if (classInstanceHandle1.Equals(classInstanceHandle2))
            {
                TestLibrary.TestFramework.LogError("003.1", "Equals returns true when comparing with instance of different classe");
                retVal = false;
            }

            TestStruct1       ts1           = new TestStruct1();
            TestStruct2       ts2           = new TestStruct2();
            RuntimeTypeHandle structHandle1 = ts1.GetType().TypeHandle;
            RuntimeTypeHandle structHandle2 = ts2.GetType().TypeHandle;
            if (structHandle1.Equals(structHandle2))
            {
                TestLibrary.TestFramework.LogError("003.2", "Equals returns false when comparing with instance of different structs");
                retVal = false;
            }

            TestEnum1         te1         = TestEnum1.DEFAULT;
            TestEnum2         te2         = TestEnum2.DEFAULT;
            RuntimeTypeHandle enumHandle1 = te1.GetType().TypeHandle;
            RuntimeTypeHandle enumHandle2 = te2.GetType().TypeHandle;
            if (enumHandle1.Equals(enumHandle2))
            {
                TestLibrary.TestFramework.LogError("003.3", "Equals returns false when comparing with instance of different enums");
                retVal = false;
            }

            if (classInstanceHandle1.Equals(structHandle1))
            {
                TestLibrary.TestFramework.LogError("003.4", "Equals returns false when comparing a instance of struct with a instance of class");
                retVal = false;
            }

            if (classInstanceHandle1.Equals(enumHandle1))
            {
                TestLibrary.TestFramework.LogError("003.5", "Equals returns false when comparing a instance of enum with a instance of class");
                retVal = false;
            }

            if (structHandle1.Equals(enumHandle1))
            {
                TestLibrary.TestFramework.LogError("003.6", "Equals returns false when comparing a instance of struct with a instance of enum");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("003.7", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
 public virtual string ShowEnum(TestEnum2 val) => default;
示例#19
0
 [MethodImpl(MethodImplOptions.NoInlining)] public TestEnum2 TestEnum2Convert(TestEnum2 value) => value;
 public virtual TestEnum2 ShowEnum(TestEnum2 val, string wrong) => default;
示例#21
0
			public ObjectReference2(TestEnum2 targetType, int tagetId)
			{
				TargetType = targetType;
				TargetID = tagetId;
			}
示例#22
0
 public FakeRoutableCommandWithEnum(TestEnum1 test1, TestEnum2 test2)
 {
     Test1 = test1;
     Test2 = test2;
 }