In the form1 constructor :
public Form1()
{
InitializeComponent();
LoadFile(textBoxRadarPath, "radarpath.txt");
LoadFile(textBoxSatellitePath, "satellitepath.txt");
CheckIfImagesExist();
if (pictureBox1.Image == null || pictureBox2.Image == null)
{
trackBar1.Enabled = false;
}
tracker = new DownloadProgressTracker(50, TimeSpan.FromMilliseconds(500));
label1.Location = new Point(progressBar1.Width / 2 - label1.Width / 2, label1.Location.Y);
lblStatus.Text = "Download Pending";
lblAmount.Text = "";
lblSpeed.Text = "";
sat = new Satellite();
rad = new Radar();
I want to pass some stuff from the classes Satellite and Radar to Form1 so I make instances for the classes in Form1.
but in Form1 top I have also this List that I want to pass this List from Form1 to the classes Satellite and Radar :
public List<string> folders;
In each class I make an instance for Form1 :
namespace Extract
{
class Satellite
{
private List<string> satelliteUrls = new List<string>();
private string mainUrl = "https://de.sat24.com/de/eu/infraPolair/";
private string[] statements;
Form1 f1 = new Form1();
I want to use the List folders in both classes.
The problem is I'm getting exception in the classes after some time because it's doing "ping pong" it's creating instance in form1 of the class satellite then in satellite create instance of form1 then it's back to form1 make instance of the classes again and back to the classes instance of form1 and so on in loop of instances.
How can I use this List folders from Form1 in both classes ?