Beispiel #1
0
        private void StartTest(int category)
        {
            RecipeManager recipesManager = new RecipeManager();
            List <Recipe> recipes        = recipesManager.GetList();
            List <int>    indexes        = new List <int>();

            for (int i = 0; i < recipes.Count; i++)
            {
                if (recipes[i].CategoryId != category || recipes[i].Level > Level)
                {
                    recipes.RemoveAt(i);
                    i--;
                }
                else
                {
                    indexes.Add(i);
                }
            }
            TestManager testManager = new TestManager(volume);
            bool        GameEnd     = testManager.StartGame(recipes, indexes, User);

            if (GameEnd)
            {
                gform.ReturnToMenu();
                closeAfterGame = true;
                this.Close();
            }
        }
Beispiel #2
0
        private void buttonRandom_Click(object sender, EventArgs e)
        {
            if (volume)
            {
                MusicManager.playSound();
            }
            RecipeManager recipesManager = new RecipeManager();
            List <Recipe> recipes        = recipesManager.GetList();
            List <int>    indexes        = new List <int>();

            for (int i = 0; i < recipes.Count; i++)
            {
                if (recipes[i].Level > Level)
                {
                    recipes.RemoveAt(i);
                    i--;
                }
                else
                {
                    indexes.Add(i);
                }
            }
            TestManager testManager = new TestManager(volume);

            if (testManager.StartGame(recipes, indexes, User))
            {
                ReturnToMenu();
            }
        }
Beispiel #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.RecipeDetails);
            ImageButton btnRecipes = FindViewById <ImageButton>(Resource.Id.imageButtonRecipes);
            TextView    textViewRecipeDetailsAuthor      = FindViewById <TextView>(Resource.Id.textViewRecipeDetailsAuthor);
            TextView    textViewRecipeDetailsTitle       = FindViewById <TextView>(Resource.Id.textViewRecipeDetailsTitle);
            TextView    textViewRecipeDetailsDescription = FindViewById <TextView>(Resource.Id.textViewRecipeDetailsDescription);
            Recipe      recipe;

            int recipeId = Intent.GetIntExtra("RecipeId", 0);

            RecipeManager recipeManager = new RecipeManager();

            recipe = recipeManager.SelectRecipe(recipeId);

            textViewRecipeDetailsTitle.Text       = recipe.Name;
            textViewRecipeDetailsAuthor.Text      = recipe.Creator;
            textViewRecipeDetailsDescription.Text = recipe.Description;

            Button buttonRecipeDetailsPrepare = FindViewById <Button>(Resource.Id.buttonRecipeDetailsPrepare);

            buttonRecipeDetailsPrepare.Click += (object sender, EventArgs e) =>
            {
                var myIntent = new Intent(this, typeof(StepsActivity));
                myIntent.PutExtra("RecipeId", recipeId);
                StartActivityForResult(myIntent, 0);
            };
        }
Beispiel #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Instanzieren
            SetContentView(Resource.Layout.Recipes);
            myListView = FindViewById <ListView>(Resource.Id.listViewRecipes);

            RecipeManager recipeManager = new RecipeManager();

            myRecipeList = recipeManager.GetListOfAllRecipes();

            // ArrayAdapter (Context context,int txtviewresource ID) Klasse um die Liste im gewünschten Format darzustellen
            // this steht hier für die Activity welche eine Subklasse von Context darstellt, daher ist das kein Problem)
            RecipesAdapter adapter = new RecipesAdapter(this, myRecipeList);

            myListView.Adapter = adapter;

            myListView.ItemClick += MyListView_ItemClick;
        }
        private void RecipeBookForm_Load(object sender, EventArgs e)
        {
            this.AllowTransparency     = true;
            this.BackColor             = Color.DarkGoldenrod;
            this.TransparencyKey       = this.BackColor;
            rtbIngredients.ScrollBars  = RichTextBoxScrollBars.None;
            rtbRecipe.ScrollBars       = RichTextBoxScrollBars.None;
            rtbIngredients.MouseWheel += new MouseEventHandler(rtbIngredients_MouseWheel);
            rtbRecipe.MouseWheel      += new MouseEventHandler(rtbRecipe_MouseWheel);
            try
            {
                RecipeManager recipesManager = new RecipeManager();
                recipes = recipesManager.GetList();
                for (int i = 0; i < recipes.Count; i++)
                {
                    if (recipes[i].CategoryId != Category || recipes[i].Level > Level)
                    {
                        recipes.RemoveAt(i);
                        i--;
                    }
                }
                if (recipes.Count != 0)
                {
                    pbImage.BackgroundImage       = recipes[0].Image;
                    pbImage.BackgroundImageLayout = ImageLayout.Stretch;
                    labelName.Text      = recipes[0].Name;
                    rtbIngredients.Text = "";
                    for (int i = 0; i < recipes[0].Ingredients.Count; i++)
                    {
                        rtbIngredients.Text += recipes[0].Ingredients[i] + "\n";
                    }
                    rtbRecipe.Text = recipes[0].Description.Replace("#", "");
                    pbBack.Visible = false;
                    if (recipes.Count == 1)
                    {
                        pbForward.Visible = false;
                    }

                    if (rtbRecipe.Text.Length > 450)
                    {
                        pbDown2.Visible = true;
                    }
                    else
                    {
                        pbDown2.Visible = false;
                    }
                    if (rtbIngredients.Lines.Length > 6)
                    {
                        pbDown.Visible = true;
                    }
                    else
                    {
                        pbDown.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }