예제 #1
0
        static void Main(string[] args)
        {
            Section1.Examples();
            Console.Out.WriteLine();

            Section3.Examples();
            Console.Out.WriteLine();

            Section4.Examples();
            Console.Out.WriteLine();
        }
예제 #2
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hash = 12;

                hash = hash * 32 + Section0.GetHashCode();
                hash = hash * 32 + Section1.GetHashCode();
                hash = hash * 32 + Section2.GetHashCode();
                hash = hash * 32 + Section3.GetHashCode();
                hash = hash * 32 + Section4.GetHashCode();
                hash = hash * 32 + Section5.GetHashCode();
                hash = hash * 32 + Section6.GetHashCode();

                return(hash);
            }
        }
예제 #3
0
 public ActionResult <Section3> Load([FromBody] Section3 param)
 {
     if (param == null)
     {
         param          = new Section3();
         param._message = _localizer["No parameters."];
         return(BadRequest(param));
     }
     try
     {
         param.Item1 = (Guid.NewGuid()).ToString();
         return(Ok(param));
     }
     catch (Exception ex)
     {
         param._message = _localizer["System error Please inform system personnel.({0})", ex.Message];
         return(BadRequest(param));
     }
 }
예제 #4
0
        private async void Start()
        {
            double margin = ActualHeight / 30;

            Section1.Margin = Section2.Margin = Section3.Margin = new Thickness(margin);

            var anim = new DoubleAnimation(ActualHeight / 2, ActualHeight - margin * 2, new Duration(TimeSpan.FromMilliseconds(AnimationTime)));

            anim.RepeatBehavior    = RepeatBehavior.Forever;
            anim.AutoReverse       = true;
            anim.AccelerationRatio = .85;

            Section1.Height = Section2.Height = Section3.Height = anim.From.Value;
            Section1.BeginAnimation(HeightProperty, anim);
            await Task.Delay(AnimationTime / 3);

            Section2.BeginAnimation(HeightProperty, anim);
            await Task.Delay(AnimationTime / 3);

            Section3.BeginAnimation(HeightProperty, anim);
        }
예제 #5
0
        public void Test()
        {
            if (File.Exists(Section1.XsdFile))
            {
                File.Delete(Section1.XsdFile);
            }

            Section1 a = (XmlConfiguration <Section1>)ConfigurationManager.GetSection("Section1");

            Assert.AreEqual(123, a.id);
            Assert.AreEqual(432.1, a.value);
            Assert.AreEqual("hello", a.name);
            a = null;

            Section2 b = ((XmlConfiguration <Section2>)ConfigurationManager.GetSection("Section2")).Settings;

            Assert.AreEqual(123, b.id);
            Assert.AreEqual("432.1", b.value);
            Assert.AreEqual("hello", b.name);
            b = null;

            b = XmlConfiguration <Section2> .ReadConfig("Section2");

            Assert.AreEqual(123, b.id);
            Assert.AreEqual("432.1", b.value);
            Assert.AreEqual("hello", b.name);
            b = null;

            using (XmlReader rdr = new XmlTextReader(new StringReader("<Section2 id='123' value='432.1'><name>hello</name></Section2>")))
            {
                b = XmlConfiguration <Section2> .ReadXml(rdr);

                Assert.AreEqual(123, b.id);
                Assert.AreEqual("432.1", b.value);
                Assert.AreEqual("hello", b.name);
                b = null;
            }

            XmlConfiguration <Section2> .XmlSchema = System.Xml.Schema.XmlSchema.Read(
                this.GetType().Assembly.GetManifestResourceStream(this.GetType().Namespace + ".TestXmlSection2.xsd"),
                null
                );

            //now we should get an exception when reading section 2...
            try
            {
                ConfigurationManager.RefreshSection("Section2");
                b = (XmlConfiguration <Section2>)ConfigurationManager.GetSection("Section2");
            }
            catch (System.Configuration.ConfigurationErrorsException ce)
            {
                Assert.IsTrue(ce.Message.Contains("The 'value' attribute is invalid"));
                Assert.IsNotNull(ce.InnerException);
                Assert.AreEqual(typeof(XmlException), ce.InnerException.GetType());
            }
            Assert.IsNull(b);

            Section3 c = (XmlConfiguration <Section3>)ConfigurationManager.GetSection("Section3");

            Assert.AreEqual(123, c.id);
            Assert.AreEqual(new DateTime(2009, 12, 25, 0, 0, 0), c.value);
            Assert.AreEqual("hello", c.name);
            b = null;

            // the following invalid xsd will cause an exception
            File.WriteAllText(Section1.XsdFile, "<xs:schema  xmlns:xs='http://www.w3.org/2001/XMLSchema'><xs:element /></xs:schema>");
            ConfigurationManager.RefreshSection("Section1");
            string origDir = Environment.CurrentDirectory;

            Environment.CurrentDirectory = Path.GetTempPath();
            try
            {
                a = (XmlConfiguration <Section1>)ConfigurationManager.GetSection("Section1");
            }
            catch (ConfigurationErrorsException) { }
            finally
            {
                Environment.CurrentDirectory = origDir;
                File.Delete(Section1.XsdFile);
            }
            Assert.IsNull(a);
        }