How to use PowerShell as default terminal in IntelliJ/PhpStorm/Pycharm/…
Open IntelliJ settings.
Go to the “Tools” section.
Press the “Terminal” option.
Set the correct Shell path to the PowerShell EXE file. In the case of Windows 8.1, the path is: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe. You should use the latest PowerShell version available!
Create a new terminal session in IntelliJ. Alternatively, you can just restart IntelliJ to apply the changes.
public class ViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public string FirstName { get; set; }
public void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
现在,在 Window 的构造函数中,我们通知视图该属性已更改。
public MainWindow()
{
var viewModel = new ViewModel();
viewModel.FirstName = "Kevin";
DataContext = viewModel;
InitializeComponent();
viewModel.FirstName = "Mark";
viewModel.OnPropertyChanged(nameof(ViewModel.FirstName));
}
public abstract class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetProperty<T>(ref T field, T newValue, [CallerMemberName]string propertyName = null)
{
if(!EqualityComparer<T>.Default.Equals(field, newValue))
{
field = newValue;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
return true;
}
return false;
}
}
这使我们可以像这样重写FirstName属性:
public class ViewModel : ViewModelBase
{
private string _firstName;
public string FirstName
{
get => _firstName;
set => SetProperty(ref _firstName, value);
}
}
mailcatcher -h
Usage: mailcatcher [options]
--ip IP Set the ip address of both servers
--smtp-ip IP Set the ip address of the smtp server
--smtp-port PORT Set the port of the smtp server
--http-ip IP Set the ip address of the http server
--http-port PORT Set the port address of the http server
--http-path PATH Add a prefix to all HTTP paths
--no-quit Don't allow quitting the process
-f, --foreground Run in the foreground
-v, --verbose Be more verbose
-h, --help Display this help information