private void FollowUp(object sender, EventArgs e) { Bar1.Progress = 1; Bar2.ProgressTo(1, 5000, Easing.Linear); Bar3.ProgressTo(1, 5000, Easing.CubicIn); Bar4.ProgressTo(1, 5000, Easing.SinIn); }
public void InsertClientSideReferenceField2() { using (Session session = Domain.OpenSession()) { using (TransactionScope trx = session.OpenTransaction()) { var bar = new Bar2(session, DateTime.Now, Guid.NewGuid()); var foo = new Foo2(session, 1, "1"); Key key = session.Query.Insert(() => new Foo2(null, 0, null) { Bar = bar, Id = 0, Id2 = "test", Name = "test" }); var foo2 = session.Query.Single <Foo2>(key); Assert.That(bar, Is.EqualTo(foo2.Bar)); key = session.Query.Insert(() => new Foo2(null, 0, null) { Bar = null, Id = 0, Id2 = "test1", Name = "test1" }); foo2 = session.Query.Single <Foo2>(key); Assert.That(foo2.Bar, Is.Null); trx.Complete(); } } }
public void UpdateClientSideReferenceField2() { using (Session session = Domain.OpenSession()) { using (TransactionScope trx = session.OpenTransaction()) { var bar = new Bar2(session, DateTime.Now, Guid.NewGuid()); var foo = new Foo2(session, 1, "1"); var bar2 = new Bar2(session, DateTime.Now, Guid.NewGuid()); session.Query.All <Foo2>().Set(a => a.Bar, bar).Update(); Assert.That(bar, Is.EqualTo(foo.Bar)); session.Query.All <Foo2>().Set(a => a.Bar, (Bar2)null).Update(); Assert.That(foo.Bar, Is.Null); session.Query.All <Foo2>().Update(a => new Foo2(null, 0, null) { Bar = bar }); Assert.That(bar, Is.EqualTo(foo.Bar)); session.Query.All <Foo2>().Update(a => new Foo2(null, 0, null) { Bar = null }); Assert.That(foo.Bar, Is.Null); trx.Complete(); } } }
private void AddMyPluginCommands() { Pilz.Reflection.PluginSystem.PluginFunction lastFunc = null; bool isFirst = true; foreach (Pilz.Reflection.PluginSystem.PluginFunction func in Publics.General.PluginManager.GetFunctions("pluginmenu", "pluginmenur")) { var btn = new ButtonItem(); if (lastFunc != func) { lastFunc = func; } btn.Text = (string)func.Params[0]; btn.Tag = func; btn.Click += (sender, e) => { Pilz.Reflection.PluginSystem.PluginFunction senderfunc = (Pilz.Reflection.PluginSystem.PluginFunction)((BaseItem)sender).Tag; if (senderfunc.FunctionCode.EndsWith("r")) { senderfunc.Invoke(Controller.GetCurrentRomManager()); } else { senderfunc.Invoke(); } }; ButtonItem_Bar_Plugins.BeginGroup = isFirst; ButtonItem_Bar_Plugins.SubItems.Add(btn); isFirst = false; } Bar2.Refresh(); }
public void Parent( Session session, bool first, IsolationLevel?isolationLevel, TransactionOpenMode?transactionOpenMode, IExecuteActionStrategy strategy, Action <bool, IsolationLevel?, TransactionOpenMode?> action) { domain.WithStrategy(strategy) .WithSession(session) .WithIsolationLevel(isolationLevel.GetValueOrDefault(IsolationLevel.RepeatableRead)) .WithTransactionOpenMode(transactionOpenMode.GetValueOrDefault(TransactionOpenMode.New)) .Execute( session => { session.EnsureTransactionIsStarted(); _ = new Bar2(session, DateTime.Now, Guid.NewGuid()) { Name = Guid.NewGuid().ToString() }; if (first) { if (wait1 != null && wait2 != null) { _ = wait1.Set(); _ = wait2.WaitOne(); } } else if (wait1 != null && wait2 != null) { _ = wait2.Set(); _ = wait1.WaitOne(); } action(first, isolationLevel, transactionOpenMode); }); }
public void Deadlock(bool first, IsolationLevel?isolationLevel, TransactionOpenMode?transactionOpenMode) { domain.WithStrategy(ExecuteActionStrategy.HandleUniqueConstraintViolation).WithIsolationLevel(isolationLevel.GetValueOrDefault(IsolationLevel.RepeatableRead)).WithTransactionOpenMode(transactionOpenMode.GetValueOrDefault(TransactionOpenMode.New)).Execute( session => { _ = Interlocked.Increment(ref Count); _ = new Bar2(session, DateTime.Now, Guid.NewGuid()) { Name = Guid.NewGuid().ToString() }; if (first) { _ = session.Query.All <Foo>().Lock(LockMode.Exclusive, LockBehavior.Wait).ToArray(); if (wait1 != null) { _ = wait1.Set(); _ = wait2.WaitOne(); wait1 = null; } _ = session.Query.All <Bar>().Lock(LockMode.Exclusive, LockBehavior.Wait).ToArray(); } else { _ = session.Query.All <Bar>().Lock(LockMode.Exclusive, LockBehavior.Wait).ToArray(); if (wait2 != null) { _ = wait2.Set(); _ = wait1.WaitOne(); wait2 = null; } _ = session.Query.All <Foo>().Lock(LockMode.Exclusive, LockBehavior.Wait).ToArray(); } }); }
public void TestPropertyChains() { var bar2 = new Bar2(); bar2.pointerToStruct.A = 15; Assert.That(bar2.pointerToStruct.A, Is.EqualTo(15)); }
public void CompositeKeyUpdate() { using (Session session = Domain.OpenSession()) { using (TransactionScope trx = session.OpenTransaction()) { DateTime date1 = DateTime.Now; DateTime date2 = DateTime.Now.AddDays(1); Guid id1 = Guid.NewGuid(); Guid id2 = Guid.NewGuid(); var foo1 = new Bar2(session, date1, id1) { Name = "test" }; var foo2 = new Bar2(session, date2, id1); var foo3 = new Bar2(session, date2, id2) { Name = "test" }; int updated = session.Query.All <Bar2>().Where(a => a.Name == "test").Set(a => a.Name, "abccba").Update(); Assert.That(updated, Is.EqualTo(2)); Assert.That(foo1.Name, Is.EqualTo("abccba")); Assert.That(foo3.Name, Is.EqualTo("abccba")); Assert.That(foo2.Name, Is.Null); trx.Complete(); } } }
public async Task CompositeKeyUpdateAsync() { await using (var session = await Domain.OpenSessionAsync()) await using (var trx = session.OpenTransaction()) { var date1 = FixDateTimeForPK(DateTime.Now); var date2 = FixDateTimeForPK(DateTime.Now.AddDays(1)); var id1 = Guid.NewGuid(); var id2 = Guid.NewGuid(); var foo1 = new Bar2(session, date1, id1) { Name = "test" }; var foo2 = new Bar2(session, date2, id1); var foo3 = new Bar2(session, date2, id2) { Name = "test" }; var updated = await session.Query.All <Bar2>().Where(a => a.Name == "test").Set(a => a.Name, "abccba").UpdateAsync(); Assert.That(updated, Is.EqualTo(2)); Assert.That(foo1.Name, Is.EqualTo("abccba")); Assert.That(foo3.Name, Is.EqualTo("abccba")); Assert.That(foo2.Name, Is.Null); trx.Complete(); } }
IEnumerator LoadLevelData() //Spécificité des niveaux. { _DataBase.ResetTable(); Carte = GameObject.Find("Recettes"); Bar1 = GameObject.Find("Bar1"); Bar2 = GameObject.Find("Bar2"); Carte.SetActive(false); switch (LevelChoisi) { case 1: GameObject.Find("Timer").GetComponent <Countdown>().timeLeft = 180; break; case 2: GameObject.Find("Timer").GetComponent <Countdown>().timeLeft = 90; break; case 3: GameObject.Find("Timer").GetComponent <Countdown>().timeLeft = 90; break; case 4: GameObject.Find("Timer").GetComponent <Countdown>().timeLeft = 180; break; case 5: GameObject.Find("Timer").GetComponent <Countdown>().timeLeft = 180; break; } Bar2.SetActive(false); yield return(new WaitForSeconds(0.2f)); GameManager.Loading.SetActive(false); GameManager.Status = GameState.Playing; }
public void TestMethodWithFixedInstance() { var bar = new Bar2 { A = 1, B = 2, C = 3 }; Foo2 foo = bar.needFixedInstance(); Assert.AreEqual(foo.A, 1); Assert.AreEqual(foo.B, 2); Assert.AreEqual(foo.C, 3); }
public static void test() { Foo foo = ProviderFactory.Get <Foo>().Create <Foo>(); Foo2 foo2 = ProviderFactory.Get <Foo>().Create <Foo2>(); // Bar2 bar2 = ProviderFactory.Get<Foo>().Create<Bar2>(); - compile error Bar2 bar2 = ProviderFactory.Get <Bar>().Create <Bar2>(); // - ok! Bar3 bar3 = ProviderFactory.Get <IWhatever>().Create <Bar3>(); }
public static int test_0_abcrem_check_this_removal2() { Bar2 b = new Bar2(); invoke_twice(b); return(0); }
static int invoke_twice(Bar2 b) { b.foo(); // The check_this generated here by the JIT should be removed b.foo(); return(0); }
private void UnSubscribeFromEvents(Bar2 bar) { if (bar == null) { return; } bar.SomethingHappened -= this.Bar_SomethingHappened; }
private void SubscribeToEvents(Bar2 bar) { if (bar == null) { return; } bar.SomethingHappened += this.Bar_SomethingHappened; }
public static int test_0_abcrem_check_this_removal() { Bar2 b = new Bar2(); // The check_this generated here by the JIT should be removed b.foo(); return(0); }
private void Modificar(object sender, EventArgs args) { Bar1.Progress = 1; Bar2.ProgressTo(1, 10000, Easing.Linear); Bar3.ProgressTo(1, 10000, Easing.SpringIn); Bar4.ProgressTo(1, 10000, Easing.SinIn); Bar5.ProgressTo(1, 10000, Easing.BounceOut); Bar6.ProgressTo(1, 10000, Easing.BounceIn); Bar7.ProgressTo(1, 10000, Easing.CubicIn); }
public void TestConversionOperator() { var bar = new Bar2 {A = 1, B = 2, C = 3}; Foo2 foo = bar; Assert.AreEqual(foo.A, 1); Assert.AreEqual(foo.B, 2); Assert.AreEqual(foo.C, 3); Assert.AreEqual(300, new Bar2.Nested()); Assert.AreEqual(500, new Bar2()); }
public override bool Equals(object obj) { Bar2 that = obj as Bar2; if (that == null) { return(false); } return(String.Equals(this.Baz, that.Baz)); }
public void TestHello() { var hello = new Hello(); hello.PrintHello("Hello world"); Assert.That(hello.add(1, 1), Is.EqualTo(2)); Assert.That(hello.add(5, 5), Is.EqualTo(10)); Assert.IsTrue(hello.test1(3, 3.0f)); Assert.IsFalse(hello.test1(2, 3.0f)); var foo = new Foo { A = 4, B = 7 }; Assert.That(hello.AddFoo(foo), Is.EqualTo(11)); Assert.That(hello.AddFooPtr(foo), Is.EqualTo(11)); Assert.That(hello.AddFooPtr(foo), Is.EqualTo(11)); Assert.That(hello.AddFooRef(foo), Is.EqualTo(11)); var bar = new Bar { A = 4, B = 7 }; Assert.That(hello.AddBar(bar), Is.EqualTo(11)); Assert.That(bar.RetItem1(), Is.EqualTo(Bar.Item.Item1)); var retFoo = hello.RetFoo(7, 2.0f); Assert.That(retFoo.A, Is.EqualTo(7)); Assert.That(retFoo.B, Is.EqualTo(2.0)); var foo2 = new Foo2 { A = 4, B = 2, C = 3 }; Assert.That(hello.AddFoo(foo2), Is.EqualTo(6)); Assert.That(hello.AddFoo2(foo2), Is.EqualTo(9)); var bar2 = new Bar2 { A = 4, B = 7, C = 3 }; Assert.That(hello.AddBar2(bar2), Is.EqualTo(14)); Assert.That(hello.RetEnum(Enum.A), Is.EqualTo(0)); Assert.That(hello.RetEnum(Enum.B), Is.EqualTo(2)); Assert.That(hello.RetEnum(Enum.C), Is.EqualTo(5)); Assert.That(hello.RetEnum(Enum.D), Is.EqualTo(-2147483648)); Assert.That(hello.RetEnum(Enum.E), Is.EqualTo(1)); Assert.That(hello.RetEnum(Enum.F), Is.EqualTo(-9)); }
private void Modificar(object sender, EventArgs args) { Bar1.ProgressTo(1, 15000, Easing.BounceIn); Bar2.ProgressTo(1, 15000, Easing.BounceOut); Bar3.ProgressTo(1, 15000, Easing.CubicIn); Bar4.ProgressTo(1, 15000, Easing.CubicInOut); Bar5.ProgressTo(1, 15000, Easing.CubicOut); Bar6.ProgressTo(1, 15000, Easing.SinIn); Bar7.ProgressTo(1, 15000, Easing.SinInOut); Bar8.ProgressTo(1, 15000, Easing.SinOut); Bar9.ProgressTo(1, 15000, Easing.SpringIn); Bar10.ProgressTo(1, 15000, Easing.SpringOut); }
public void ModifyProgress(object sender, EventArgs args) { Bar1.Progress = 1; Bar2.ProgressTo(1, 5000, Easing.Linear); //Alguns tipos de animação na classe Easing Bar3.ProgressTo(1, 5000, Easing.SpringIn); Bar4.ProgressTo(1, 5000, Easing.SpringOut); Bar5.ProgressTo(1, 5000, Easing.BounceIn); Bar6.ProgressTo(1, 5000, Easing.BounceOut); Bar7.ProgressTo(1, 5000, Easing.CubicIn); Bar8.ProgressTo(1, 5000, Easing.CubicOut); Bar9.ProgressTo(1, 5000, Easing.SinIn); Bar10.ProgressTo(1, 5000, Easing.SinOut); }
public void TestHello() { var hello = new Hello(); hello.PrintHello("Hello world"); Assert.That(hello.add(1, 1), Is.EqualTo(2)); Assert.That(hello.add(5, 5), Is.EqualTo(10)); Assert.IsTrue(hello.test1(3, 3.0f)); Assert.IsFalse(hello.test1(2, 3.0f)); var foo = new Foo { A = 4, B = 7 }; Assert.That(hello.AddFoo(foo), Is.EqualTo(11)); Assert.That(hello.AddFooPtr(foo), Is.EqualTo(11)); Assert.That(hello.AddFooPtr(foo), Is.EqualTo(11)); Assert.That(hello.AddFooRef(foo), Is.EqualTo(11)); unsafe { var pointer = foo.SomePointer; var pointerPointer = foo.SomePointerPointer; for (int i = 0; i < 4; i++) { Assert.AreEqual(i, pointer[i]); Assert.AreEqual(i, (*pointerPointer)[i]); } } var bar = new Bar { A = 4, B = 7 }; Assert.That(hello.AddBar(bar), Is.EqualTo(11)); Assert.That(bar.RetItem1(), Is.EqualTo(Bar.Item.Item1)); var retFoo = hello.RetFoo(7, 2.0f); Assert.That(retFoo.A, Is.EqualTo(7)); Assert.That(retFoo.B, Is.EqualTo(2.0)); var foo2 = new Foo2 { A = 4, B = 2, C = 3 }; Assert.That(hello.AddFoo(foo2), Is.EqualTo(6)); Assert.That(hello.AddFoo2(foo2), Is.EqualTo(9)); var bar2 = new Bar2 { A = 4, B = 7, C = 3 }; Assert.That(hello.AddBar2(bar2), Is.EqualTo(14)); Assert.That(hello.RetEnum(Enum.A), Is.EqualTo(0)); Assert.That(hello.RetEnum(Enum.B), Is.EqualTo(2)); Assert.That(hello.RetEnum(Enum.C), Is.EqualTo(5)); //Assert.That(hello.RetEnum(Enum.D), Is.EqualTo(-2147483648)); Assert.That(hello.RetEnum(Enum.E), Is.EqualTo(1)); Assert.That(hello.RetEnum(Enum.F), Is.EqualTo(-9)); }
public void Method() { var b1 = new Bar1(); var b2 = new Bar2(); var b3 = new Bar3(); var b4 = new Bar4(); var b5 = new Bar5(); var b6 = new Bar6(); b1.Method(); b2.Method(); b3.Method(); b4.Method(); b5.Method(); b6.Method(); }
static void Main(string[] args) { Foo foo1 = new Foo(); Bar bar1 = new Bar1(); Bar bar2 = new Bar2(); foo1.Bar1Collection.Add(bar1); foo1.Bar2Collection.Add(bar2); Debug.Assert(bar1.Parent != null); Debug.Assert(bar2.Parent != null); bar1.DoSomething(); bar2.DoSomething(); Console.WriteLine("Done"); Console.ReadLine(); foo1.Dispose(); }
static async Task Test() { var foo = new Foo(); var bar2 = new Bar2(); object resultObject = await CallGetByReflection(foo, bar2); IBar result = (IBar)resultObject; result.WriteOut(); //or if (resultObject is Bar) { ((Bar)resultObject).Something(); } else if (resultObject is Bar2) { ((Bar2)resultObject).SomethingElse(); } }
public void UniqueConstraintViolationPrimaryKey( bool first, IsolationLevel?isolationLevel, TransactionOpenMode?transactionOpenMode) { domain.WithStrategy(ExecuteActionStrategy.HandleUniqueConstraintViolation).WithIsolationLevel(isolationLevel.GetValueOrDefault(IsolationLevel.RepeatableRead)).WithTransactionOpenMode(transactionOpenMode.GetValueOrDefault(TransactionOpenMode.New)).Execute( session => { _ = Interlocked.Increment(ref Count); session.EnsureTransactionIsStarted(); _ = new Bar2(session, DateTime.Now, Guid.NewGuid()) { Name = Guid.NewGuid().ToString() }; var id = 10; if (session.Query.SingleOrDefault <Foo>(id) == null) { var w1 = wait1; var w2 = wait2; if (first) { if (w1 != null && w2 != null) { _ = w1.Set(); _ = w2.WaitOne(); wait1 = null; } } else if (w1 != null && w2 != null) { _ = w2.Set(); _ = w1.WaitOne(); wait2 = null; } _ = new Foo(session, id) { Name = Guid.NewGuid().ToString() }; } session.SaveChanges(); }); }
public void TestConversionOperator() { var bar = new Bar2 { A = 1, B = 2, C = 3 }; using (Foo2 foo = bar) { Assert.That(1, Is.EqualTo(foo.A)); Assert.That(2, Is.EqualTo(foo.B)); Assert.That(3, Is.EqualTo(foo.C)); } using (var bar2Nested = new Bar2.Nested()) { int bar2NestedInt = bar2Nested; Assert.That(bar2NestedInt, Is.EqualTo(300)); } int bar2Int = new Bar2(); Assert.That(bar2Int, Is.EqualTo(500)); }
public override bool Equals(object obj) { Foo2 that = obj as Foo2; if (that == null) { return(false); } if (this.Bars == null ? that.Bars != null : that.Bars == null) { return(false); } if (this.Bars != null) { int length = this.Bars.Count; if (length != that.Bars.Count) { return(false); } for (int i = 0; i < length; i++) { Bar2 thisItem = this.Bars[i]; Bar2 thatItem = that.Bars[i]; if (thisItem == null ? thatItem != null : thatItem == null) { return(false); } if (thisItem != null && !thisItem.Equals(thatItem)) { return(false); } } } return(true); }
public void UniqueConstraintViolation( bool first, IsolationLevel?isolationLevel, TransactionOpenMode?transactionOpenMode) { domain.WithStrategy(ExecuteActionStrategy.HandleUniqueConstraintViolation).WithIsolationLevel(isolationLevel.GetValueOrDefault(IsolationLevel.RepeatableRead)).WithTransactionOpenMode(transactionOpenMode.GetValueOrDefault(TransactionOpenMode.New)).Execute( session => { _ = Interlocked.Increment(ref Count); session.EnsureTransactionIsStarted(); _ = new Bar2(session, DateTime.Now, Guid.NewGuid()) { Name = Guid.NewGuid().ToString() }; var name = "test"; if (!session.Query.All <Foo>().Any(a => a.Name == name)) { if (first) { if (wait1 != null && wait2 != null) { _ = wait1.Set(); _ = wait2.WaitOne(); wait1 = null; } } else if (wait2 != null && wait2 != null) { _ = wait2.Set(); _ = wait1.WaitOne(); wait2 = null; } _ = new Foo(session) { Name = name }; } session.SaveChanges(); }); }
public static int test_0_abcrem_check_this_removal2 () { Bar2 b = new Bar2 (); invoke_twice (b); return 0; }
static int invoke_twice (Bar2 b) { b.foo (); // The check_this generated here by the JIT should be removed b.foo (); return 0; }
public static int test_0_abcrem_check_this_removal () { Bar2 b = new Bar2 (); // The check_this generated here by the JIT should be removed b.foo (); return 0; }
public void Init(Bar2 bar) { }