Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.IO;
- using System.Linq;
- using System.Runtime.InteropServices.WindowsRuntime;
- using Windows.Foundation;
- using Windows.Foundation.Collections;
- using Windows.UI.WindowManagement;
- using Windows.UI.Xaml;
- using Windows.UI.Xaml.Controls;
- using Windows.UI.Xaml.Controls.Primitives;
- using Windows.UI.Xaml.Data;
- using Windows.UI.Xaml.Hosting;
- using Windows.UI.Xaml.Input;
- using Windows.UI.Xaml.Media;
- using Windows.UI.Xaml.Media.Imaging;
- using Windows.UI.Xaml.Navigation;
- namespace Nazwiska
- {
- public sealed partial class MainPage : Page
- {
- ObservableCollection<Osoba> osoba = new ObservableCollection<Osoba>();
- public MainPage()
- {
- this.InitializeComponent();
- osoba.Add(new Osoba("Bartek", "Chwyć", "Biała Podlaska", "ms-appx:///Assets//Bartek.png"));
- osoba.Add(new Osoba("Marian", "Marczuk", "Biała Podlaska", "ms-appx:///Assets//Marian.png"));
- osoba.Add(new Osoba("Grześ", "Wojtiuk", "Miedzyrzec", "ms-appx:///Assets//grzes.png"));
- ListBox.ItemsSource = osoba;
- }
- private void Dodaj_Click(object sender, RoutedEventArgs e)
- {
- osoba.Add(new Osoba(ImieTxt.Text, NazwiskoTxt.Text, AdresTxt.Text, "ms-appx:///Assets//Marian.png"));
- }
- private void Usun_Click(object sender, RoutedEventArgs e)
- {
- Osoba kill = (Osoba)ListBox.SelectedItem;
- osoba.Remove(kill);
- }
- private void Edytuj_Click(object sender, RoutedEventArgs e)
- {
- Osoba o = (Osoba)ListBox.SelectedItem;
- o.Imie = ImieTxt.Text;
- o.Nazwisko = NazwiskoTxt.Text;
- o.Adres = AdresTxt.Text;
- }
- private void Szczegoly_Click(object sender, RoutedEventArgs e)
- {
- ShowNewWindow(sender, e);
- }
- AppWindow appWindow;
- Frame appWindowFrame = new Frame();
- private async void ShowNewWindow(object sender, RoutedEventArgs e)
- {
- Osoba osos = (Osoba)ListBox.SelectedItem;
- appWindow = await AppWindow.TryCreateAsync();
- appWindowFrame.Navigate(typeof(Form2),osos);
- ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowFrame);
- appWindow.Closed += delegate
- {
- appWindowFrame.Content = null;
- appWindow = null;
- };
- await appWindow.TryShowAsync();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement