public MainWindow() { InitializeComponent(); pData = pData.LoadPData(); currentProfile = currentProfile.LoadSelectedProfile(pData); TList.ItemsSource = currentProfile.SetProfile.GetTickets; }
public Settings(MainWindow main) { InitializeComponent(); pData = pData.LoadPData(); pf = pf.LoadAllProfile(); TTypeCB.Items.Add("Default"); TTypeCB.Items.Add("6 number combination"); TTypeCB.Items.Add("7 number combination"); TTypeCB.Items.Add("8 number combination"); TTypeCB.SelectedIndex = 0; TMaximumAmount.Items.Add("Default"); TMaximumAmount.Items.Add("50 Tickets"); TMaximumAmount.Items.Add("100 Tickets"); TMaximumAmount.Items.Add("300 Tickets"); TMaximumAmount.Items.Add("500 Tickets"); TMaximumAmount.Items.Add("1000 Tickets"); TMaximumAmount.Items.Add("3000 Tickets"); TMaximumAmount.Items.Add("5000 Tickets"); TMaximumAmount.Items.Add("Custom"); TMaximumAmount.SelectedIndex = 0; FillProfileBox(); if (ProfileBox != null) { ProfileBox.SelectedIndex = 0; } main.changeContentOfPData(pData); this.main = main; }
public static Profile LoadSelectedProfile(this Profile profile, PData pData) { try { TicketManagement tm = new TicketManagement(); profile = new Profile(); string reader = File.ReadAllText(Directory.GetCurrentDirectory() + "\\Profiles\\" + pData.PName + ".csv"); string[] lines = reader.Split('\n'); string[] pr = null; foreach (var prop in lines) { if (prop == "") { break; } pr = prop.Split(','); pr[0] = pr[0].Substring(pr[0].IndexOf(':') + 1); tm.tickets.Add(new Ticket(int.Parse(pr[0]), pr[1], bool.Parse(pr[2]), bool.Parse(pr[3]))); } profile = new Profile(tm, pData.PName); return(profile); } catch (Exception e) { return(null); } }
public static PData LoadPData(this PData pData) { try { string file = File.ReadAllText(Directory.GetCurrentDirectory() + "\\PData.csv"); string[] data = file.Split(','); pData = new PData(int.Parse(data[0]), data[1]); return(pData); } catch (Exception) { return(null); } }
public void changeContentOfPData(PData pData) { this.pData = pData; currentProfile = currentProfile.LoadSelectedProfile(pData); TList.Items.Refresh(); }
public PData() { data = data.LoadPData(); }
public void changeContentOfPData(PData pData) { this.pData = pData; }