6

WCF doesn't like me adding to lists...

I have to make an uno game that supports multiplayer with WCF for school...

I have a player class that has a list of card classes.

I have a function called dealHand, it adds Cards to the hand list...

I also have a callback function for updating my wpf gui...

For whatever reason if when the gui calls dealhand and I try to use myList.add(new Card()) then the updategui function in my wpf client doesn't fire...

But if I take a seperate method called makeHand which returns a list of cards, and just do myList = makeHand() then that works fine...

Never been so baffled/cursed so much at code before... Is there something about Lists that WCF doesn't like? Seriously... was weird...

Hopefully that was somewhat coherent...

Comments
  • 0
    Are you using an observableCollection and bind it to the control?
    I think wpf is missing a PropertyChanged/CollectionChanged Event in your Case.

    Edit: are you actually using mvvm? :D cause if you would you should not need to trigger an ui refresh
  • 0
    no not using MVVM for this assignment, just following how my prof suggested to do things, we have a library that has a list of callback interfaces that calls updategui, and even if I did use MVVM the problem is that the callback from the service isn't firing for whatever weird reason, it's just odd that having the List like that would cause that issue
  • 2
    Wups, I somehow read wpf all the time. :D nvm.
  • 0
    it's only 1 letter off so I don't blame you, my work around is to just build the hands in another function and pass them, but it's such a janky way of doing things...
Add Comment