Set base utilities + login page. Creation of localization resources. General project info.
This commit is contained in:
28
BodyshopUploader/Utils/BaseModel.cs
Normal file
28
BodyshopUploader/Utils/BaseModel.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
|
||||
namespace BodyshopUploader
|
||||
{
|
||||
public class BaseModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
|
||||
{
|
||||
if (object.Equals(storage, value)) return false;
|
||||
|
||||
storage = value;
|
||||
this.OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var eventHandler = this.PropertyChanged;
|
||||
if (eventHandler != null)
|
||||
{
|
||||
eventHandler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
27
BodyshopUploader/Utils/BaseViewModel.cs
Normal file
27
BodyshopUploader/Utils/BaseViewModel.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace BodyshopUploader
|
||||
{
|
||||
public abstract class BaseViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
|
||||
{
|
||||
if (object.Equals(storage, value)) return false;
|
||||
|
||||
storage = value;
|
||||
this.OnPropertyChanged(propertyName);
|
||||
return true;
|
||||
}
|
||||
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
var eventHandler = this.PropertyChanged;
|
||||
if (eventHandler != null)
|
||||
{
|
||||
eventHandler(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
33
BodyshopUploader/Utils/RelayCommand.cs
Normal file
33
BodyshopUploader/Utils/RelayCommand.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace BodyshopUploader
|
||||
{
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private Predicate<object> _canExecute;
|
||||
private Action<object> _execute;
|
||||
|
||||
public RelayCommand(Predicate<object> canExecute, Action<object> execute)
|
||||
{
|
||||
this._canExecute = canExecute;
|
||||
this._execute = execute;
|
||||
}
|
||||
|
||||
public event EventHandler CanExecuteChanged
|
||||
{
|
||||
add { CommandManager.RequerySuggested += value; }
|
||||
remove { CommandManager.RequerySuggested -= value; }
|
||||
}
|
||||
|
||||
public bool CanExecute(object parameter)
|
||||
{
|
||||
return _canExecute(parameter);
|
||||
}
|
||||
|
||||
public void Execute(object parameter)
|
||||
{
|
||||
_execute(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user