Esempio n. 1
0
        public void new_note()
        {
            NoteWindow a = new NoteWindow(dog);

            //NoteWindow a = new NoteWindow(dog, "RetrowaveWindowStyle");
            //a.Style = (System.Windows.Style) a.FindResource("RetrowaveWindowStyle");

            a.Show();
            notes.Add(a);
        }
Esempio n. 2
0
        public int restore_from_disk()
        {
            if (!Directory.Exists(directory_path))
            {
                Directory.CreateDirectory(directory_path);
            }

            string[] all_files = Directory.GetFiles(directory_path);

            if (all_files.Length < 1)
            {
                NoteWindow a = new NoteWindow(dog);
                a.Show();
                save_note(a);
                return(1);
            }

            next_note_id = 0;

            foreach (string filename in all_files)
            {
                Stream             stream2    = new FileStream(filename, FileMode.Open);
                BinaryFormatter    bformatter = new BinaryFormatter();
                NoteWindow.Memento obj        = (NoteWindow.Memento)bformatter.Deserialize(stream2);
                stream2.Close();

                NoteWindow b = new NoteWindow(dog);
                b.restore_memento(obj);

                b.Style = (System.Windows.Style)b.FindResource(obj.Style_name);

                b.Show();
                notes.Add(b);
            }

            return(0);
        }