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);
            }
        }
예제 #2
0
        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);
            }           
        }