private void Dodaj() { var person = new Person { Name = Name, Surname = Surname }; People.Add(person); }
private void button_Click(object sender, RoutedEventArgs e) { //Dette bruges til personlig læring. Den er beregnes ikke som en del af projekt 3.!!! Person person = new Person(); person.Name = "Philio"; var jsonPerson = JsonConvert.SerializeObject(person); WebClient webClient = new WebClient(); webClient.Headers["Content-Type"] = "application/json"; string uriAdr = "http://localhost:52006/api/Person/"; string response = webClient.UploadString(uriAdr, "POST", jsonPerson); }
private void generateComponents(object sender, RoutedEventArgs e) { var bob = new Person(Brushes.Black) { Name = "Bob", Age = 34, Checked = false, windowToOpen = "test.xaml" }; var sally = new Person(Brushes.Blue) { Name = "Sally", Age = 28, Checked = true, windowToOpen = "test.xaml" }; var joe = new Person(Brushes.Black) { Name = "Joe", Age = 44, Checked = false, windowToOpen="test.xaml" }; joe.Subordinates.Add(bob); sally.Subordinates.Add(joe); trvTreeview.Items.Add(bob); trvTreeview.Items.Add(sally); mnuMenu.Items.Add(bob); mnuMenu.Items.Add(sally); }
public MainWindow() { //編集したいオブジェクト Target = new Person { Name = "のっち" }; //画面に見せる用のオブジェクト BindingTarget = new DynamicViewModel<Person>(Target); //画面でデータに変更があったときに呼ばれるイベントハンドラ BindingTarget.PropertyChanged += new PropertyChangedEventHandler(BindingTarget_PropertyChanged); //お約束 InitializeComponent(); DataContext = BindingTarget; }
public List<Person> CreatePersons() { List<Person> personlist = new List<Person>(); Person person1 = new Person(); Person person2 = new Person(); personlist.Add(person1); personlist.Add(person2); person1.Username = "******"; person1.Password = "******"; person1.Gender = "Male"; person1.Weight = 110; person2.Username = "******"; person2.Password = "******"; person2.Gender = "Female"; person2.Weight = 50; return personlist; }
public void Login_WrongInfo() { List<Person> personlist = new List<Person>(); Person person1 = new Person(); Person person2 = new Person(); personlist.Add(person1); personlist.Add(person2); person1.Username = "******"; person1.Password = "******"; person1.Gender = "Male"; person1.Weight = 110; person2.Username = "******"; person2.Password = "******"; person2.Gender = "Female"; person2.Weight = 50; Login login = new Login(); login.SetUserSource(personlist); Assert.AreEqual(false, login.Verify("Idaadsd123", "123ida")); }