コード例 #1
0
ファイル: IndexVM.cs プロジェクト: Trismegista/Indeks
        public IndexVM(LoginVM loginVm)
        {
            _loginVm = loginVm;
            ExecuteOpenKierunekCommand  = new Commanding(AddKierunekCommand, CanAddKierunekCommand);
            ExecuteOpenSemestrCommand   = new Commanding(AddSemesterCommand, CanAddSemesterCommand);
            ExecuteOpenPrzedmiotCommand = new Commanding(AddPrzedmiotCommand, CanAddPrzedmiotCommand);
            ExecuteEditStudentCommand   = new Commanding(EditProfile, CanEditProfile);
            ExecuteEditPhotoCommand     = new Commanding(EditPhotoCommand, CanEditPhotoCommand);

            NumeryIndeksow = Student.CurentUserIndexList(_loginVm.CurrentUserId);
            Logins         = Login.GetLogins(_loginVm.CurrentUserId);
            PhotoSource    = Zdjecie.GetZdjecieSource(_loginVm.CurrentUserId);
        }
コード例 #2
0
ファイル: IndexVM.cs プロジェクト: Trismegista/Indeks
        private void EditPhotoCommand(object parameter)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.ShowDialog();
            string  fileName = dialog.FileName;
            string  name     = Path.GetFileNameWithoutExtension(fileName);
            Zdjecie newPhoto = new Zdjecie();

            newPhoto = Zdjecie.CopyPhotoToImages(fileName);

            DataClasses1DataContext context = new DataClasses1DataContext();
            Login log = context.Logins.Single(x => x.Id_Login == _loginVm.CurrentUserId);

            log.Id_Zdjecie = newPhoto.Id_Zdjecia;
            context.SubmitChanges();

            PhotoSource = Zdjecie.GetZdjecieSource(_loginVm.CurrentUserId);
        }