I have this Xml file that i browse from my HDD into my C# program. Now the nodes of this Xml doc get displayed in a tree view in my winform.All my logic is in the winform right now. There are three methods
1. To load the Xml doc in memory.
2. Add nodes to tree which is called by the previous method in point 1.
3. And event that works when i click on any node to find its attributes.
Rest i have various buttons like browse,expand tree, clear. all are in the winform. My browse button click event is also in the winform class which is obvious.
Now what i have to do it i have to make a separate class for business logic that includes the method in point 1 and point 2. Rest remains in the winform class. this new class is in the same project. Now the project has two classes 1 is winform's and the other is that i made to store my business logic so as to keeping frontend class free from business logic.
I cannot do that by making use of objects but i have to make use of giving file path in the class that has the logic. so that, that class knows the file path.
Do you have any idea how can i do it?Please tell me the syntax.

from the ui we get a filepath

string filePath = this.textBoxPath.value;

//We call our class like this from the ui
BusinessLogic logic = new BusinessLogic(filePath);
logic.Load();

we'll pass it into the business logic through a constructor

public class BusinessLogic
{
private string filePath;
  public BusinessLogic(string filePath)
{
this.filePath = filePath;
}

public void Load()
{
//now we use the filepath to load the xml file
}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.