क्या रिलेकॉमैंड का एक संस्करण है, क्योंकि Win8 मेट्रो ऐप्स में कमांडमैनेजर उपलब्ध नहीं है?विंडोज 8 विंडोज स्टोर ऐप में रिले कमांड
7
A
उत्तर
4
एक संस्करण here है।
using System;
using System.Diagnostics;
#if METRO
using Windows.UI.Xaml.Input;
using System.Windows.Input;
#else
using System.Windows.Input;
#endif
namespace MyToolkit.MVVM
{
#if METRO
public class RelayCommand : NotifyPropertyChanged, ICommand
#else
public class RelayCommand : NotifyPropertyChanged<RelayCommand>, ICommand
#endif
{
private readonly Action execute;
private readonly Func<bool> canExecute;
public RelayCommand(Action execute)
: this(execute, null) { }
public RelayCommand(Action execute, Func<bool> canExecute)
{
if (execute == null)
throw new ArgumentNullException("execute");
this.execute = execute;
this.canExecute = canExecute;
}
bool ICommand.CanExecute(object parameter)
{
return CanExecute;
}
public void Execute(object parameter)
{
execute();
}
public bool CanExecute
{
get { return canExecute == null || canExecute(); }
}
public void RaiseCanExecuteChanged()
{
RaisePropertyChanged("CanExecute");
if (CanExecuteChanged != null)
CanExecuteChanged(this, new EventArgs());
}
public event EventHandler CanExecuteChanged;
}
public class RelayCommand<T> : ICommand
{
private readonly Action<T> execute;
private readonly Predicate<T> canExecute;
public RelayCommand(Action<T> execute)
: this(execute, null)
{
}
public RelayCommand(Action<T> execute, Predicate<T> canExecute)
{
if (execute == null)
throw new ArgumentNullException("execute");
this.execute = execute;
this.canExecute = canExecute;
}
[DebuggerStepThrough]
public bool CanExecute(object parameter)
{
return canExecute == null || canExecute((T)parameter);
}
public void Execute(object parameter)
{
execute((T)parameter);
}
public void RaiseCanExecuteChanged()
{
if (CanExecuteChanged != null)
CanExecuteChanged(this, new EventArgs());
}
public event EventHandler CanExecuteChanged;
}
}
1
कोई कार्यान्वयन अगर ICommand मेट्रो में प्रदान की, हालाँकि CodeProject पर इस एक के रूप में उपलब्ध कई संस्करण, कर रहे हैं।
0
विंडोज स्टोर ऐप्स के लिए प्रिज्म अब उपलब्ध है, जिसमें प्रतिनिधिमंडल (जो आईसीओएमएंड लागू करता है), साथ ही ऑनप्रॉपर्टी चेंग्ड का कार्यान्वयन भी शामिल है।
संबंधित मुद्दे
- 1. विंडोज 8 मेट्रो ऐप
- 2. विंडोज 8 मेट्रो ऐप
- 3. विंडोज 8 सी # ऐप
- 4. विंडोज यूटीएफ -8 विंडोज कमांड लाइन एन्कोडिंग
- 5. विंडोज 8 मेट्रो ऐप
- 6. विंडोज 8 मेट्रो ऐप
- 7. विंडोज 8 ऐप
- 8. विंडोज 8 ऐप
- 9. विंडोज स्टोर ऐप (मेट्रो)
- 10. मैं विंडोज 8 स्टोर ऐप में आईएमएपी कैसे एक्सेस करूं?
- 11. विंडोज 8 स्टोर ऐप में एमवीवीएम मृत है?
- 12. विंडोज 8 स्टोर ऐप की सेटिंग बार में बटन शैली
- 13. विंडोज 8
- 14. विंडोज स्टोर ऐप यूआई अपडेट
- 15. विंडोज 8
- 16. विंडोज 8 सी # मेट्रो ऐप
- 17. विंडोज स्टोर ऐप और एफ #
- 18. यूनिट परीक्षण विंडोज 8 स्टोर ऐप यूआई (एक्सएमएल कंट्रोल)
- 19. विंडोज 8 और विंडोज फोन 8
- 20. विंडोज 8 सिम्युलेटर कमांड लाइन इंटरफेस
- 21. विंडोज 8 में लाइव टाइम
- 22. विंडोज 8
- 23. विंडोज 8 स्टोर ऐप (मेट्रो) विंडोज 7 या एक्सपी में चलाएं?
- 24. विंडोज 8
- 25. विंडोज 8 में पृष्ठभूमि ऑडियो ऐप
- 26. विंडोज 8 में एमएलएएमएल
- 27. विंडोज स्टोर ऐप में टाइमर कहां है?
- 28. विंडोज स्टोर ऐप में ग्रिड। शोग्रिडलाइन
- 29. विंडोज 8 एप
- 30. विंडोज 8
बस यह इंगित करने के लिए कि इस फ़ाइल में 'NotifyPropertyChanged' क्लास संदर्भ नहीं है, और अधिकांश लोग इसे पुनर्निर्मित करने के बारे में जानेंगे, लेकिन यह उन लोगों के लिए शामिल करना अच्छा हो सकता है जो नहीं करते हैं। –
@ ओवेन जोहानसन 'नोटिफ़ाईप्रॉपर्टी चेंजेड' यहां मिला: https://mytoolkit.svn.codeplex.com/svn/Shared/MVVM/NotifyPropertyChanged.cs – mydogisbox
https://xp-dev.com/svn/mytoolkit/Shared/MVVM/ देखें NotifyPropertyChanged.cs –