protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); object[] data = (object[])e.Parameter; tomato = (Tomato)data[0]; string[] tasks = (string[])data[1]; foreach (string task in tasks) { ListTask.Items.Add(new CustomItemList(task)); } tomato.TimerCompleteEvent += Tomato_TimerCompleteEvent; tomato.TimerTickEvent += Tomato_TimerTickEvent; tomato.TimerStopEvent += Tomato_TimerStopEvent; LoadList(); TxtTime.Text = ""; BeginExecutedExtension(); if (!tomato.AbleInternet) { netConnection = new InternetConnection(InternetAbled); netConnection.StartVerification(); } }
public static List <Tomato> AugmentData(List <Tomato> tomatoes) { var copyTomatoes = new List <Tomato>(tomatoes); var tomatosAugmented = new List <Tomato>(); foreach (Tomato norm in tomatoes) { var flipH = new Tomato( (int)norm.Type, norm.ColoredImage.Flip(FlipType.Horizontal), norm.GrayImage1.Flip(FlipType.Horizontal), norm.GrayImage2.Flip(FlipType.Horizontal), norm.Name ); var flipV = new Tomato( (int)norm.Type, norm.ColoredImage.Flip(FlipType.Vertical), norm.GrayImage1.Flip(FlipType.Vertical), norm.GrayImage2.Flip(FlipType.Vertical), norm.Name ); tomatosAugmented.Add(flipV); tomatosAugmented.Add(flipH); } copyTomatoes.AddRange(tomatosAugmented); return(copyTomatoes); }
/// <summary> /// 添加一个已完成的番茄钟 /// </summary> /// <param name="taskID"></param> /// <param name="tomatoID"></param> public void FinishedOneTomato(Tomato tomato) { using (var context = Context) { var taskInfo = context.TaskModels.FirstOrDefault(t => t.TaskID == tomato.TaskID); if (taskInfo == null) { throw new Exception("TaskID of tomato does not exist"); } // 将番茄钟加入表中 context.TomatoesModels.Add(tomato); // 修改任务状态 taskInfo.FinishedTomatoCount++; // 修改相关文件状态 List <string> relativeFiles = GetFilePath(tomato.BeginTime, tomato.EndTime); foreach (string relativeFile in relativeFiles) { context.TaskFileModels.Add(new TaskFile() { TaskID = taskInfo.TaskID, FilePath = relativeFile }); } context.SaveChanges(); } }
public AddOrder(Customer customer) { InitializeComponent(); ACustomer = customer; Coffee aCoffee = new Coffee(); CoffeeDarkRoast aDarkRoastCoffee = new CoffeeDarkRoast(); SandwichWithBacon aBaconSandwich = new SandwichWithBacon(); SandwichWithEggSalad aEggSandwich = new SandwichWithEggSalad(); SandwichWithRoastedBeef aRoastBeefSandwich = new SandwichWithRoastedBeef(); Tea aTea = new Tea(); Milk aMilk = new Milk(); Suggar aSuggar = new Suggar(); Sweetener aSweetner = new Sweetener(); Cheese aCheese = new Cheese(); Mayo aMayo = new Mayo(); Lettuce aLettuce = new Lettuce(); Tomato aTomato = new Tomato(); lbxOrders.Items.Add(aCoffee); lbxOrders.Items.Add(aDarkRoastCoffee); lbxOrders.Items.Add(aBaconSandwich); lbxOrders.Items.Add(aEggSandwich); lbxOrders.Items.Add(aRoastBeefSandwich); lbxOrders.Items.Add(aTea); lbxAdditions.Items.Add(aSweetner); lbxAdditions.Items.Add(aMilk); lbxAdditions.Items.Add(aSuggar); lbxAdditions.Items.Add(aCheese); lbxAdditions.Items.Add(aMayo); lbxAdditions.Items.Add(aLettuce); lbxAdditions.Items.Add(aTomato); }
public void RefrigeratorTestTwo() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); LadyFinger ladyFinger = new LadyFinger(); refrigerator.AddVegetable(tomato, 25); refrigerator.SetVegetableMinimumQuantity(tomato, 10); refrigerator.AddVegetable(cabbage, 10); refrigerator.SetVegetableMinimumQuantity(cabbage, 2); refrigerator.AddVegetable(ladyFinger, 7); refrigerator.SetVegetableMinimumQuantity(ladyFinger, 2); refrigerator.TakeOutVegetable(tomato, 20); refrigerator.TakeOutVegetable(cabbage, 7); var actualVegetableQuantity = refrigerator.CheckRefrigeratorContents(); var expectedVegetableQuantity = new List <KeyValuePair <Vegetable, int> >(); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 5)); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(cabbage, 3)); expectedVegetableQuantity.Add(new KeyValuePair <Vegetable, int>(ladyFinger, 7)); Assert.Equal(expectedVegetableQuantity, actualVegetableQuantity); }
public void Chop(Mobile from) { if (from.InRange(this.GetWorldLocation(), 1)) { if (from == m_sower) { from.Direction = from.GetDirectionTo(this); double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100; if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue)) { Tomato fruit = new Tomato(Utility.Random(m_yield + 2)); from.AddToBackpack(fruit); if (Utility.RandomDouble() <= .1) { Vines logs = new Vines(); from.AddToBackpack(logs); } } this.Delete(); from.SendMessage("You chop the plant up"); } else { from.SendMessage("You do not own this plant !!!"); } } else { from.SendLocalizedMessage(500446); } }
public static void InitializeApis() { var serviceCodes = new Dictionary <string, string>(); try { using (StreamReader sr = new StreamReader("servicecodes.key")) { while (!sr.EndOfStream) { String line = sr.ReadLine(); var split = line.Split('='); serviceCodes.Add(split[0], split[1]); } } } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } RequestChecker.TmDbReadyOrWait(); TmdbApi = new Tmdb(serviceCodes["Tmdb"], "de"); RequestChecker.TomatoReadyOrWait(); TomatoApi = new Tomato(serviceCodes["Tomato"]); }
public void VegetableTrackerTest() { VegetableTracker vegetableTracker = new VegetableTracker(); ConfigurationManager configurationManager = new ConfigurationManager(StorageFactory.GetStorage("inMemory")); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); LadyFinger ladyFinger = new LadyFinger(); var vegetableQuantity = new List <KeyValuePair <Vegetable, int> >(); vegetableQuantity.Add(new KeyValuePair <Vegetable, int>(tomato, 25)); vegetableQuantity.Add(new KeyValuePair <Vegetable, int>(cabbage, 3)); vegetableQuantity.Add(new KeyValuePair <Vegetable, int>(ladyFinger, 2)); configurationManager.SetMinimumQuantity(tomato, 5); configurationManager.SetMinimumQuantity(cabbage, 5); configurationManager.SetMinimumQuantity(ladyFinger, 5); var expectedInsufficientVegetables = new List <KeyValuePair <Vegetable, int> >(); expectedInsufficientVegetables.Add(new KeyValuePair <Vegetable, int>(cabbage, 3)); expectedInsufficientVegetables.Add(new KeyValuePair <Vegetable, int>(ladyFinger, 2)); var actualInsufficientVegetables = vegetableTracker.GetInsufficientVegetableQuantity(vegetableQuantity, configurationManager); Assert.Equal(expectedInsufficientVegetables, actualInsufficientVegetables); }
static Drink SelectDrink() { Drink drink = null; do { Console.WriteLine("Bonjour"); Console.WriteLine("Veuillez choisir votre boisson !"); Console.WriteLine("Taper 1 pour un café, taper 2 pour un thé et taper 3 pour une soupe"); string userChoice = Console.ReadLine(); switch (userChoice) { case "1": drink = new Coffee(); break; case "2": drink = new Tea(); break; case "3": drink = new Tomato(); break; default: Console.WriteLine("Je n'ai pas compris votre demande, réessayez"); break; } } while (drink == null); return(drink); }
/// <summary> /// 获取一个番茄的效率 /// </summary> /// <param name="tomato"></param> /// <returns></returns> private double GetTomatoEfficiency(Tomato tomato) { tomato = GetFullTomato(tomato.TomatoID); if (tomato == null) { return(0); } TimeStatisticService tss = TimeStatisticService.GetTimeStatisticService(); List <UserActivity> userActivities = tss.GetUserActivitiesWithin(tomato.BeginTime, tomato.EndTime); TimeSpan focusTime = new TimeSpan(); TimeSpan totalTime = tomato.EndTime - tomato.BeginTime; if (totalTime.TotalSeconds <= 0) { return(0); } List <string> focusAppNames = new List <string>(); foreach (var focusApp in tomato.FocusApps) { focusAppNames.Add(focusApp.AppName); } foreach (UserActivity userActivity in userActivities) { if (focusAppNames.Contains(userActivity.Name)) { focusTime += userActivity.SpanTime; } } return(focusTime.TotalSeconds / totalTime.TotalSeconds); }
public void ConfigurationManagerTest() { ConfigurationManager configurationManager = new ConfigurationManager(StorageFactory.GetStorage("inMemory")); Tomato tomato = new Tomato(); configurationManager.SetMinimumQuantity(tomato, 4); Assert.Equal(4, configurationManager.GetMinimumQuantity(tomato)); }
public void InMemoryStorageClassTest() { InMemoryStorage storage = new InMemoryStorage(); Tomato tomato = new Tomato(); storage.SetVegetableMinimumQuantity(tomato, 5); Assert.Equal(5, storage.GetVegetableMinimumQuantity(tomato)); }
public ActionResult DeleteConfirmed(int id) { Tomato tomato = db.Tomatoes.Find(id); db.Tomatoes.Remove(tomato); db.SaveChanges(); return(RedirectToAction("Index")); }
public void MinimunVegetableQuantity() { ConfigurationManager configurationManager = new ConfigurationManager(new InMemoryStorage()); Tomato tomato = new Tomato(); configurationManager.SetMinimumQuantity(tomato, 2000); Assert.Equal(2000, configurationManager.GetMinimumQuantity(tomato)); }
static void Main() { Tomato t = new Tomato("Помидор", 122, 80); GeneralSalad salad = new GeneralSalad("Greek", new List <ISaladItem>()); //GeneralSalad s1 = new GeneralSalad("GGGG", new LinkedList<ISaladItem>()); salad.Items.Add(t); }
public void Test_Tomato() { //arrange var sut = new Tomato(); //act //assert Assert.True(sut.name.Equals("Tomato")); }
public void Post([FromBody] JObject value) { Tomato posted = value.ToObject <Tomato>(); using (TomatoDb db = new TomatoDb()) { db.Tomatos.Add(posted); db.SaveChanges(); } }
public void TestFileBasedMemory() { StorageFactory storageFactory = new StorageFactory(); ConfigurationManager configurationManager = new ConfigurationManager(storageFactory.GetStorage("filebased")); Tomato tomato = new Tomato(); configurationManager.SetMinimumQuantity(tomato, 8); Assert.Equal(configurationManager.GetMinimumQuantity(tomato), 8); }
public void GetMinimumQuantityTest() { var inMemoryStorage = new InMemoryStorage(); var config = new ConfigurationManager(inMemoryStorage); Tomato tomato = new Tomato(); config.SetMinimumQuantity(tomato, 5); Assert.AreEqual(5, config.GetMinimumQuantity(tomato)); }
static void Main(string[] args) { Pizza pizza = new PizzaPepperoni(); Console.WriteLine($"{pizza.name} цена: {pizza.Price()}"); pizza = new Tomato(pizza); Console.WriteLine($"{pizza.name} цена: {pizza.Price()}"); pizza = new Chilli(pizza); Console.WriteLine($"{pizza.name} цена:{pizza.Price()}"); Console.ReadKey(); }
public ActionResult Edit([Bind(Include = "Form_ID,Veg_ID,Form,Average_Retail_Price_Dollars,Price_Unit,Preparation_yield_Factor,Size_Cup_Equivalent,Size_Unit,Average_Price_Per_Cup_Dollars")] Tomato tomato) { if (ModelState.IsValid) { db.Entry(tomato).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Veg_ID = new SelectList(db.Vegetables, "Veg_ID", "Veg_Name", tomato.Veg_ID); return(View(tomato)); }
public void TestToCheckTheQuantityOfTomatoes() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 10); Assert.Equal(10, refrigerator.GetVegetableQuantity(tomato)); }
public void TestInsufficiencyNotification() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); refrigerator.AddVegetable(tomato, 20); refrigerator.SetMinimumQuantity(tomato, 8); refrigerator.TakeOutVegetable(tomato, 15); Assert.Equal("Sent notification to refrigerator", refrigerator.SendNotification()); }
public void Put(int id, [FromBody] JObject value) { Tomato posted = value.ToObject <Tomato>(); posted.Id = id; // Ensure an id is attached using (TomatoDb db = new TomatoDb()) { db.Tomatos.Update(posted); db.SaveChanges(); } }
public IActionResult Create(Tomato tomato) { if (ModelState.IsValid) { _context.Tomatoes.Add(tomato); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(tomato)); }
public void TestWhenQuantityIsSufficient() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); string message = refrigerator.TakeOutVegetable(tomato, 2); Assert.Equal(8, refrigerator.GetVegetableQuantity(tomato)); }
static void Main() { Tomato t = new Tomato("Cherry", 100, 15); Tomato t2 = new Tomato("Tomato", 200, 18 * 2); GeneralSalad salad = new GeneralSalad("Greek", new List <ISaladItem>()); salad.Items.Add(t); salad.Items.Add(t2); Console.WriteLine("Salad " + salad); Console.ReadKey(); }
public Taco(IngredientFactory ingredientFactory) { _poultry = ingredientFactory.GetPoultry(); _meat = ingredientFactory.GetMeat(); _vegetation = ingredientFactory.GetVegetation(); _cheese = ingredientFactory.GetCheese(); _guacomole = ingredientFactory.GetGuacomole(); _rice = ingredientFactory.GetRice(); _beans = ingredientFactory.GetBeans(); _creamCheese = ingredientFactory.GetCreamCheese(); _tomato = ingredientFactory.GetTomato(); _chili = ingredientFactory.GetChili(); }
public void TestWhenQuantityReachesMinimumLimitAndOrderAutomaticallyPlaced() { Refrigerator refrigerator = new Refrigerator(); Tomato tomato = new Tomato(); Cabbage cabbage = new Cabbage(); refrigerator.AddVegetable(tomato, 10); refrigerator.AddVegetable(cabbage, 8); string message = refrigerator.TakeOutVegetable(tomato, 10); Assert.Equal(5, refrigerator.GetVegetableQuantity(tomato)); }
static void Main(string[] args) { var myTomato = new Tomato(VeggieColor.Red); var mySourdough = new Sourdough(MoistureLevel.Moist, TextureType.Fluffy); var myChicken = new Chicken(Meats.MeatTexture.Tender, Meats.MeatCut.Shredded); var myMayo = new Mayo(FlavorType.Creamy, AmountType.Extra); var mySandwich = new Sandwich(mySourdough, myChicken, myTomato, myMayo); mySandwich.OrderSandwich(); Console.ReadLine(); }
private static void DisplayUpcomingMovies() { string apiKey = ConfigurationManager.AppSettings["ApiKey"]; //A Tomato is the main object that will allow you to access RottenTomatoes information. //Be sure to provide it with your API key in String format. var tomato = new Tomato(apiKey); //The movies are automatically ordered according to their gross at the box-office. //Unfortunately the JSON API doesn't offer the gross (money earned) only their relative position //on the charts. var movies = tomato.FindUpcomingMoviesList(); foreach (var movie in movies) { Console.WriteLine(movie.Title); } }
private void InitContents( FruitType type ) { Food item = null; byte count = (byte)Utility.RandomMinMax( 10, 30 ); for( byte i = 0; i < count; i++ ) { switch( type ) { default: case FruitType.Apples: item = new Apple(); break; case FruitType.Bananas: item = new Banana(); break; case FruitType.Bread: item = new BreadLoaf(); break; case FruitType.Gourds: item = new Gourd(); break; case FruitType.Grapes: item = new Grapes(); break; case FruitType.Lemons: item = new Lemon(); break; case FruitType.Tomatoes: item = new Tomato(); break; case FruitType.Vegetables1: case FruitType.Vegetables2: case FruitType.Vegetables3: { switch( Utility.Random( 4 ) ) { case 0: item = new Carrot(); break; case 1: item = new Onion(); break; case 2: item = new Pumpkin(); break; case 3: item = new Gourd(); break; } break; } } if( item != null ) DropItem( item ); } }
private static void FindingMovieByName() { string apiKey = ConfigurationManager.AppSettings["ApiKey"]; //A Tomato is the main object that will allow you to access RottenTomatoes information. //Be sure to provide it with your API key in String format. var tomato = new Tomato(apiKey); var results = tomato.FindMovieByQuery("The Incredible Hulk"); foreach (var movieSearchResult in results) { Console.WriteLine(movieSearchResult.Title); } }
public BifrostCPUWorker(Tomato.DCPU cpu) { CPU = cpu; ExecutionInterval = 1000 / 120; }
private static void FindingMovieByIdNumber() { string apiKey = ConfigurationManager.AppSettings["ApiKey"]; //A Tomato is the main object that will allow you to access RottenTomatoes information. //Be sure to provide it with your API key in String format. var tomato = new Tomato(apiKey); //Finding a movie by it's RottenTomatoes internal ID number. Movie movie = tomato.FindMovieById(9818); //The Movie object, contains all sorts of goodies you might want to know about a movie. Console.WriteLine(movie.Title); Console.WriteLine(movie.Year); }