예제 #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            GroupManagerViewModel groupManagerViewModel = new GroupManagerViewModel();
            MainWindowViewModel   mainWindowViewModel   = new MainWindowViewModel(groupManagerViewModel);

            MainWindow window = new MainWindow(mainWindowViewModel, groupManagerViewModel);

            window.DataContext = mainWindowViewModel;

            GroupManagerWindow groupManagerWindow = new GroupManagerWindow(groupManagerViewModel);

            groupManagerWindow.DataContext = groupManagerViewModel;
            window.Show();
        }
        private void ManageGroup()
        {
            GroupManagerViewModel gmvm = new GroupManagerViewModel();

            GroupManagerWindow window = new GroupManagerWindow
            {
                DataContext = gmvm
            };
            int agendaId = AgendaRepo.Instance.GetAll().Where(x => x.UserId == SessionManager.CurrentUser.UserId).FirstOrDefault().AgendaId;

            List <Group> listGroup = GroupRepo.Instance.GetAll().Where(x => x.AgendaId == agendaId).ToList();

            List <GroupManagerDataContext> gmdcList = new List <GroupManagerDataContext>();

            listGroup.ForEach(x => gmdcList.Add(new GroupManagerDataContext(GroupRepo.Instance.GetOne(x.GroupID))));

            gmdcList.ForEach(x => x.GMVM = gmvm);

            gmvm.AllGroup = gmdcList;

            gmvm.OnRequestClose += (s, e) => window.Close();

            window.ShowDialog();
        }
 public GroupManager(DataCoordinator dataCoordinator)
 {
     InitializeComponent();
     DataContext = new GroupManagerViewModel(DialogCoordinator.Instance, dataCoordinator);
 }
 public GroupManagerWindow(GroupManagerViewModel _groupManagerViewModel)
 {
     groupManagerViewModel = _groupManagerViewModel;
     DataContext           = _groupManagerViewModel;
     InitializeComponent();
 }
 public MainWindow(MainWindowViewModel _mainWindowViewModel, GroupManagerViewModel _groupManagerViewModel)
 {
     mainWindowViewModel   = _mainWindowViewModel;
     groupManagerViewModel = _groupManagerViewModel;
     InitializeComponent();
 }