コード例 #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var datacontext = new Person()
                {
                    Name = "O Monstro",
                    LastName = "Desmaisons",
                    Local = new Local() { City = "Florianopolis", Region = "SC" },
                    PersonalState = PersonalState.Married
                };

            _FirstSkill = new Skill() { Name = "Langage", Type = "French" };

            datacontext.Skills.Add(_FirstSkill);
            datacontext.Skills.Add(new Skill() { Name = "Info", Type = "C++" });

            Window w = sender as Window;
            w.DataContext = datacontext;
            _Person = datacontext;
        }
コード例 #2
0
        public void Basic_Option_Simple()
        {
            Test((c, w) =>
            {
                var mre = new ManualResetEvent(false);

                DisplayEvent de = null;
                EventHandler<DisplayEvent> ea = null;
                ea =(o, e) => { de = e; c.OnDisplay-=ea; };
                c.OnDisplay += ea;
                var dc = new Person();

                w.RunOnUIThread(() =>
                {
                    c.Mode = JavascriptBindingMode.OneWay;
                    string relp = "javascript\\navigation_1.html";
                    c.Uri = new Uri(string.Format("{0}\\{1}", Assembly.GetAssembly(typeof(Test_HTMLViewControl)).GetPath(), relp));
                    w.Window.DataContext = dc;
                    mre.Set();
                });

                mre.WaitOne();

                Thread.Sleep(1500);
                de.Should().NotBeNull();
                de.DisplayedViewModel.Should().Be(dc);


            });
        }