So I'm trying to check if some files exist when the program is loading. And I'm having trouble with cross referencing different forms:
An object reference is required for the non-static field, method, or property 'OnePlus_One_Toolkit.Main.CMOS_check'
This applies to all of the checks ran in the code below (from the splash):
private void Splash_Load(object sender, EventArgs e)
{
Process p = new System.Diagnostics.Process();
ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo();
si.RedirectStandardInput = true;
si.CreateNoWindow = true;
si.UseShellExecute = false;
si.FileName = "adb.exe";
si.Arguments = "start-server";
p = Process.Start(si);
p.WaitForExit();
if (!File.Exists("stock.zip"))
{
Main.flash_stock.Enabled = false;
Main.CMOS_check.Text = "Download the zip!";
}
if (!File.Exists("OOS.zip"))
{
Main.flash_OOS.Enabled = false;
Main.OOS_check.Text = "Download the zip!";
}
if (File.Exists("stock.zip"))
{ Main.CMOS_check.Text = ""; }
if (File.Exists("OOS.zip"))
{ Main.OOS_check.Text = ""; }
this.Close();
}
How would I go about fixing this. Or even improve my object reference? And just some extra info the labels and buttons I want to change are set to internal. And the splash does run after the initialize from the primary main form. And the splash is run as a child.
The Main form calling code is below:
public Main()
{
InitializeComponent();
Splash splash = new Splash();
splash.ShowDialog();
}
The code should check to see if the files exist, and if they don't change the respective labels in the main form.