コード例 #1
0
        public static void InsertInArray(string title, string[][] WeathersInYears)
        {
            UI.BuildTitle(title);

            DateTime dt        = BussinesLogic.SetDate();
            string   gradation = BussinesLogic.SetWeather();

            Array.Resize(ref WeathersInYears[0], WeathersInYears[0].GetLength(0) + 1);
            WeathersInYears[0][WeathersInYears[0].GetLength(0) - 1] = dt.Year.ToString();

            Array.Resize(ref WeathersInYears[1], WeathersInYears[1].Length + 1);
            WeathersInYears[1][WeathersInYears[0].Length - 1] = dt.Month.ToString();

            Array.Resize(ref WeathersInYears[2], WeathersInYears[2].Length + 1);
            WeathersInYears[2][WeathersInYears[0].Length - 1] = dt.Day.ToString();

            Array.Resize(ref WeathersInYears[3], WeathersInYears[3].Length + 1);
            WeathersInYears[3][WeathersInYears[0].Length - 1] = gradation;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: ltvch/WeatherAgregator
        private static void Main(string[] args)
        {
            string title = "Insert Year, Month, Day and Weather on 5 balls range.";

            string[][]     WeathersInYears = BussinesLogic.ImplementArrays();
            ConsoleKeyInfo input;
            int            count = 0;

            Console.WriteLine("\n\tEnter the data until you press Esc\n");

            //todo
            // add update and delete values like "rows" in arrays
            do
            {
                BussinesLogic.InsertInArray(title, WeathersInYears);
                input = Console.ReadKey();
                count++;
            } while (input.Key != ConsoleKey.Escape);

            UI.ShowArray(WeathersInYears, count);

            Console.WriteLine("\nPress any key to continue..");
            Console.ReadKey();
        }