public TimeTable_SetTimeWindow(int id_in, LectTime lecttime_in)
        {
            InitializeComponent();

            _viewmodel       = new SetTimeViewModel();
            this.DataContext = _viewmodel;

            id       = id_in;
            lecttime = lecttime_in;

            SetData();
        }
Ejemplo n.º 2
0
        void GetData()
        {
            var data = MainWindow.data;

            count    = data.setting.period;
            lectid   = data.lectid;
            lectures = data.lectures;
            lecttime = data.lecttime;


            int lec_c = lecttime.Count();

            if (lec_c != count)
            {
                if (lec_c > count)
                {
                    var lecttime_tmp = new List <LectTime>();
                    for (int i = 0; i < count; i++)
                    {
                        lecttime_tmp.Add(lecttime[i]);
                    }
                    lecttime = lecttime_tmp;
                }
                else
                {
                    for (int i = 0; i < count - lec_c; i++)
                    {
                        var t = new LectTime();
                        t.starthour   = 0;
                        t.startminute = 0;
                        t.endhour     = 0;
                        t.endminute   = 0;
                        lecttime.Add(t);
                    }
                }
            }

            if (lectid.Count() != 6)
            {
                var lectid_c = lectid.Count();
                // データ型エラー時 月-土分の不足を追加
                for (int i = 0; i < 6 - lectid_c; i++)
                {
                    var t = new List <int>();
                    t.Add(0);
                    lectid.Add(t);
                }
            }


            for (int i = 0; i < 6; i++)
            {
                var c = lectid[i].Count();
                // 講義数に揃える
                if (c != count)
                {
                    if (c > count)
                    {
                        var item_tmp = new List <int>();
                        for (int j = 0; j < count; j++)
                        {
                            item_tmp.Add(lectid[i][j]);
                        }
                        lectid[i] = item_tmp;
                    }
                    else
                    {
                        for (int j = 0; j < count - c; j++)
                        {
                            lectid[i].Add(0);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        string ConnectTimeText(int time, LectTime lecttime)
        {
            String res = String.Format("{0}\n{1}:{2:00}~{3}:{4:00}", time + 1, lecttime.starthour, lecttime.startminute, lecttime.endhour, lecttime.endminute);

            return(res);
        }