viewmodel

Is it OK to subscribe to the ViewModel's .NET events from the View in MVVM?

可紊 提交于 2020-01-05 23:18:20
问题 I am writing this major memory trainer using the MVVM pattern by animating labels containing 2 digit numbers across the screen and asking the user to quickly type in the corresponding mnemonic for each number. It is entirely up to the View how the animation is done so there will be some code behind for this. When the correct mnemonic is typed into the UI or when the number disappears off the screen Commands will be executed from the View to relay that this has happened. In the ViewModel I

Entity Framework POCO to ViewModel in MVC 3

自作多情 提交于 2020-01-05 16:38:07
问题 I have an example project, a dynamic questionnaire system where any administrator can create a questionnaire, then add groups of questions to it and in-turn add questions to each question group. Take the following group of POCOs that make up the entities for my EF data context: public class Questionnaire { public virtual int Id { get; set; } public virtual string QuestionnaireName { get; set; } public virtual IList<QuestionGroup> QuestionGroups { get; set; } } public class QuestionGroup {

Entity Framework POCO to ViewModel in MVC 3

限于喜欢 提交于 2020-01-05 16:37:43
问题 I have an example project, a dynamic questionnaire system where any administrator can create a questionnaire, then add groups of questions to it and in-turn add questions to each question group. Take the following group of POCOs that make up the entities for my EF data context: public class Questionnaire { public virtual int Id { get; set; } public virtual string QuestionnaireName { get; set; } public virtual IList<QuestionGroup> QuestionGroups { get; set; } } public class QuestionGroup {

How can I communicate between a windows forms application and a WebBrowser control

北慕城南 提交于 2020-01-05 12:29:32
问题 Is there any mechanism that I can push data into a webbrowser control from the containing windows forms application. Specifically the webbrowser control contains some knockout.js and I want to allow some external events such as changes to certain files in the local filesystem to update the knockout viewModel. At the moment I have this working after a fashion with the JS in the webbrowser control issuing a longpolling jsonp requests to a micro webserver I have written running in the windows

Merge ViewModel

巧了我就是萌 提交于 2020-01-05 09:07:37
问题 Im starting MVC & would like your advice about Repositories & View models, specifically combining a few sets of repository data into one VM. If I have a web page with three distinct sections (columns) that require their own repositories (sorry for the basic nature of this): UserInfoData - shown in Left col DiaryData - shown in Middle col CommentData - Shown in Right col Im doing the following :- public ActionResult Index(int id) { UserInfoData uid = repository.GetUserInfoData(id);

Merge ViewModel

落花浮王杯 提交于 2020-01-05 09:07:30
问题 Im starting MVC & would like your advice about Repositories & View models, specifically combining a few sets of repository data into one VM. If I have a web page with three distinct sections (columns) that require their own repositories (sorry for the basic nature of this): UserInfoData - shown in Left col DiaryData - shown in Middle col CommentData - Shown in Right col Im doing the following :- public ActionResult Index(int id) { UserInfoData uid = repository.GetUserInfoData(id);

Communication between 6 ViewModels and a Messenger == AntiPattern?

最后都变了- 提交于 2020-01-05 08:54:51
问题 A common approach for communication between 2 ViewModels is this: MVVM- View Model-View Model Communications The Mediator pattern or a Messenger class. But what about 6 ViewModels in one Window? NewSchoolclassUserControl NewPupilUserControl SchoolclassListUserControl PupilListUserControl PupilsDetailUserControl AdministrationButtonBarUserControl (having buttons executing commands) All this is in ONE Window. Do "you" really tell me now I have to setup a Messenger for those 6 Views and their

Most effective method of protecting an entity ID when posting back from a view

我的梦境 提交于 2020-01-05 08:13:01
问题 EDIT - Just a quick edit, to start this off with a clear question! What I'm essentially asking is, what is the most effective way of protecting my entity identifiers when posting back from a view? I've been thinking about ways to protect the ID on a POST when editing a view model. Let's take an example entity public class Post { public int Id { get; set; } public string Title { get; set; } public string Content { get; set; } } And its corresponding view model: public class PostViewModel {

Most effective method of protecting an entity ID when posting back from a view

余生长醉 提交于 2020-01-05 08:12:11
问题 EDIT - Just a quick edit, to start this off with a clear question! What I'm essentially asking is, what is the most effective way of protecting my entity identifiers when posting back from a view? I've been thinking about ways to protect the ID on a POST when editing a view model. Let's take an example entity public class Post { public int Id { get; set; } public string Title { get; set; } public string Content { get; set; } } And its corresponding view model: public class PostViewModel {

In ASP.NET MVC3 how do you stay DRY with very similar but slightly different viewmodels?

强颜欢笑 提交于 2020-01-05 07:55:13
问题 In building an app, we created a generic object model to store some values, the viewmodel looks a bit like this at the moment: public class FooViewModel { public int ID { get; set; } public byte FooType { get; set; } [Required] [Display(Name = "Bar Name")] public string Name { get; set; } [Required] public string Email { get; set; } //etc, etc } The problem is: depending on the FooType, we want to have the Display Name to be different and the Email is not required for type 1 and 2, but is