« first day (682 days earlier)      last day (3467 days later) » 
06:00 - 16:0017:00 - 00:00

5:08 PM
Ohey
 
hey
 
Happy Labor day
 
5:43 PM
Stoopid question..
            var dir = Directory.GetCurrentDirectory();

            if (!Directory.EnumerateFiles(dir, "*.xml", SearchOption.TopDirectoryOnly).Contains(XMLTeste.Name))
                new XDocument(
                    new XElement(XMLTeste.Name,
                        new XElement(XMLTeste.Header.ID, new XAttribute("Value", "0"),
                            new XElement(XMLTeste.Header.Valor, "")))).Save(XMLTeste.Name + ".xml");

            var root = XElement.Load(XMLTeste.Name + ".xml");

            var a = from main in root.Elements(XMLTeste.Name)
The variable a is not returning anything.. Am I doing something wrong? :(
'nyone ?
Nevermind... I was looking for the root instead of the first node
 
6:34 PM
@AndréSilva why are you searching for *.xml when you're only interested in one xml file?
use that as direct search pattern rather than pick multiple files and then filter
and i'm off!
see ya
 
Ok ._. Thanks
 
So with XML you don't set a listboxs data with "content"?
 
 
3 hours later…
9:54 PM
@user2442335 you need to set the ItemsSource property to a list of your items
 
10:17 PM
@DreadPiratePeter I got it, it just doesn't update, not sure I'm doing it right though.
 
11:15 PM
what kind of object is the data in?
 
@DreadPiratePeter Come again?
public ObservableCollection<object> foodInventory = new ObservableCollection<object>();
You mean this?
 
object?
that probably isn't right
can I see your listbox?
 
11:34 PM
The XML you mean?
I put it as object because either a vegetable type or protein type could be put into it.
I'm still pretty new at this so...yeah
Do the list box and the observablecollection have to be separate?
 
xaml, not xml.
can I see the listbox xaml code you wrote
 
I didn't write any.
oh wait I did
<ListBox HorizontalAlignment="Left" ItemsSource ="{Binding FoodInventory}" DisplayMemberPath="Name" Height="106" Margin="193,0,0,0" VerticalAlignment="Top" Width="100" SelectionChanged="ListBox_SelectionChanged" Grid.ColumnSpan="2"/>
 
the Food inventory member must be an Observablecollection of something that has a Name member (since that is the member you are displaying with DisplayMemberPath), if you need to show multiple types I suggest you use either an interface or a common base type
 
Like make a Food class and then have protein and vegetable, etc inherit it?
 
yes, or make an IFood interface that exposes the members needed by the listbox
and the rest of the UI
It really sounds like you need to go through a few tutorials on WPF. And MVVM. You should learn good habits early
 
11:48 PM
I don't know much about interfaces yet.
I've read through them, reading doesn't do much for me :(
@DreadPiratePeter Why would I use an interface vs a class?
 
an interface is more flexible. for example, as you seem to be making a RPG style game, lets look at an open command.
you could have a door class and the open command would work on doors
but lets say you wanted to also open windows, you could then make a Openable class and derive doors and windows from it.
but, what if you also wanted to open chests?
 
06:00 - 16:0017:00 - 00:00

« first day (682 days earlier)      last day (3467 days later) »