Click here to Skip to main content
       

C#

 
GeneralRe: single log file for two classes. Pinmembervanikanc15-Jan-13 2:24 
GeneralRe: single log file for two classes. PinmemberPIEBALDconsult15-Jan-13 3:08 
QuestionBinary File Library Pinmemberdxtrx11-Jan-13 10:24 
AnswerRe: Binary File Library PinmemberGarth J Lancaster11-Jan-13 11:18 
GeneralRe: Binary File Library Pinmemberdxtrx11-Jan-13 11:41 
GeneralRe: Binary File Library PinmemberGarth J Lancaster11-Jan-13 12:43 
GeneralRe: Binary File Library Pinmemberdxtrx11-Jan-13 12:47 
QuestionLatency In Button Click When Using MVVM PinmemberTee12311-Jan-13 7:25 
Hello fellow coders, I was wondering if anyone ever experienced any latency in the button click when using the MVVM approach? I have 4 buttons and it seems when I click on either one initially there's a 3 second latency before the text changes and the other buttons become disabled. After that initial click it runs quicker. No matter which button it is on that first click it takes 3 seconds to respond then after that each button responds immediately. So here is what I'm doing.
1. I'm using the RelayCommand that was located in Josh Smith's article.
 
2. I have the following setup in my xaml behind my buttons. Each button has a different CommandParameter.
<Button x:Name="btnAddSaveUpdate" Content="{Binding AddSaveUpdateContent}"  Style="{StaticResource ButtonStyle}" Command="{Binding AddSaveUpdateCmd}" CommandParameter="AddSaveButton"  />
 
3. In the creation of my mobileViewModel I have the following code in the constructor. I assign the AddSaveUpdateContent property to update the text. Note, that this property has an OnPropertyChanged call inside.
 _addSaveUpdateCmd = new RelayCommand(param => OnExecute(param), this.CanExecute);
AddSaveUpdateContent = "Add";
 
4. Inside the CanExecute is a case statement that gets the CommandParameter:
case "AddSaveButton":
                    return true;
 
5. Inside the OnExecute is another case statement that gets the CommandParameter as well then calls another method:
  case "AddSaveButton":
                    PerformButtonTask(AddSaveUpdateContent);
                    break;
 
6. Then in my PerformButtonTask method all I'm doing is is running through one more case statment to perform the appropriate task. The EnableFields and ClearFields are events that call a method in the code behind on the xaml page.
               case "Add":
                    AddSaveUpdateContent = "Save";
                    ExitCancelCmdContent = "Cancel";
                    ClearFields();
                    EnableFieldsEvent(true);
                    break;

 
That's pretty much it. So, if anyone has any ideas please share. Thanks.
Update: Just to let you know. The problem is occurring in Visual Studio 2012 in debug mode; however, when I create my executable the response is immediately as expected. So, is because of the development environment?
Tee123

AnswerRe: Latency In Button Click When Using MVVM PinmemberSledgeHammer0111-Jan-13 9:38 
GeneralRe: Latency In Button Click When Using MVVM PinmemberTee12311-Jan-13 10:14 
QuestionC# computer name rename PinmemberEvetsMostel11-Jan-13 7:00 
AnswerRe: C# computer name rename Pinmemberjibesh11-Jan-13 7:47 
GeneralRe: C# computer name rename [modified] PinmemberEvetsMostel11-Jan-13 7:54 
GeneralRe: C# computer name rename PinmemberEvetsMostel11-Jan-13 11:30 
GeneralRe: C# computer name rename PinmemberEvetsMostel14-Jan-13 13:15 
QuestionFTP Decryption Error PinmemberMember 865395910-Jan-13 18:22 
AnswerRe: FTP Decryption Error PinmemberBernhard Hiller10-Jan-13 21:46 
GeneralRe: FTP Decryption Error PinmemberGarth J Lancaster11-Jan-13 11:00 
AnswerRe: FTP Decryption Error PinmvpEddy Vluggen11-Jan-13 2:28 
GeneralRe: FTP Decryption Error PinmemberGarth J Lancaster11-Jan-13 11:00 
Questionhow to export a div to pdf Pinmembershineskollam10-Jan-13 18:17 
AnswerRe: how to export a div to pdf PinmvpRichard MacCutchan10-Jan-13 21:51 
QuestionRegarding implementation of Dependency Injection with C# PinmemberTridip Bhattacharjee10-Jan-13 2:06 
AnswerRe: Regarding implementation of Dependency Injection with C# PinprotectorPete O'Hanlon10-Jan-13 2:22 
AnswerRe: Regarding implementation of Dependency Injection with C# Pinmemberjschell10-Jan-13 14:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.140926.1 | Last Updated 1 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid