Results 1 to 6 of 6

Thread: ICommand for Windows phone 7

  1. #1
    Join Date
    Sep 2010
    Posts
    43

    ICommand for Windows phone 7

    I am using the window 7 smart phone from a long time, which is working good with all its features and now I want to implement the ICommand interface into my windows mobile phone. I tried with the desired setting but fail to find the library of the interface. It flashes the message that it missing the library function of the “CanExecuteChanged”. I was tried to figure out the commands which are used for the stuff, I look for the command which may help me for the issue, for that I looked for the Command manager. i serached everywhere for the solution of the problem by the script or anythinh else but git no result. Is there any solution to execute the “CanExecuteCommand” in the windows mobile 7? I have no such idea on the application which is support by the windows mobile, so is CanExecuteChanged is support by the windows 7 phone, any suggestion will be appreciated.
    Last edited by Alexus; 27-10-2010 at 06:10 PM.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,366

    Re: ICommand for Windows 7 phone

    I had the similar issue with my windows mobile, there is similar issue with the “CanExecuteChanged”. I searched for everything but nothing gives me any result. After that one of my friend suggest me with a script, which works me in my device to run the “CanExecuteChanged”. And now I like to recommend you to go through the script that I mentioned bellow, hope it will also help you to run the command,
    Code:
    public bool CanExecute(object parameter)
            {
                return m_vCanExecute == null ? true : m_vCanExecute(parameter);
            }
    
            public event EventHandler CanExecuteChanged
            {
                add { CommandManager.RequerySuggested += value; }
                remove { CommandManager.RequerySuggested -= value; }
            }
    
            public void Execute(object parameter)
            {
                m_vExecute(parameter);
            }

  3. #3
    Join Date
    Apr 2008
    Posts
    2,277

    Re: ICommand for Windows 7 phone

    I think so the command for the “CanExecuteChanged” will be run by the help of the .NET framework and also along with that one more thing is needed which is the Model View-View Model (MVVM). This application also needs to run the commands in the environment of the Microsoft Silverlight and the WPF. By the following applications you can able to make the data bind and some other control to execute the command of the ICommand application in your windows mobile, it will not view any code in the viewing page, the extension is should be PageX.xaml, though the applications WPF and the SL from the Microsoft need the code interface to run their commands I the page. The MVVM framework is comnes wih some toolkit which are used to run the command in the desired environment.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,465

    Re: ICommand for Windows 7 phone

    I also like to suggest you to install the MVVM application which will help you to execute the command. Mainly it featured to work for the creation of the acceleration of the MVVM application which is to done I the environment of the WPF, SIlverlight and the Windows 7 phone. Te toolkit will help you to separate the model views of the p[age or the application that you want to execute. It also provides the cleaning or the erase facility to remove the unused date for execution of the command that you are trying for. It also creates the testable application (where as test it with the manual method is so much difficult) which allows you to use the simple to access user interface layer. The toolkit is also allo9w to edit or make any modification in the user interface into the Expression Blend, which is includes the design time of the application data, which will enable the blend user to view while they work on the data controls. MVVM is god application which is good with the Silverlight with the unit testing and the test driven developement.

  5. #5
    Join Date
    Jan 2006
    Posts
    2,257

    Re: ICommand for Windows 7 phone

    Recommend you to not set the Data Context, just mad the interface which is attached with the command. I had the similar issue in my windows 7 mobile phone after that one of my fried suggest me to do this operation, it will call the command or the method that you wants to execute in the interface. It will flash the debug message while the construction and the finalization of the interface. Is there any child window appears in the screen, if yes then add the command handler for the execution of the child window. There is the problem for the execution of the command “CanExecuteCommand” , it will not execute till the windows not stop the functionality of its script. The command and the handler are the collection of the garbage. The garbage collection will start to collect the command or the handler, if you are not able to see any of the Data Context in your execution command window. For that you can create a button on the screen to force the garbage collection, band by the force it will force the garbage collection and will execute the “CanExecuteCommand” easily.
    With great power comes great responsibility - Spiderman's Uncle

    The Greatest Sig Ever

  6. #6
    Join Date
    Apr 2008
    Posts
    2,565

    Re: ICommand for Windows 7 phone

    It works as the command manger to execute the command the WPF and the windows 7 phone also it works in the SIlverlight application. The script will stop the garbage collection of the execute command and then can able to run the CanExecuteCommand in any interface. Recommend you to go through the script, it will mijght be help you to execute the command.

    Code:
        Private Class Handler
    
            Private Shared _Count As Integer = 0
            Private _Index As Integer
            Public Sub New()
                MyBase.New()
                _Count += 1
                _Index = _Count
                Debug.Print("{0} {1} Constructed", Me.GetType.Name, _Index)
            End Sub
            Protected Overrides Sub Finalize()
                Debug.Print("{0} {1} Finalized", Me.GetType.Name, _Index)
                MyBase.Finalize()
            End Sub
    
            Public Sub OnRequerySuggested(ByVal sender As Object, ByVal e As EventArgs)
                Debug.Print("RequerySuggested fired")
            End Sub
    
            Public Function CanExecute(ByVal parameter As Object) As Boolean
                Debug.Print("{0}.CanExecute called on instance {1}.", Me.GetType.Name, _Index)
                Return True
            End Function
    
            Public Sub Execute(ByVal parameter As Object)
                Debug.Print("{0}.Execute called on instance {1}.", Me.GetType.Name, _Index)
            End Sub
        End Class
    
        Private Sub AddCommand_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
            Dim handler As Handler = New Handler
            Dim command As RelayCommand = New RelayCommand(AddressOf handler.Execute, AddressOf handler.CanExecute)
            CommandButton.Command = command
        End Sub

Similar Threads

  1. Replies: 5
    Last Post: 03-08-2013, 11:08 AM
  2. Windows Phone 8 screen stops working during phone call
    By MEKHALA in forum Portable Devices
    Replies: 1
    Last Post: 01-08-2013, 01:21 PM
  3. Replies: 4
    Last Post: 15-04-2012, 05:33 PM
  4. Replies: 4
    Last Post: 08-02-2012, 04:22 PM
  5. Replies: 4
    Last Post: 01-02-2012, 06:37 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,251,222.73575 seconds with 17 queries