private void isBuildChart(int i, float a, float b, WashingTime x, WashingTime y) { float xy = (x - y); y1 = Math.Min(a, ((float)x - i) / xy); y2 = Math.Min(b, (i - (float)y) / xy); washing_Y[i] = Math.Max(y1, y2); }
public void SetWashingTime(string op) { if (op == "0" || op == "1" || op == "2" || op == "3") { _washingTime = (WashingTime)int.Parse(op); } _menuType = MenuType.MAIN; hasChange = true; }
public WashingMachine() { Console.Out.WriteLine("Starting washing machine..."); _temperature = Temperature.C30_50; _washingMethod = WashingMethod.NORMAL; _washingTime = WashingTime.T30; _menuType = MenuType.MAIN; remainTime = -1; timeThread = new Thread(Washing); writeThread = new Thread(PrintMenu); readThread = new Thread(GetOption); hasChange = false; isStart = false; isPause = true; }
public string RecalculateTime(string timeType) { var hours = WashingTime.Split(':')[0]; var minutes = WashingTime.Split(':')[1]; var time = int.Parse(hours) * 60; if (!string.IsNullOrEmpty(minutes)) { time += int.Parse(minutes); } if (timeType == "krotkie" || timeType == "krótkie") { time = time * 4 / 10; } else if (timeType == "dlugie" || timeType == "długie") { time = time * 13 / 10; } TimeSpan span = TimeSpan.FromMinutes(time); return(span.ToString(@"h\:mm")); }