Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.08 KB | None | 0 0
  1. using Chemtex5.Models;
  2. using SQLite;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.IO;
  6. using System.Linq;
  7. using System.Text;
  8.  
  9. using Xamarin.Forms;
  10.  
  11. namespace Chemtex5.Views
  12. {
  13.     public class AddTransportPage : ContentPage
  14.     {
  15.         private Picker _picker;
  16.         private Entry _idEntry;
  17.         private Entry _nameEntry;
  18.         private Entry _countEntry;
  19.         private Button _AddButton;
  20.  
  21.         Surowiec surowiec = new Surowiec();
  22.  
  23.         string _dbPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "myDB.db3");
  24.         public AddTransportPage()
  25.         {
  26.             this.Title = "Dodaj surowce z transportu";
  27.  
  28.             var db = new SQLiteConnection(_dbPath);
  29.  
  30.             StackLayout stackLayout = new StackLayout();
  31.  
  32.             for(int i = 0; i<5; i++)
  33.             {
  34.                 _picker = new Picker
  35.                 {
  36.                     ItemsSource = db.Table<Surowiec>().OrderBy(x => x.Name).ToList(),
  37.                     Title = "Wybierz surowiec",
  38.                     TitleColor = Color.Gold,
  39.                 };
  40.                 _idEntry = new Entry()
  41.                 {
  42.                     Placeholder = "ID",
  43.                     IsVisible = false
  44.                 };
  45.                 _countEntry = new Entry()
  46.                 {
  47.                     Keyboard = Keyboard.Text,
  48.                     Placeholder = "Wprowadź ilość surowca"
  49.                 };
  50.                
  51.                 stackLayout.Children.Add(_picker);
  52.                 stackLayout.Children.Add(_idEntry);
  53.                 stackLayout.Children.Add(_countEntry);
  54.             }
  55.             _AddButton = new Button();
  56.             _AddButton.Text = "Dodaj";
  57.             _AddButton.Clicked += _AddButton_Clicked;
  58.             Content = stackLayout;
  59.         }
  60.  
  61.        /* private async void _AddButton_Clicked(object sender, EventArgs e)
  62.         {
  63.             var db = new SQLiteConnection(_dbPath);
  64.             Surowiec surowiec = new Surowiec()
  65.             {
  66.                 Id =
  67.             }
  68.         }*/
  69.     }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement