private void SetPosition() { VisibilityList.Clear(); for (int i = 0; i < deptList.Count; i++) { var menu = new OrganizationChartModel(); menu.ShowVisibility = Convert.ToBoolean(deptList[i].Visibility); VisibilityList.Add(menu); } }
public OrganizationChartViewModel() { //_ea = ea; deptList = OrganizationChartModel.XmlParser(); var dept = new string[] { "주민", "지적", "인감" }; var deptIndex = 0; for (int i = 0; i < deptList.Count; i++) { var user = new NameCard(); user.Name = deptList[i].Name; user.Team = deptList[i].Team; user.Work = deptList[i].Work; user.Tel = deptList[i].Tel; user.ImagePath = System.IO.Path.GetFullPath($"D:\\images\\{i}.jpg"); user.DeptIndex = i; user.Dept = deptList[i].Dept; user.OnClick += User_OnClick; UserList.Add(user); } SelectCommand = new DelegateCommand <string>(x => { //_ea.GetEvent<VideoTimerResetEvent>().Publish(Message); var n = int.Parse(x); foreach (var item in UserList) { item.IsSelected = item.DeptIndex == n; } }); PopupCloseCommand = new DelegateCommand(() => { //_ea.GetEvent<VideoTimerResetEvent>().Publish(Message); ShowPopup = Visibility.Collapsed; SelectedItem = null; }); SetPosition(); }