Esempio n. 1
0
        static void Zadatak7()
        {
            DarkTheme  darkTheme  = new DarkTheme();
            LightTheme lightTheme = new LightTheme();

            ReminderNote note1 = new ReminderNote("buy milk lol", lightTheme);
            ReminderNote note2 = new ReminderNote("buy milk again lol", darkTheme);

            Notebook notebook = new Notebook(darkTheme);

            notebook.AddNote(note1, lightTheme);
            notebook.AddNote(note2);
            notebook.Display();
        }
        public void SaveNote()
        {
            var note = NewNote();

            if (tempNote != null)
            {
                note     = tempNote;
                tempNote = null;
            }
            if (SelectedIndex < 0)
            {
                //adding new note into list doesnt work.
                Notes.Add(note);
                notebook.AddNote(note);
                SelectedIndex = Notes.IndexOf(note);
                CreateList();
            }
            else
            {
                //updating current note works.
                note.Title    = SelectedNote.Title;
                note.NoteBody = SelectedNote.NoteBody;
                notebook.UpdateNote(note);
                Debug.WriteLine("Current note has been saved!");
            }
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            note note = new note("Naslov", "text, tijelo poruke");

            note.Show();

            StringBuilder sbTitle  = new StringBuilder("Naslov p");
            StringBuilder sbBody   = new StringBuilder("Text pp0");
            Notebook      notebook = new Notebook();

            for (int i = 0; i < 8; i++)
            {
                sbTitle.Append('w', i / 2);
                sbBody.Append('b', i / 3);
                notebook.AddNote(new note(sbTitle.ToString(), sbBody.ToString()));
            }

            CIterator iterator = new CIterator(notebook);

            iterator.First().Show();
            while (iterator.Next() != null)
            {
                iterator.Current.Show();
            }

            notebook.Clear();

            CareTaker careTaker = new CareTaker();
            ToDoItem  tdi1      = new ToDoItem("naslov1", "text1", DateTime.Now);
            ToDoItem  tdi2      = new ToDoItem("naslov12", "text12", DateTime.Now);
            ToDoItem  tdi3      = new ToDoItem("naslov123", "text123", DateTime.MinValue);
            ToDoItem  tdi4      = new ToDoItem("naslov1234", "text1234", DateTime.MaxValue);

            tdi1.AddStateCT(careTaker);
            tdi2.AddStateCT(careTaker);
            tdi3.AddStateCT(careTaker);
            tdi4.AddStateCT(careTaker);

            ToDoItem getStateTdi = new ToDoItem("", "", DateTime.MinValue);

            getStateTdi.RestoreState(careTaker.GetByTitle("naslov12"));

            Console.WriteLine(getStateTdi.ToString());

            HomeThermostat termostat1    = new HomeThermostat();
            HomeThermostat termostat2    = new HomeThermostat();
            CarThermostat  termostatAuto = new CarThermostat();
            WeatherStation station       = new WeatherStation(44);

            station.AddObserver(termostat1);
            station.AddObserver(termostat2);
            station.AddObserver(termostatAuto);
            station.SetTemperature(22);
            station.SetTemperature(2);
        }