private void AddFunction() { var name = Program.Functions.Select(f => f.Name).CreateUniqueName("Function {0}"); bool wasAccepted = false; var textEditService = new TextEditService(); textEditService.EditText(name, "New Function", "Name", t => { name = t; wasAccepted = true; }, t => !string.IsNullOrWhiteSpace(t)); if (wasAccepted) { var functionHeaderMetadata = new FunctionMetadata() { Name = name, Id = Guid.NewGuid(), Elements = new ElementMetadata[] { }, }; var functionHeaderViewModel = new FunctionHeaderViewModel(functionHeaderMetadata); Program.Functions.Add(functionHeaderViewModel); } }
protected virtual void Rename() { //TODO: DI this var textEditService = new TextEditService(); textEditService.EditText(Name, "Name", "Rename Variable", t => Name = t, t => !string.IsNullOrWhiteSpace(t)); }
private void Rename() { var textEditService = new TextEditService(); textEditService.EditText(Name, "Function", "Rename Function", t => Name = t, t => !string.IsNullOrWhiteSpace(t)); }