Exemplo n.º 1
0
        public Hero SetCharacter(string characterName, string playerName)
        {
            Hero hero;
            var  charName = characterName.ToLower();

            switch (charName)
            {
            case "james":
                hero = new James(playerName);
                break;

            case "lea":
                hero = new Lea(playerName);
                break;

            case "gabriel":
                hero = new Gabriel(playerName);
                break;

            default:
                ConsolePrinter.PrintMessage(characterName + " is not a valid character.", false);
                hero = SetCharacter(Console.ReadLine(), playerName);
                break;
            }

            return(hero);
        }
Exemplo n.º 2
0
        private async void btnQuitarOOK_ChangeIndex(object sender, Gabriel.Cat.Uwp.ToggleButtonArgs e)
        {
            List<ItemCronos> itemsPerTreure;
            ItemCronos item;
            bool esperar;
            MessageBox.MessageResult result;

            esperar = btnQuitarOOK.Index == 0 && HayParaQuitar();
                if (esperar)
                {
                    result = await MessageBox.Show("Estas seguro que quieres eliminarlos ?", "Atención", MessageBox.MessageButtons.YesNo);
                    if (result == MessageBox.MessageResult.Yes)
                    {
                        itemsPerTreure = new List<ItemCronos>();

                        for (int i = 0; i < stkTiempos.Children.Count; i++)
                        {
                            item = stkTiempos.Children[i] as ItemCronos;
                        if (item.PendienteDeEliminar)
                        {
                            itemsPerTreure.Add(item);
                            items.Remove(item.Item);
                        }

                        }
                        itemsControls.RemoveRange(itemsPerTreure);
                        stkTiempos.Children.RemoveRange(itemsPerTreure);
                        ActualizaBackGroundItems();
                    }
                }
                for (int i = 0; i < items.Count; i++)
                    itemsControls[i].HistorialVisible = btnQuitarOOK.Index == 0;
                btnAñadir.Visibility = btnQuitarOOK.Index == 0 ? Visibility.Visible : Visibility.Collapsed;

        }
Exemplo n.º 3
0
 private void btnAñadir_ChangeIndex(object sender, Gabriel.Cat.Uwp.ToggleButtonArgs e)
 {
     ItemCronos newItem = new ItemCronos();
     newItem.OpenHistory += OpenHistoryEvent;
     items.Add(newItem.Item);
     itemsControls.Add(newItem);
     stkTiempos.Children.Add(newItem);
     ActualizaBackGroundItems();
 }
Exemplo n.º 4
0
		public static UnitatProducte[] UnitatsDessades(Gabriel.Cat.BaseDeDades baseDeDades, Recepta[] receptes, Producte[] productes)
		{
			string[,]	taula = baseDeDades.ConsultaTableDirect("UnitatsProductes");
			List<UnitatProducte> unitatsProductes = new List<UnitatProducte>();
			SortedList<string, Recepta> indexRecepta = new SortedList<string, Recepta>();
			SortedList<string, Producte> indexProducte = new SortedList<string, Producte>();
			for (int i = 0; i < receptes.Length; i++)
				indexRecepta.Add(receptes[i].PrimaryKey, receptes[i]);

			for (int i = 0; i < productes.Length; i++)
				indexProducte.Add(productes[i].PrimaryKey, productes[i]);
			foreach(var recepta in indexRecepta)
				foreach(var ingredient in recepta.Value)
					try
			{
				if (indexProducte.ContainsKey(ingredient.IdProductePerPosar))
					ingredient.Producte = indexProducte[ingredient.IdProductePerPosar];
			}
			catch { }
			if (taula != null)
				for (int i = 1; i < taula.GetLength(1); i++)
			{//por mirar
				unitatsProductes.Add(new UnitatProducte(indexProducte[taula[1,i]], Convert.ToDecimal(taula[3,i])/100M, ObjecteSql.StringToDateTime(taula[4,i]), ObjecteSql.StringToDateTime(taula[5,i]), indexRecepta[taula[2,i]]));
				unitatsProductes[unitatsProductes.Count - 1].PrimaryKey = taula[0,i];
				unitatsProductes[unitatsProductes.Count - 1].DessaCanvis();
				
			}
			return unitatsProductes.ToArray<UnitatProducte>();
		}
Exemplo n.º 5
0
		public static UnitatProducte[] UnitatsDessades(Gabriel.Cat.BaseDeDades baseDeDades)
		{
			Recepta[] receptesDessades = Recepta.ReceptesDessades(baseDeDades);
			return UnitatsDessades(baseDeDades, receptesDessades, Producte.ProductesDessats(baseDeDades, receptesDessades));
		}
Exemplo n.º 6
0
		public static Ingredient[] IngredientsDessats(Gabriel.Cat.BaseDeDades baseDeDades)
		{
			List<Ingredient> ingredients = new List<Ingredient>();
			string[,] taula = baseDeDades.ConsultaTableDirect("Ingredients");
			Ingredient ingredientDessat;
			if (taula != null)
				for (int i = 1; i < taula.GetLength(1); i++) {
				ingredientDessat = new Ingredient(taula[2, i], taula[1, i], Convert.ToDecimal(taula[3, i]) / 100M);//por mirar
				if (ingredientDessat.PrimaryKey == "")
					throw new Exception("FATAL ERROR");
				ingredients.Add(ingredientDessat);
			}
			return ingredients.ToArray<Ingredient>();

		}
Exemplo n.º 7
0
 public Control(Gabriel.Cat.BaseDeDades bd) : base(bd, creates)
 {
 }