private void EdycjaWindow_Loaded(object sender, RoutedEventArgs e) { cbxKategoria.ItemsSource = kategorie.ListaKategorii; List <Brush> kolory = new List <Brush>() { Brushes.Black, Brushes.Red, Brushes.Orange, Brushes.Yellow, Brushes.Green, Brushes.Blue, Brushes.Purple }; foreach (Brush kolor in kolory) { ComboBoxItem item = new ComboBoxItem(); item.Background = kolor; item.Content = ""; cbxKolor.Items.Add(item); } cbxRozmiar.ItemsSource = new List <double>() { 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72 }; Notatka.PrzepiszTekst(AktywnaNotatka.Tekst, tekstKopia); rtbTekst.Document = tekstKopia; edited = false; discarded = false; }
private void AktualizujKontrolki() { tbxTytul.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); tbxAutor.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); cbxKategoria.GetBindingExpression(ComboBox.SelectedIndexProperty).UpdateTarget(); Notatka.PrzepiszTekst(AktywnaNotatka.Tekst, tekstKopia); }
private void Wyswietl_Click(object sender, RoutedEventArgs e) { var wybrana = (INote)notatki.SelectedItem; Notatka okno = new Notatka(); okno.Ustaw(wybrana); okno.Show(); }
private void AktualizujZrodlo(DateTime dataModyfikacji) { AktywnaNotatka.DataModyfikacji = dataModyfikacji; tbxTytul.GetBindingExpression(TextBox.TextProperty).UpdateSource(); tbxAutor.GetBindingExpression(TextBox.TextProperty).UpdateSource(); AktywnaNotatka.Kategoria = kategorie.GetKategoria(cbxKategoria.SelectedIndex); Notatka.PrzepiszTekst(tekstKopia, AktywnaNotatka.Tekst); }
/// <summary> /// Tworzy nowy obiekt pamiątki. /// </summary> /// <param name="notatka"> /// Z parametru pobierany jest stan zapisywany w pamiątce. /// </param> public WpisHistorii(INotatka notatka) { Tekst = new FlowDocument(); Notatka.PrzepiszTekst(notatka.Tekst, Tekst); Tytul = notatka.Tytul; Autor = notatka.Autor; Kategoria = notatka.Kategoria; DataModyfikacji = notatka.DataModyfikacji; }
private void PodgladWindow_Loaded(object sender, RoutedEventArgs e) { FlowDocument doc = new FlowDocument(); Notatka.PrzepiszTekst(AktywnaNotatka.Tekst, doc); docTekst.FontFamily = SystemFonts.MessageFontFamily; docTekst.FontSize = 12; docTekst.Foreground = Brushes.Black; docTekst.PagePadding = new Thickness(5); for (int i = 0; i < doc.Blocks.Count; i++) { docTekst.Blocks.Add(doc.Blocks.ElementAt(i)); } cbxMarginesy.ItemsSource = new List <double>() { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }; }
private void MyImport(object sender, ExecutedRoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Xaml (*.xaml)|*.xaml|Wszystkie pliki (*.*)|*.*"; if (dlg.ShowDialog() == true) { FileStream fileStream = File.Open(dlg.FileName, FileMode.Open); INotatka wczytanaNotatka = (INotatka)XamlReader.Load(fileStream); tbxAutor.Text = wczytanaNotatka.Autor; tbxTytul.Text = wczytanaNotatka.Tytul; cbxKategoria.SelectedItem = wczytanaNotatka.Kategoria; Notatka.PrzepiszTekst(wczytanaNotatka.Tekst, tekstKopia); fileStream.Close(); } }