コード例 #1
0
ファイル: MainViewModel.cs プロジェクト: CaptiveAire/VPL
        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
ファイル: Variable.cs プロジェクト: CaptiveAire/VPL
        protected virtual void Rename()
        {
            //TODO: DI this
            var textEditService = new TextEditService();

            textEditService.EditText(Name, "Name", "Rename Variable", t => Name = t, t => !string.IsNullOrWhiteSpace(t));
        }
コード例 #3
0
        private void Rename()
        {
            var textEditService = new TextEditService();

            textEditService.EditText(Name, "Function", "Rename Function", t => Name = t, t => !string.IsNullOrWhiteSpace(t));
        }