viewmodel

Mocking a dialog box that takes a callback type as argument

帅比萌擦擦* 提交于 2019-12-11 09:18:57
问题 I have created the mock setup for the dialog box of type: void ShowDialog(string windowName, string parentWindowName, Dictionary<string, object> inputFields, Action<Dictionary<string, object>> closeCallBack, Dictionary<string, object> windowProperties = null); like: UIServicemock.Setup(u => u.ShowDialog(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<Dictionary<string, object>>(), It.IsAny<Action<Dictionary<string, object>>>(), It.IsAny<Dictionary<string, object>>())).Callback(ViewName

Execute Method from Codehind using ViewModel WPF

主宰稳场 提交于 2019-12-11 08:23:21
问题 I've abandoned the MVVM midway through app development just to get this app out. I've written a method in the code behind to update the database/datagrid etc. My application navigation is using Commands to the ViewModel firing some event but never touches the code-behind except one time to initialize the class. So basically I push the button one time and it works with the default initial setting but I can't call my code-behind Update() method anymore once the view as been intialized. How can

Nested ViewModel Classes in asp.net MVC

百般思念 提交于 2019-12-11 08:14:36
问题 I have four MVC model layer domain classes. namespace MvcMobile.Models.BusinessObject { public class Speaker { public int SpeakerID { get; set; } public string SpeakerName { get; set; } } public class Tag { public int TagID { get; set; } public string TagName { get; set; } } public class Seminar { public string Seminar_Code { get; set; } public string Title { get; set; } public string Description { get; set; } public string Room { get; set; } } public class Seminar_Detail { public string

Accessing viewModel properties

ぐ巨炮叔叔 提交于 2019-12-11 07:39:44
问题 I have a template binding as follows <tbody id ="mytemplatetbody" data-bind="template: {name: 'myTemplate', foreach: Items}"> </tbody> The rows in template have a status field whose value can be 1 or 2 or 3. There are three checkboxes on this screen and depending on what checkbox(es) user selects, the rows should be visible. This is what I have done: Added three observable properties to viewModel and tied them to the three checkboxes. I can display those values as follows: <span data-bind=

MVVM, do I have to keep each command in own class?

断了今生、忘了曾经 提交于 2019-12-11 07:27:49
问题 I am trying to get used to MVVM and WPF for a month. I am trying to do some basic stuff, but I am constantly running into problems. I feel like I solved most of them by searching online. But now there comes the problem with Commands. Q: I saw that they are using RelayCommand, DelegateCommand or SimpleCommand. Like this: public ICommand DeleteCommand => new SimpleCommand(DeleteProject); Even though I create everything like they did, I am still having the part => new SimpleCommand(DeleteProject

ViewModel Empty list and null object on post

☆樱花仙子☆ 提交于 2019-12-11 07:21:18
问题 I'm trying my first adventure using viewmodels, but I got a problem, this is my view model and the models: ViewModel: public class ProfessionalDashboard { public List<JobOffertModel> AcceptedJobOfferts { get; set; } public List<JobOffertModel> NotAcceptedJobOfferts { get; set; } public ProfessionalModel Professional { get; set; } } Models: public class JobOffertModel { [Key] public int Id { get; set; } public ProfessionalModel Professional { get; set; } [Required] public string Description {

How to hook ActiveX control into events/changes into my viewmodel?

↘锁芯ラ 提交于 2019-12-11 07:06:10
问题 I've added WindowsMediaPlayer ActiveX to my WPF/MVVM application. Now I need the control to react to changes happening in the viewmodel (most importantly updating URL when the current selection in my collection changes). Based on Walkthrough: Hosting an ActiveX Control in WPF I have the following in my Loaded event: // Create the interop host control. System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost(); // Create the ActiveX control

AutoMapper mapping int[] or List<int> from ViewModel to a List<Type> in Domain Model

浪子不回头ぞ 提交于 2019-12-11 06:18:40
问题 I'm new to AutoMapper and I've been reading and reading questions around here but I'm not quite able to figure out what looks like a very trivial question. First my classes, then the question(s): GatewayModel.cs public class Gateway { public int GatewayID { get; set; } public List<Category> Categories { get; set; } public ContentType ContentType { get; set; } // ... } public class Category { public int ID { get; set; } public int Name { get; set; } public Category() { } public Category( int

Deserialising JSON into nested view model in controller

爱⌒轻易说出口 提交于 2019-12-11 05:15:22
问题 I have a nested view model structure: public class PersonViewModel { public int Height { get; set; } public List<LegViewModel> Legs {get;set;} } public class LegViewModel { public int Length { get; set; } } I send some JSON to this using jquery post: <script> $(function () { $("#mybutton").click(function () { $.ajax({ type: "POST", data: { Height: 23, Legs: [ { Length: 45, } ] } }); }); }); </script> <button id="mybutton">hello world!</button> I'm posting to this controller action: [HttpPost]

LINQ left join only works in the ActionResult

谁说胖子不能爱 提交于 2019-12-11 05:14:28
问题 I'm trying to get up to speed with MVC, linq, razor, etc. Some things are working and others I just hit dead ends that really discourage me. This is the first one I haven't been able to work out. I've researched every lead I can before asking this question here and it's my first, so please go easy. I'm sure the answer is right in front of my face, but I just can't see it. I could type 14 pages of things I've tried, but I'm trying to keep this concise and to the point. I've completely mangled