void button_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; ScreenSelection scrnSelec = new ScreenSelection(btn.Content.ToString()); scrnSelec.ShowDialog(); btn.Content = scrnSelec.ScreenNumber; var Selection = designerCanvas.SelectionService.CurrentSelection; ViewModelDesignerItem Ditem = new ViewModelDesignerItem(); foreach (var slc in Selection) { Ditem = (ViewModelDesignerItem)slc; } DockPanel Sourcepnl = (DockPanel)Ditem.Content; PropertyGrid SelectedPgrid = designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName).Find(x => x.Id == Sourcepnl.Uid).PropertyGrid; string SelectedProperty = btn.Name.ToString(); string newValue = btn.Content.ToString(); Object stateobj = (Object)SelectedPgrid.SelectedObject; Type ClassType = stateobj.GetType(); PropertyInfo property = ClassType.GetProperty(SelectedProperty); property.SetValue(stateobj, newValue, null); designerCanvas.TransactionList.FindAll(x => x.TransactionName == designerCanvas.CurrentTransactionName).Find(x => x.Id == Sourcepnl.Uid).PropertyGrid.SelectedObject = stateobj; }
//appelé avant le start protected void Awake() { if (instance != null) { Debug.LogWarning("erreur, il y a deja une instance NetworkItemsController"); return; } instance = this; }