示例#1
0
        private week Load_Up(string file_address)
        {
            play.week events = State_Saver.Open_Tasks(file_address);
            foreach (var task in events.MondayEvents)
            {
                TextBlock printText = new TextBlock();
                printText.Text = task;
                M.Children.Add(printText);
            }

            foreach (var task in events.TuesdayEvents)
            {
                TextBlock printText = new TextBlock();
                printText.Text = task;
                T.Children.Add(printText);
            }

            foreach (var task in events.WednesdayEvents)
            {
                TextBlock printText = new TextBlock();
                printText.Text = task;
                W.Children.Add(printText);
            }

            foreach (var task in events.ThursdayEvents)
            {
                TextBlock printText = new TextBlock();
                printText.Text = task;
                R.Children.Add(printText);
            }

            foreach (var task in events.FridayEvents)
            {
                TextBlock printText = new TextBlock();
                printText.Text = task;
                F.Children.Add(printText);
            }

            foreach (var task in events.SaturdayEvents)
            {
                TextBlock printText = new TextBlock();
                printText.Text = task;
                Sa.Children.Add(printText);
            }

            foreach (var task in events.SundayEvents)
            {
                TextBlock printText = new TextBlock();
                printText.Text = task;
                Su.Children.Add(printText);
            }

            return(events);
        }
示例#2
0
        public static week Open_Tasks(string log_file)
        {
            StreamReader read = File.OpenText(log_file);
            string       line = read.ReadLine();

            string[] contents = line.Split(",");
            week     output   = new week();
            int      day      = -1;

            foreach (var word in contents)
            {
                switch (word)
                {
                case "Monday":
                    day = 0;
                    break;

                case "Tuesday":
                    day = 1;
                    break;

                case "Wednesday":
                    day = 2;
                    break;

                case "Thursday":
                    day = 3;
                    break;

                case "Friday":
                    day = 4;
                    break;

                case "Saturday":
                    day = 5;
                    break;

                case "Sunday":
                    day = 6;
                    break;

                default:
                    if (day != -1)
                    {
                        output.Add_Task(word, day);
                    }
                    break;
                }
            }

            return(output);
        }
示例#3
0
        public static void  Save_Tasks(string log_file, week tasks)
        {
            StreamWriter sw = File.CreateText(log_file);

            sw.Write("Monday,");
            foreach (string task in tasks.MondayEvents)
            {
                sw.Write(task); sw.Write(",");
            }
            sw.Write("Tuesday,");
            foreach (string task in tasks.TuesdayEvents)
            {
                sw.Write(task); sw.Write(",");
            }
            sw.Write("Wednesday,");
            foreach (string task in tasks.WednesdayEvents)
            {
                sw.Write(task); sw.Write(",");
            }
            sw.Write("Thursday,");
            foreach (string task in tasks.ThursdayEvents)
            {
                sw.Write(task); sw.Write(",");
            }
            sw.Write("Friday,");
            foreach (string task in tasks.FridayEvents)
            {
                sw.Write(task); sw.Write(",");
            }
            sw.Write("Saturday,");
            foreach (string task in tasks.SaturdayEvents)
            {
                sw.Write(task); sw.Write(",");
            }
            sw.Write("Sunday,");
            foreach (string task in tasks.SundayEvents)
            {
                sw.Write(task); sw.Write(",");
            }
            sw.Close();
        }