olleeee
olleeee
CC#
Created by olleeee on 12/4/2023 in #help
creating objects in a different class
from my teacher: class Hogwarts Here I miss your SortingHat. It should be in this class. Nor should you have a public list of House here. You already have them in your respective student residences. COMPLETE class Wizard Neat. Here you have created classy methods. The interface Here you will retrieve the mascots from your objects. Do not write them COMPLETE lblHufflepuffMascot.Content = "Badger"; You create new instances (objects) of your houses in the interface. It's ok because you don't do this at Hogwarts. But I think it's stupid and when you change anyway. Do this too. Also, they are a bit crazy as you make them now in the interface. You must create House and not, for example, Hufflepuff. COMPLETE Since you will have the houses in Hogwarts, this must also be changed: hogwarts.Houses.Add(griffindor); You must change the password in the same way as in my test code. That is, completely without if statements if (gryffindor.SetPassword <-- remove and all that look alike Replace with house.SetPassword <-- general method for all student houses. When you do so, you will also reduce the number of lines of code by perhaps 50!
5 replies
CC#
Created by olleeee on 12/4/2023 in #help
creating objects in a different class
5 replies
CC#
Created by olleeee on 12/1/2023 in #help
✅ sort list after property
3 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
thank you for all the input!
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
i have got it now! just put the itemssource to null first
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
where and how im a supposed t refresh?
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
oh i have never seen refresh before but will give it a go!
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
its just adding more elements to the listbox it looks like it overrites its self
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
No description
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
yes
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
so i have that they get added and says that they member two and so, but they just dont pop up in my list box.
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
oh we not allowed to co console thoug
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
i know but i have to use the name thats specified in the assigment.
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
sorry here is he hat!
public void SortingHat(Wizard wizard, House currentHouse)
{
currentHouse.Members.Add(wizard);



}
public void SortingHat(Wizard wizard, House currentHouse)
{
currentHouse.Members.Add(wizard);



}
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
oh im sorry completely forgot!
private void btnSortingHat_Click(object sender, RoutedEventArgs e)
{
Wizard newWizard = new ();
Wizard student = CreateNewWizard(newWizard);
txtName.Text = student.Name;
if (student.DeathEater == true)
{
chkDeatheater.IsChecked = true;
}
if (student.DumbledoorsArmy == true)
{
chkArmy.IsChecked = true;
}


House currentHouse = hogwarts.Houses[currentHouseIndex];

currentHouse.SortingHat(newWizard, currentHouse);
MessageBox.Show($"{newWizard.Name} is now member {currentHouse.Members.Count} in {currentHouse}\n" +
$"{currentHouse.HouseGhost} is going to take well care of you.");
FillLists(student);

currentHouseIndex++;
if (currentHouseIndex > 3)
{
currentHouseIndex = 0;
}
}
private void btnSortingHat_Click(object sender, RoutedEventArgs e)
{
Wizard newWizard = new ();
Wizard student = CreateNewWizard(newWizard);
txtName.Text = student.Name;
if (student.DeathEater == true)
{
chkDeatheater.IsChecked = true;
}
if (student.DumbledoorsArmy == true)
{
chkArmy.IsChecked = true;
}


House currentHouse = hogwarts.Houses[currentHouseIndex];

currentHouse.SortingHat(newWizard, currentHouse);
MessageBox.Show($"{newWizard.Name} is now member {currentHouse.Members.Count} in {currentHouse}\n" +
$"{currentHouse.HouseGhost} is going to take well care of you.");
FillLists(student);

currentHouseIndex++;
if (currentHouseIndex > 3)
{
currentHouseIndex = 0;
}
}
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
so in the list its supposed to be 2 "students" but only one can be seen in the list??
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ List doesnt show multiple inputs
private void btnSortingHat_Click(object sender, RoutedEventArgs e)
{
Wizard newWizard = new ();
Wizard student = CreateNewWizard(newWizard);
txtName.Text = student.Name;
if (student.DeathEater == true)
{
chkDeatheater.IsChecked = true;
}
if (student.DumbledoorsArmy == true)
{
chkArmy.IsChecked = true;
}


House currentHouse = hogwarts.Houses[currentHouseIndex];

currentHouse.SortingHat(newWizard, currentHouse);
MessageBox.Show($"{newWizard.Name} is now member {currentHouse.Members.Count} in {currentHouse}\n" +
$"{currentHouse.HouseGhost} is going to take well care of you.");
FillLists(student);

currentHouseIndex++;
if (currentHouseIndex > 3)
{
currentHouseIndex = 0;
}
}


public void FillLists(Wizard wizard)
{
if (currentHouseIndex == 0)
{
lstGryffindor.ItemsSource = hogwarts.Griffendor.Members;
}
if (currentHouseIndex == 1)
{
lstRavenclaw.ItemsSource = hogwarts.Ravenclaw.Members;
}
if (currentHouseIndex == 2)
{
lstSlytherin.ItemsSource = hogwarts.Slytherin.Members;

}
if (currentHouseIndex == 3)
{
lstHufflepuff.ItemsSource = hogwarts.Hufflepuff.Members;

}
}
private void btnSortingHat_Click(object sender, RoutedEventArgs e)
{
Wizard newWizard = new ();
Wizard student = CreateNewWizard(newWizard);
txtName.Text = student.Name;
if (student.DeathEater == true)
{
chkDeatheater.IsChecked = true;
}
if (student.DumbledoorsArmy == true)
{
chkArmy.IsChecked = true;
}


House currentHouse = hogwarts.Houses[currentHouseIndex];

currentHouse.SortingHat(newWizard, currentHouse);
MessageBox.Show($"{newWizard.Name} is now member {currentHouse.Members.Count} in {currentHouse}\n" +
$"{currentHouse.HouseGhost} is going to take well care of you.");
FillLists(student);

currentHouseIndex++;
if (currentHouseIndex > 3)
{
currentHouseIndex = 0;
}
}


public void FillLists(Wizard wizard)
{
if (currentHouseIndex == 0)
{
lstGryffindor.ItemsSource = hogwarts.Griffendor.Members;
}
if (currentHouseIndex == 1)
{
lstRavenclaw.ItemsSource = hogwarts.Ravenclaw.Members;
}
if (currentHouseIndex == 2)
{
lstSlytherin.ItemsSource = hogwarts.Slytherin.Members;

}
if (currentHouseIndex == 3)
{
lstHufflepuff.ItemsSource = hogwarts.Hufflepuff.Members;

}
}
40 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ WPF, how do i fill listboxes with values
okey got that sorted he he, still need help with just printing out the name though
7 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ WPF, how do i fill listboxes with values
and only one wizard can be added...
7 replies
CC#
Created by olleeee on 11/30/2023 in #help
✅ WPF, how do i fill listboxes with values
at the moment only griffendor wizards get displayed in the list
7 replies