コード例 #1
0
 public SelectedProductPage(Prodcut product)
 {
     InitializeComponent();
     //	StartListening();
     _product = product;
     GetProductState(_product);
     GetProductLevel();
     Debug.WriteLine($"State Before Click {_product.State}");
 }
コード例 #2
0
 void GetProductState(Prodcut product)
 {
     if (product.State)
     {
         StateImage.SvgPath = "Acriworks_DeviceSimulator.SVG.DeviceON.svg";
     }
     else
     {
         StateImage.SvgPath = "Acriworks_DeviceSimulator.SVG.DeviceOFF.svg";
     }
 }
コード例 #3
0
 public Task <int> SaveProdcutAsync(Prodcut product)
 {
     if (product.ID != 0)
     {
         return(database.UpdateAsync(product));
     }
     else
     {
         return(database.InsertAsync(product));
     }
 }
コード例 #4
0
        async void AddProductClicked(object sender, EventArgs e)
        {
            if (deviceName.Text == null)
            {
                await DisplayAlert("Error", "Please fill in all fields", "Ok");
            }
            else
            {
                product = new Prodcut {
                    Name = deviceName.Text, State = state, level = levelElement.SelectedIndex
                };
                await App.Database.SaveProdcutAsync(product);

                await Navigation.PushAsync(new ListProductsPage());
            }
        }
コード例 #5
0
 public Task <int> DeleteProdcutAsync(Prodcut product)
 {
     return(database.DeleteAsync(product));
 }
コード例 #6
0
 public Task <List <Prodcut> > QueryProdcutAsync(Prodcut product)
 {
     return(database.QueryAsync <Prodcut>("SELECT * FROM [Prodcut] WHERE ID = ?", product.ID));
 }
コード例 #7
0
 public void UpdateProductAsync(Prodcut product)
 {
     var Update = database.QueryAsync <Prodcut>("UPDATE Prodcut WHERE ID = ?", product.ID);
 }