Ejemplo n.º 1
0
        private void setupTodayTable()
        {
            //this.Height = 700;
            TimeSpan td = Config.EndTime - Config.StartTime;

            this.Height = 105 + 22 * Convert.ToInt32(td.TotalMinutes / 30);
            AppLog.WriteEvent("Height: " + this.Height.ToString());

            TimeTable dt = Config.TodayTime;

            timeTable.RowTemplate.DefaultCellStyle.BackColor = Config.TableBackgroundColor;
            timeTable.DataSource = dt;
            timeTable.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
            timeTable.Columns.Clear();
            timeTable.Columns.Add("Time", "Time");
            DataGridViewColumn col = timeTable.Columns[0];

            col.DataPropertyName = "Time";
            col.ReadOnly         = true;
            col.Frozen           = true;
            col.Width            = 55;

            timeTable.Columns.Add("Task", "Task");
            DataGridViewColumn task = timeTable.Columns[1];

            task.DataPropertyName = "Task";
            task.Width            = 270;
            //timeTable.SelectionMode = DataGridViewSelectionMode.CellSelect;
            TimeRow crow = Config.TodayTime.FindRowForTime(DateTime.Now);

            if (crow != null && crow.Id > 0)
            {
                timeTable.Rows[crow.Id - 1].Cells[0].Selected = true;
            }
        }
Ejemplo n.º 2
0
        private void showScreen()
        {
            DateTime tm = DateTime.Now;
            TimeSpan dif;
            int      min = tm.Minute;
            DateTime fix = new DateTime(tm.Year, tm.Month, tm.Day, tm.Hour, 30, 0);

            if (min >= 30)
            {
                fix = fix.AddMinutes(30);
                dif = fix.Subtract(tm);
                timeProgress.Position = min - 30;
            }
            else
            {
                dif = fix.Subtract(tm);
                timeProgress.Position = min;
            }
            Text = " TIME " + tm.ToShortTimeString();
            timeProgress.Text = string.Format("{0} min", dif.Minutes + 1);
            rowNow            = Config.TodayTime.FindRowForTime(tm);
            ltask1.Visible    = (rowNow != null) && !string.IsNullOrEmpty(rowNow.Task);
            ltask2.Visible    = (rowNext != null) && !string.IsNullOrEmpty(rowNext.Task);
            int remains = Config.TodayTime.GetBackCount(tm);

            TextLabel.Text = string.Format("{0}                               {1}", remains, remains - 1);
            ltask1.Text    = (rowNow != null) ? rowNow.Task : "";

            rowNext            = Config.TodayTime.FindRowForTime(tm.AddMinutes(30));
            ltask2.Text        = (rowNext != null) ? rowNext.Task : "";
            this.ActiveControl = timeProgress;
            Application.DoEvents();
        }
Ejemplo n.º 3
0
        public void LoadFromFile(string fileName)
        {
            AppLog.WriteEvent("Loading from " + fileName);
            XmlDocument doc = new XmlDocument();

            doc.Load(fileName);
            XmlElement schedule = doc.DocumentElement;

            foreach (XmlElement sec in schedule.ChildNodes)
            {
                DateTime time = DateTime.Parse(sec.GetAttribute("Time"));
                TimeRow  row  = GetRowByTime(time);
                if (row != null)
                {
                    row.Task = sec.InnerText;
                }
            }
        }