public Downloader(FilesManager fm, FilesManagerUpdate listener) { InitializeComponent(); mObj = fm; notify = listener; tb_folder.Text = mObj.RootFolder.FullName; tb_username.Text = Properties.Settings.Default.userName; }
public Main(String exe) { InitializeComponent(); if (Properties.Settings.Default.debugMode) { dbmode.Checked = true; } //initialize reader xmlReader = new XMLReader(); //Initialize tabs SetupLapTimesGraph(); SetupCarWearGraphs(); SetupPitStopsGraph(); SetupDriverPositionsGraph(); SetupCalculator(); //Add the always visible tabs tabs.TabPages.Clear(); tabs.TabPages.Add(tabFiles); tabs.TabPages.Add(tabCalculator); tabs.TabPages.Add(tabAbout); //root folder management String s = Properties.Settings.Default.rootFolder; if (!Directory.Exists(s)) { s = exe.Substring(0, exe.LastIndexOf("\\")); } FileManagerData = new FilesManager(new System.IO.DirectoryInfo(s), new System.Collections.ArrayList(), "", -1); this.tb_rootDirectory.Text = FileManagerData.RootFolder.FullName; RefreshFolder(true); }
public Main(String exe) { InitializeComponent(); if (Properties.Settings.Default.debugMode) { dbmode.Checked = true; } //initialize reader xmlReader = new XMLReader(); //Initialize tabs SetupLapTimesGraph(); SetupCarWearGraphs(); SetupPitStopsGraph(); SetupDriverPositionsGraph(); SetupCalculator(); //Add the always visible tabs tabs.TabPages.Clear(); tabs.TabPages.Add(tabFiles); tabs.TabPages.Add(tabCalculator); tabs.TabPages.Add(tabAbout); //root folder management String s = Properties.Settings.Default.rootFolder; if (!Directory.Exists(s)) s = exe.Substring(0, exe.LastIndexOf("\\")); FileManagerData = new FilesManager(new System.IO.DirectoryInfo(s), new System.Collections.ArrayList(), "", -1); this.tb_rootDirectory.Text = FileManagerData.RootFolder.FullName; RefreshFolder(true); }
/// <summary> /// Called after file manager data is updated, calls functions to load new file and update GUI /// </summary> /// <param name="fm"></param> private void FileManagerUpdates(FilesManager fm) { FileManagerData = fm; //Load file if (File.Exists(FileManagerData.SelectedFile)) { xmlReader.Load(FileManagerData.SelectedFile); this.Text = "F1-TM Viewer " + FileManagerData.SelectedFile.Replace(FileManagerData.RootFolder.FullName, ""); } //or load selected item from the list else if (FileManagerData.SelectedIndex > -1) { xmlReader.Load(((FileInfo)FileManagerData.Files[FileManagerData.SelectedIndex]).FullName); this.Text = "F1-TM Viewer " + ((FileInfo)FileManagerData.Files[FileManagerData.SelectedIndex]).FullName.Replace(FileManagerData.RootFolder.FullName, ""); } //if new file loaded correctly if (xmlReader.loaded) { //update track bar setTrackBar(); //update list boxes for drivers/teams list2.Items.AddRange(xmlReader.race.driver_team.getDrivers()); list1.Items.AddRange(xmlReader.race.driver_team.getTeams()); //update telemetry display populateData(); //update lap times display lapTimes.newRace(xmlReader.race); //update car wear displays dWear1.newWear(xmlReader.race.Car1Wear, 1); dWear2.newWear(xmlReader.race.Car2Wear, 2); //update pit stop display pStops.newPitstop(xmlReader.race); //update driver positions display driverPositions.newGraph(xmlReader.race); //Add tabs visible only when a file has been loaded if (!tabsAdded) { tabs.TabPages.Insert(1, tabRace); tabs.TabPages.Insert(2, tabWear1); tabs.TabPages.Insert(3, tabWear2); tabs.TabPages.Insert(4, tabPits); tabs.TabPages.Insert(5, tabPositions); tabs.TabPages.Insert(6, tabLaps); tabsAdded = true; } } else if (File.Exists(FileManagerData.SelectedFile) || FileManagerData.SelectedIndex > -1) { MessageBox.Show("Telemetry file could not be opened: \n" + xmlReader.message, "Telemetry File Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } //Make telemetry GUI visible/invisible makeVisible(xmlReader.loaded); }