I'm creating Library app using WinForms. I have eLibraryClasses where I have all data including each form services, and eLibraryUI where I have all my WinForms.
I have a problem in one form where I would like to change states of button.Visible to false or true.
I tried to extract method from UI to Service like:
public void ShowDrawnBook(bool clickedButtonVisible, bool toReadButtonVisible, int buttonNumber)
{
//Hide button which cover answer
clickedButtonVisible = false;
//Add option to add randomized book to "To read" bookshelf
toReadButtonVisible = true;
//Return index of clicked button
buttonClicked = buttonNumber;
}
And UI looks like for example:
service.ShowDrawnBook(randomBook2Button.Visible, toReadButton.Visible, 2);
I tried, but I couldn't use "ref" neither "out" for this properties. And in this way above it's building properly, but not working because of not changing parameters out of method. I have such a many of them in this form, so I could do it like
randomBook2Button.Visible = SomeMethod();
toReadButton.Visible = SomeMethod();
... for every variable
But I would like to avoid it.
Is there any way to send there buttons properties (bools) as parameters?