public void sacuvajUcionicu(ObservableCollection <Ucionica> Ucionice, Raspored _raspored) { FileStream f1 = new FileStream("../../Save/ucionica.txt", FileMode.Create); f1.Close(); StreamWriter f = new StreamWriter("../../Save/ucionica.txt"); // MessageBox.Show("123"); foreach (Ucionica u in Ucionice) { f.Write(u.BrojRadnihMesta + "|" + u.ImaPametnaTabla + "|" + u.ImaProjektor + "|" + u.ImaTabla + "|"); f.Write(u.Sistem); f.Write("|" + u.Opis + "|" + u.Oznaka + "|"); f.Write(_raspored.File + "|"); if (u.Softveri != null) { if (u.Softveri.Count > 0) { foreach (Softver s in u.Softveri) { if (s != null) { f.Write(s.Oznaka + ","); } } } } f.WriteLine(); } foreach (Ucionica u in UcioniceP) { f.Write(u.BrojRadnihMesta + "|" + u.ImaPametnaTabla + "|" + u.ImaProjektor + "|" + u.ImaTabla + "|"); f.Write(u.Sistem); f.Write("|" + u.Opis + "|" + u.Oznaka + "|"); f.Write(u.File + "|"); if (u.Softveri != null) { if (u.Softveri.Count > 0) { foreach (Softver s in u.Softveri) { if (s != null) { f.Write(s.Oznaka + ","); } } } } f.WriteLine(); } f.Close(); }
public void sacuvajSmer(ObservableCollection <Smer> Smerovi, Raspored _raspored) { StreamWriter f = new StreamWriter("../../Save/smer.txt"); foreach (Smer s in Smerovi) { f.WriteLine(s.Oznaka + "|" + s.Skracenica + "|" + s.Opis + "|" + s.Naziv + "|" + s.DatumUvodjenja + "|" + _raspored.File); } foreach (Smer s in SmeroviP) { f.WriteLine(s.Oznaka + "|" + s.Skracenica + "|" + s.Opis + "|" + s.Naziv + "|" + s.DatumUvodjenja + "|" + s.File); } f.Close(); }
public void sacuvajPredmet(ObservableCollection <Predmet> Predmeti, Raspored _raspored) { StreamWriter f = new StreamWriter("../../Save/predmet.txt"); foreach (Predmet p in Predmeti) { f.Write(p.Naziv + "|" + p.BrojTermina + "|" + p.DuzinaTermina + "|"); f.Write(p.Sistem); f.Write("|" + p.Opis + "|" + p.Oznaka + "|" + p.Skracenica + "|"); if (p.SmerPredmeta != null) { f.Write(p.SmerPredmeta.Oznaka); } f.Write("|" + p.TrebaPametnaTabla + "|" + p.TrebaProjektor + "|" + p.TrebaTabla + "|" + p.VelicinaGrupe + "|" + _raspored.File + "|"); //if (p.Softveri == null || p.Softveri.Count==0) foreach (Softver s in p.Softveri) { f.Write(s.Oznaka + ","); } f.WriteLine(); } foreach (Predmet p in PredmetiP) { f.Write(p.Naziv + "|" + p.BrojTermina + "|" + p.DuzinaTermina + "|"); f.Write(p.Sistem); f.Write("|" + p.Opis + "|" + p.Oznaka + "|" + p.Skracenica + "|"); if (p.SmerPredmeta != null) { f.Write(p.SmerPredmeta.Oznaka); } f.Write("|" + p.TrebaPametnaTabla + "|" + p.TrebaProjektor + "|" + p.TrebaTabla + "|" + p.VelicinaGrupe + "|" + p.File + "|"); //if (p.Softveri == null || p.Softveri.Count==0) foreach (Softver s in p.Softveri) { f.Write(s.Oznaka + ","); } f.WriteLine(); } f.Close(); f.Close(); }
public void sacuvajSoftver(ObservableCollection <Softver> Softveri, Raspored _raspored) { StreamWriter f = new StreamWriter("../../Save/softver.txt"); foreach (Softver s in Softveri) { f.Write(s.Oznaka + "|" + s.Naziv + "|" + s.Cena + "|" + s.GodinaIzdavanja + "|"); f.Write(s.Sistem); f.Write("|" + s.Opis + "|" + s.Proizvodjac + "|" + _raspored.File + "|" + s.Sajt); f.Write("\r\n"); } foreach (Softver s in SoftveriP) { f.Write(s.Oznaka + "|" + s.Naziv + "|" + s.Cena + "|" + s.GodinaIzdavanja + "|"); f.Write(s.Sistem); f.Write("|" + s.Opis + "|" + s.Proizvodjac + "|" + s.File + "|" + s.Sajt); f.Write("\r\n"); } f.Close(); }
private void Novi_Raspored_Click(object sender, RoutedEventArgs e) { var r = new Raspored.DDrop.PravljenjeRasporeda(raspored, citanje_pisanje); r.ShowDialog(); raspored = r.rasp; r.sacuvajRaspored(); for (int i = 1; i < 61; i++) { for (int j = 1; j < 7; j++) { if (Termini[i][j].Count != 0) { Termini[i][j].RemoveAt(0); ListView lv; //MessageBox.Show("lw0" + (c1 + i) + r1); if (i < 10) { lv = (ListView)this.FindName("lw0" + (i) + j); } else { lv = (ListView)this.FindName("lw" + i + j); } if (lv != null) { lv.Background = Brushes.White; } } } } foreach (UcionicaRaspored ur in raspored.Rasporedi) { if (ur.Ucionica.Oznaka == SelectedUcionica.Oznaka) { for (int i = 0; i < 61; i++) { for (int j = 0; j < 7; j++) { if (ur.Rasporedi[i][j].Oznaka != "") { Termini[i][j].Add(ur.Rasporedi[i][j]); if (Termini[i][j][0].Oznaka == "Pauza") { ListView lv; //MessageBox.Show("lw0" + (c1 + i) + r1); if (i < 10) { lv = (ListView)this.FindName("lw0" + (i) + j); } else { lv = (ListView)this.FindName("lw" + i + j); } if (lv != null) { lv.Background = Brushes.PaleVioletRed; } } else { ListView lv; //MessageBox.Show("lw0" + (c1 + i) + r1); if (i < 10) { lv = (ListView)this.FindName("lw0" + (i) + j); } else { lv = (ListView)this.FindName("lw" + i + j); } if (lv != null) { lv.Background = Brushes.Beige; } } } } } } } }
private void Button_Click_1(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.DefaultExt = ".rsp"; openFileDialog.Filter = "Raspored dokument (.rsp)|*.rsp"; if (openFileDialog.ShowDialog() == true) { String filename = openFileDialog.FileName; RecentFileList.InsertFile(filename); saveRecent(filename); Prozor1.Visibility = Visibility.Visible; Prozor2.Visibility = Visibility.Hidden; Raspored_Button.IsEnabled = true; citanje_pisanje = new CitanjeIPisanje(filename); //TO_DO: raspored -> citanjeIz fajla raspored = citanje_pisanje.otvoriRaspored(filename); raspored.File = filename; saveRecent(filename); RecentFileList.InsertFile(filename); Prozor1.Visibility = Visibility.Visible; Prozor2.Visibility = Visibility.Hidden; Raspored_Button.IsEnabled = true; ///raspored = new Model.Raspored(); List <Ucionica> u = citanje_pisanje.otvoriUcionicu(raspored.File); Raspored_Button.IsEnabled = true; Ucionice = new ObservableCollection <Ucionica>(u); //this.dgrMainUcionica.ItemsSource = u; //this.dgrMainUcionica.SelectedItem = SelectedUcionica; this.lsUcionice.ItemsSource = Ucionice; Prozor1.Visibility = Visibility.Visible; Prozor2.Visibility = Visibility.Hidden; Termini = new List <List <ObservableCollection <Predmet> > >(); TerminiDan = new List <List <ObservableCollection <Predmet> > >(); //Termini = new List<List<Predmet>>(); for (int i = 0; i < 61; i++) { List <ObservableCollection <Predmet> > temp = new List <ObservableCollection <Predmet> >(); List <ObservableCollection <Predmet> > temp1 = new List <ObservableCollection <Predmet> >(); for (int j = 0; j < 7; j++) { temp.Add(new ObservableCollection <Predmet>()); } Termini.Add(temp); for (int k = 0; k < 11; k++) { temp1.Add(new ObservableCollection <Predmet>()); } TerminiDan.Add(temp1); } c10.Width = new GridLength(100); c9.Width = new GridLength(100); c8.Width = new GridLength(100); c7.Width = new GridLength(100); c6.Width = new GridLength(100); c5.Width = new GridLength(100); c4.Width = new GridLength(100); c3.Width = new GridLength(100); c2.Width = new GridLength(100); c1.Width = new GridLength(100); if (uc.Count == 0) { uc = new List <string>(); for (int i = 0; i < u.Count; i++) { uc.Add(u[i].Oznaka); } } else { for (int i = 0; i < u.Count; i++) { uc[i] = (u[i].Oznaka); } } if (u.Count < 10) { c10.Width = new GridLength(0); } if (u.Count < 9) { c9.Width = new GridLength(0); } if (u.Count < 8) { c8.Width = new GridLength(0); } if (u.Count < 7) { c7.Width = new GridLength(0); } if (u.Count < 6) { c6.Width = new GridLength(0); } if (u.Count < 5) { c5.Width = new GridLength(0); } if (u.Count < 4) { c4.Width = new GridLength(0); } if (u.Count < 3) { c3.Width = new GridLength(0); } if (u.Count < 2) { c2.Width = new GridLength(0); } if (u.Count < 1) { c1.Width = new GridLength(0); } //raspored = new Model.Raspored(); } }
bool FileOpenCore(string filepath) { // MessageBox.Show(filepath); if (!File.Exists(filepath)) { MessageBox.Show("File is removed or moved."); RecentFileList.RemoveFile(filepath); } else { RecentFileList.InsertFile(filepath); saveRecent(filepath); Prozor1.Visibility = Visibility.Visible; Prozor2.Visibility = Visibility.Hidden; Raspored_Button.IsEnabled = true; //TO_DO: raspored -> citanjeIz fajla raspored = citanje_pisanje.otvoriRaspored(filepath); raspored.File = filepath; citanje_pisanje = new CitanjeIPisanje(filepath); RecentFileList.InsertFile(filepath); Prozor1.Visibility = Visibility.Visible; Prozor2.Visibility = Visibility.Hidden; Raspored_Button.IsEnabled = true; ///raspored = new Model.Raspored(); List <Ucionica> u = citanje_pisanje.otvoriUcionicu(raspored.File); Raspored_Button.IsEnabled = true; Ucionice = new ObservableCollection <Ucionica>(u); //this.dgrMainUcionica.ItemsSource = u; //this.dgrMainUcionica.SelectedItem = SelectedUcionica; this.lsUcionice.ItemsSource = Ucionice; Prozor1.Visibility = Visibility.Visible; Prozor2.Visibility = Visibility.Hidden; Termini = new List <List <ObservableCollection <Predmet> > >(); TerminiDan = new List <List <ObservableCollection <Predmet> > >(); //Termini = new List<List<Predmet>>(); for (int i = 0; i < 61; i++) { List <ObservableCollection <Predmet> > temp = new List <ObservableCollection <Predmet> >(); List <ObservableCollection <Predmet> > temp1 = new List <ObservableCollection <Predmet> >(); for (int j = 0; j < 7; j++) { temp.Add(new ObservableCollection <Predmet>()); } Termini.Add(temp); for (int k = 0; k < 11; k++) { temp1.Add(new ObservableCollection <Predmet>()); } TerminiDan.Add(temp1); } c10.Width = new GridLength(100); c9.Width = new GridLength(100); c8.Width = new GridLength(100); c7.Width = new GridLength(100); c6.Width = new GridLength(100); c5.Width = new GridLength(100); c4.Width = new GridLength(100); c3.Width = new GridLength(100); c2.Width = new GridLength(100); c1.Width = new GridLength(100); if (uc.Count == 0) { uc = new List <string>(); for (int i = 0; i < u.Count; i++) { uc.Add(u[i].Oznaka); } } else { for (int i = 0; i < u.Count; i++) { uc[i] = (u[i].Oznaka); } } if (u.Count < 10) { c10.Width = new GridLength(0); } if (u.Count < 9) { c9.Width = new GridLength(0); } if (u.Count < 8) { c8.Width = new GridLength(0); } if (u.Count < 7) { c7.Width = new GridLength(0); } if (u.Count < 6) { c6.Width = new GridLength(0); } if (u.Count < 5) { c5.Width = new GridLength(0); } if (u.Count < 4) { c4.Width = new GridLength(0); } if (u.Count < 3) { c3.Width = new GridLength(0); } if (u.Count < 2) { c2.Width = new GridLength(0); } if (u.Count < 1) { c1.Width = new GridLength(0); } //raspored = new Model.Raspored(); } return(true); }