Example #1
0
        public TimeOption()
        {
            InitializeComponent();

            //ShareData.TimeNumを見て、-1かそうでないかを判断
            if (ShareData.timeNum != -1)
            {
                timeClass             = UserData.scheduleClasses[ShareData.num].getTime(ShareData.timeNum);
                dateTimePicker1.Value = timeClass.getBeginTime();
                dateTimePicker2.Value = timeClass.getEndTime();
            }
            else
            {
                dateTimePicker2.Value = DateTime.Parse("23:59");
            }


            //部屋を追加処理
            for (int i = 0; i < ShareData.rooms.Count; i++)
            {
                listView2.Items.Add(ShareData.rooms[i].getRoomName());
            }
            for (int i = 0; i < listView2.Items.Count; i++)
            {
                Console.WriteLine(ShareData.rooms[i].getRoomName());
                if (timeClass.getRoomName() == ShareData.rooms[i].getRoomName())
                {
                    listView2.Items[i].Selected = true;
                }
            }

            //時間割を追加処理
            for (int i = 0; i < ShareData.timeTables.Count; i++)
            {
                listView1.Items.Add(ShareData.timeTables[i].getName());
            }
            if (timeClass.getType() == 0)
            {
                radioButton1.Checked = true;
                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    if (timeClass.getTimeTable() == ShareData.timeTables[i].getName())
                    {
                        listView1.Items[i].Selected = true;
                    }
                }
            }
            else
            {
                radioButton2.Checked = true;
            }


            bool[] day = timeClass.getDay();
            checkBox1.Checked = day[0];
            checkBox2.Checked = day[1];
            checkBox3.Checked = day[2];
            checkBox4.Checked = day[3];
            checkBox5.Checked = day[4];
            checkBox6.Checked = day[5];
            checkBox7.Checked = day[6];
        }