I have a project where to I have to load various appointments into a Calendar Application. When I implement this load method I am supposed to be able to write my data in a text file
in the following format:
10/04/2015 '\t' 10:40 '\t' 30 '\t' test '\t' test.
'\t' = tab
The solution builds successfully, however when I start without debugging, the application opens in the background and doesn't show on screen. I then have to go to task-manager and end the process.
The application form is not coming into view. My application works fine without the use of this load method, however I need to be able to pre-populate my calendar aswell as manually enter appointments.
StreamReader fileReader;
string line;
DateTime nStart;
DateTime nDate;
int nLength;
string nSubject;
string nLocation;
bool result;
public bool Load()
{
fileReader = new StreamReader("D:\\All Downloads\\CalendarApp\\Apps.txt");
line = fileReader.ReadLine();
while (line != null)
{
string s = line;
string[] split = s.Split('\t');
nDate = Convert.ToDateTime(split[0]);
nStart = Convert.ToDateTime(split[1]);
nLength = Convert.ToInt32(split[2]);
nSubject = split[3];
nLocation = split[4];
IAppointment temp = new Appointment(nSubject, nLocation, nStart, nLength, nDate);
listAppointments.Add(temp);
}
fileReader.Close();
if (listAppointments == null)
{
result = false;
}
else
{
result = true;
}
return result;