private CalendarDateRange currentDateRange = null; //Период для вычисления некоторых данных.
		public EditWindow(Object obj)
		{
			currentObject = obj;
			InitializeComponent(); // Конструктор окна в случае редактирования
			deleteButton.IsEnabled = true;
			if(obj is Admin)
			{
				Title = "Редактировать администратора";				
				Admin adm = (Admin)obj;
				SetConfiguration(ObjectType.Admin);
				ClearInfoBlocks();
				infoBlock1.Text = adm.Id.ToString();
				infoBlock2.Text = adm.Name;
				infoBlock3.Text = adm.Login;
				infoBlock5.Text = adm.Pass;
			}
			else if(obj is Group)
			{
				Title = "Редактировать группу";	
				Group gr = (Group)obj;
				SetConfiguration(ObjectType.Group);
				ClearInfoBlocks();
				infoBlock1.Text = gr.Id.ToString();
				infoBlock2.Text = gr.Name;
				infoBlock3.Text = gr.PlanHours.ToString();
				CountDataFields();
				groupColorPicker.SelectedColor = gr.Color.Color;
				
				for(int i = 0; i<gr.TeachersCount; i++)
				{
					infoSmallGrid.Items.Add(MTSystem.findTeacherById(gr.getTeacherId(i)).toSample());
				}
				List<int> studentIds = new List<int>();
				for(int i = 0; i<gr.StudentsCount; i++)
				{
					studentIds.Add(gr.getStudentId(i));
				}
				List<Student> students = MTSystem.LoadStudents(studentIds);
				for(int i = 0; i<studentIds.Count; i++)
				{
					SampleGrid sg = students[i].toSample();
					sg.P5 = (students[i].checkGroupId(gr.Id))?"Ходит":"Выбыл";
					infoBigGrid.Items.Add(sg);
				}
			}
			else if(obj is Student)
			{
				Title = "Редактировать ученика";	
				Student st = (Student)obj;
				SetConfiguration(ObjectType.Student);
				ClearInfoBlocks();
				infoBlock1.Text = st.Id.ToString();
				infoBlock2.Text = st.FullName;
				infoBlock3.Text = st.Age.ToString();
				CountDataFields();
				
				for(int i = 0; i<st.AchievementsCount; i++)
				{
					infoSmallGrid.Items.Add(st.getAchievement(i).toSample());
				}
				
				for(int i = 0; i<st.GroupIdsCount; i++)
				{
					infoBigGrid.Items.Add(MTSystem.findGroupById(st.getGroupId(i)).toSample());
				}
				
			}
			else if(obj is Teacher)
			{
				Title = "Редактировать преподавателя";	
				Teacher tc = (Teacher)obj;
				SetConfiguration(ObjectType.Teacher);
				ClearInfoBlocks();
				infoBlock1.Text = tc.Id.ToString();
				infoBlock2.Text = tc.Name;
				infoBlock3.Text = tc.Login;
				infoBlock5.Text = tc.Pass;
				
				for(int i = 0; i<tc.GroupIdsCount; i++)
				{
					infoBigGrid.Items.Add(MTSystem.findGroupById(tc.getGroupId(i)).toSample());
				}
				
			}
			
		}
		/// <summary>
		/// Метод, инициализирующая комбобоксы окна, если тип объекта этого требует.
		/// </summary>
		/// <param name="ot">Тип объекта окна</param>
		private void InitializeComboBox(ObjectType ot)
		{
			if(ot == ObjectType.Student)
			{
				Student st = (Student)currentObject;
				cbBlock4.Items.Add("Не выбрано");
				cbBlock4.SelectedIndex = 0;
				for(int i = 0; i<MTSystem.StudentStatusesCount; i++)
				{
					cbBlock4.Items.Add(MTSystem.getStudentStatus(i).Name);
					if(st.Status.Id == MTSystem.getStudentStatus(i).Id) cbBlock4.SelectedIndex = i+1;
				}				
				
				for(int i = 0; i<MTSystem.EventTypesCount; i++)
				{
					int isFinded = 0;
					for(int j = 0; j<st.AchievementsCount; j++)
					{
						if(st.getAchievement(j).Type == MTSystem.getEventType(i).Id)
						{
							isFinded = 1;
							break;
						}
					}
					if(isFinded == 0)
					{
						cbSmall.Items.Add(MTSystem.getEventType(i).Name);
					}
				}
				if(cbSmall.Items.Count != 0) cbSmall.SelectedIndex = 0;
			}
			if(ot == ObjectType.Group)
			{
				Group g = (Group)currentObject;
				cbBlock4.Items.Add("Не выбрано");
				cbBlock4.SelectedIndex = 0;
				for(int i = 0; i<MTSystem.GroupTypesCount; i++)
				{
					cbBlock4.Items.Add(MTSystem.getGroupType(i).Name);
					if(g.Type.Id == MTSystem.getGroupType(i).Id) cbBlock4.SelectedIndex = i+1;
				}
				
				cbBlock7.Items.Add("Не выбрано");
				cbBlock7.SelectedIndex = 0;
				for(int i = 0; i<MTSystem.GroupLevelCount; i++)
				{
					cbBlock7.Items.Add(MTSystem.getGroupLevel(i).Name);
					if(g.Level.Id == MTSystem.getGroupLevel(i).Id) cbBlock7.SelectedIndex = i+1;
				}				
				
				int isFinded = 0;
				for(int i = 0; i<MTSystem.TeachersCount; i++)
				{
					for(int j = 0; j<g.TeachersCount; j++)
					{
						if(MTSystem.getTeacher(i).Id == g.getTeacherId(j))
						{
							isFinded = 1;
							break;
						}
					}
					if(isFinded == 0) cbSmall.Items.Add(MTSystem.getTeacher(i).Name);
					isFinded = 0;
				}
				if(cbSmall.Items.Count != 0) cbSmall.SelectedIndex = 0;
			}
		}