コード例 #1
0
        public MainPage()
        {
            InitializeComponent();

            SearchIngredients = new List <IngredientDtoV2>();
            MyIngredients     = User.User.SavedIngredinets;
            foreach (var ingredient in MyIngredients)
            {
                MyIngredientModels.Add(new IngredientListModel()
                {
                    Ingredient = ingredient, IsAdded = true
                });
            }
            ExcludedIngredients = User.User.SavedExcludedIngredinets;
            foreach (var ingredient in ExcludedIngredients)
            {
                ExcludedIngredientModels.Add(new IngredientListModel()
                {
                    Ingredient = ingredient, IsAdded = true
                });
            }

            NoIngredientsError = false;

            XamlSetup();

            BindingContext = this;
        }
コード例 #2
0
 void MyIngredientsRemoveAt(int index)
 {
     MyIngredients.RemoveAt(index);
     if (!InSearchWindow)
     {
         MyIngredientModels.RemoveAt(index);
         Sorting.ResizeListView(ListView_myIngredients, MyIngredients.Count);
     }
     SaveMyIngredients(MyIngredients);
 }
コード例 #3
0
 void MyIngredientsAdd(IngredientDtoV2 ingredient)
 {
     MyIngredients.Insert(0, ingredient);
     if (!InSearchWindow)
     {
         Sorting.ResizeListView(ListView_myIngredients, MyIngredients.Count);
         MyIngredientModels.Insert(0, new IngredientListModel()
         {
             Ingredient = ingredient
         });
     }
     SaveMyIngredients(MyIngredients);
 }
コード例 #4
0
        // --------------------------------------------- SPAGHETTI ---------------------------------------------------


        void GenerateMyIngredientModels()
        {
            MyIngredientModels.Clear();
            foreach (var ingredient in MyIngredients)
            {
                MyIngredientModels.Add(new IngredientListModel
                {
                    Ingredient = ingredient,
                    IsAdded    = true
                });
            }
            Sorting.ResizeListView(ListView_myIngredients, MyIngredients.Count);
        }
コード例 #5
0
 // Clicked in myIngredients list
 private void ListView_myIngredients_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     MyIngredientsRemoveAt(MyIngredientModels.IndexOf(ListView_myIngredients.SelectedItem as IngredientListModel));
 }