/// <summary> /// Creates a new command. /// </summary> /// <param name="execute">The execution logic.</param> /// <param name="canExecute">The execution status logic.</param> public RelayCommand(Action <object> execute, Predicate <object> canExecute) { Diag.DataBindingPresentation(); if (execute == null) { throw new ArgumentNullException("execute"); } _execute = execute; _canExecute = canExecute; try { Diag.UpdateLog("(5) " + this.GetType().FullName + ";\t" + System.Reflection.MethodBase.GetCurrentMethod().Name + ";\t" + _execute.Method.Name + ";\t" + _execute.Method.ToString() + ";\t" + _execute.Target.ToString()); } catch (Exception ex) { Diag.UpdateLog("(5) " + this.GetType().FullName + ";\t" + System.Reflection.MethodBase.GetCurrentMethod().Name + ";\t" + ex.Message); } }
/// <summary> /// Creates a new command that can always execute. /// </summary> /// <param name="execute">The execution logic.</param> public RelayCommand(Action <object> execute) : this(execute, null) { Diag.DataBindingPresentation(); try { Diag.UpdateLog("(4) " + this.GetType().FullName + ";\t" + System.Reflection.MethodBase.GetCurrentMethod().Name + ";\t" + execute.ToString()); } catch (Exception ex) { Diag.UpdateLog("(4) " + this.GetType().FullName + ";\t" + System.Reflection.MethodBase.GetCurrentMethod().Name + ";\t" + ex.Message); } }
static App() { Diag.UpdateLog(true, "--------------------------------------------------------------------------"); Diag.DataBindingPresentation(); // This code is used to test the app when using other cultures. // //System.Threading.Thread.CurrentThread.CurrentCulture = // System.Threading.Thread.CurrentThread.CurrentUICulture = // new System.Globalization.CultureInfo("it-IT"); // Ensure the current culture passed into bindings is the OS culture. // By default, WPF uses en-US as the culture, regardless of the system settings. // FrameworkElement.LanguageProperty.OverrideMetadata( typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); }
public MainWindow() { InitializeComponent(); Diag.DataBindingPresentation(); }