Example #1
0
        public MainWindow()
        {
            if (!File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + @"\cnfg.xml"))
            {
                Cnfgcs c = new Cnfgcs();
                c.Path_NotesSave = System.AppDomain.CurrentDomain.BaseDirectory + @"\saves\notessave.xml";
                c.Path_SafeSave  = System.AppDomain.CurrentDomain.BaseDirectory + @"\saves\safesave.xml";
                c.Path_Save      = System.AppDomain.CurrentDomain.BaseDirectory + @"\saves\save.xml";
                TheSerialiingClass.serialize <Cnfgcs>(System.AppDomain.CurrentDomain.BaseDirectory + @"\cnfg.xml", c);
            }
            if (!Directory.Exists(System.AppDomain.CurrentDomain.BaseDirectory + @"\saves"))
            {
                Directory.CreateDirectory(System.AppDomain.CurrentDomain.BaseDirectory + @"\saves");
            }
            cnfgcs           = TheSerialiingClass.deserialize <Cnfgcs>(System.AppDomain.CurrentDomain.BaseDirectory + @"\cnfg.xml");
            TheBooks         = TheSerialiingClass.deserialize <Books>(cnfgcs.Path_Save);
            mCatagoies       = new ObservableCollection <string>(Enum.GetNames(typeof(Catagory)).ToList <string>());
            mReadingStatuses = new ObservableCollection <string>(Enum.GetNames(typeof(ReadingStatus)).ToList <string>());
            InitializeComponent();
            lscg = new ListViewColumnGenerator(ref this.BooksLstView);
            this.CatagoryLstBx.ItemsSource      = mCatagoies;
            this.ReadingStatusLstBx.ItemsSource = mReadingStatuses;
            this.TagsLstBx.ItemsSource          = TheBooks.Tags;


            notesHolderConstroller          = new SomeNotesHolderConstroller();
            this.SomeNotesLstBx.ItemsSource = notesHolderConstroller.SomeNotesHolder.SomeNotes;
            Console.WriteLine(cnfgcs.Path_Save);
        }
Example #2
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     TheBooks.AllBooks = new ObservableCollection <Book>(TheBooks.AllBooks.Distinct());
     TheBooks.Tags     = new ObservableCollection <string>(TheBooks.Tags.Distinct());
     TheSerialiingClass.serialize <Books>(cnfgcs.Path_Save, TheBooks);
     saveSomeNote();
 }
Example #3
0
 private void SafeSaveBtn_Click(object sender, RoutedEventArgs e)
 {
     TheBooks.AllBooks = new ObservableCollection <Book>(TheBooks.AllBooks.Distinct());
     TheBooks.Tags     = new ObservableCollection <string>(TheBooks.Tags.Distinct());
     foreach (var book in TheBooks.AllBooks)
     {
         book.BookTags = new ObservableCollection <string>(book.BookTags.Distinct());
     }
     TheSerialiingClass.serialize <Books>(cnfgcs.Path_SafeSave, TheBooks);
 }
Example #4
0
 private void saveSomeNoteToFile()
 {
     TheSerialiingClass.serialize(cnfgcs.Path_NotesSave, notesHolderConstroller.SomeNotesHolder);
 }
 public void Unload()
 {
     Loaded = false;
     TheSerialiingClass.serialize(MainWindow.cnfgcs.Path_NotesSave, SomeNotesHolder);
 }
Example #6
0
        public void Addbook(ReadingStatus status, string name, ObservableCollection <string> tags, Catagory catagory)
        {
            AllBooks.Add(new Book(status, name, tags, catagory));

            TheSerialiingClass.serialize <Books>(MainWindow.cnfgcs.Path_Save, this);
        }