public override StringOperation Clone() { //tạo mới 1 replaceOperation, set from và to là "" var newReplaceOperation = new ReplaceOperation() { Args = new ReplaceArgs() { From = "", To = "" } }; //hiện dialog để người dùng customize var screen = new ReplaceConfigDialog(newReplaceOperation.Args); if (screen.ShowDialog() == true) { } //lấy args sau khi người dùng config, nếu nó vẫn là from"" to "" thì không return newReplaceOperation //đó là trường hợp người dùng cancel var ArgsAfterConfiguration = newReplaceOperation.Args as ReplaceArgs; if (ArgsAfterConfiguration.From == "" && ArgsAfterConfiguration.To == "") { return(null); } else { //trả về replaceOperation mà người dùng đã custom return(newReplaceOperation); } }
public override void Config() { var screen = new ReplaceConfigDialog(Args); if (screen.ShowDialog() == true) { } if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("Description")); } }