private void AddActions() { _acts = new List <Action>(); ChangeView _changeView = new ChangeView(planner); AddAct _addActivity = new AddAct(planner); AddType _addtype = new AddType(planner); _acts.Add(_changeView); _acts.Add(_addtype); _acts.Add(_addActivity); }
public void Load(string filename) { this.Menu = new Menu(this); StreamReader reader = new StreamReader(filename); DateTime date = DateTime.Parse(reader.ReadLine()); int typeNum = reader.ReadInteger(); Color color; string label; for (int i = 0; i < typeNum; i++) { color = Color.FromArgb(reader.ReadInteger()); label = reader.ReadLine(); this.Menu.ActTypes.Add(new ActType(color, label)); } int actNum = reader.ReadInteger(); Activity[] activitys = new Activity[actNum]; for (int i = 0; i < actNum; i++) { AddAct addAct = new AddAct(this); string sDate = reader.ReadLine(); DateTime dDate = DateTime.Parse(sDate); string start = reader.ReadLine(); string end = reader.ReadLine(); string name = reader.ReadLine(); string typeName = reader.ReadLine(); Color typeColor = Color.FromArgb(reader.ReadInteger()); ActType actType = new ActType(typeColor, typeName); activitys[i] = addAct.AddDetailsToActivity(dDate, start, end, name, actType); } this.Days = _viewFactory.LoadDays(date); this.Weeks = _viewFactory.CreateWeeks(_days); this.Months = _viewFactory.CreateMonths(_days); this._actCount = actNum; foreach (Activity activity in activitys) { AddAct addAct = new AddAct(this); DateTime _startindex, _endindex; foreach (Day day in _days) { foreach (Activity act in activitys) { if ((day.Date.ToString("dd-MM-yyyy") == act.Date.ToString("dd-MM-yyyy"))) { addAct.FindIndexes(day, out _startindex, out _endindex, act); foreach (TimeBlock timeblock in day.TimeBlocks) { addAct.AddActToDay(_startindex, _endindex, timeblock, act); } } } } } _view = _weeks.ElementAt(0); reader.Close(); }