Пример #1
0
        private async void EditNote()
        {
            string note = _model.Note;

            _textEditService.EditText(note, "Edit the note:", "Note Edit", t => note = t, t => !string.IsNullOrWhiteSpace(t));

            if (note != _model.Note)
            {
                await _client.AddNoteAsync(Id, note);
                await ModelUpdate();
            }
        }
        private void LoadRepository()
        {
            if (!Executor.IsBusy)
            {
                Executor.ExecuteAsync(() =>
                {
                    string name = null;

                    _textEditService.EditText("", "Repository name", "Add Repository", s => name = s);

                    if (!string.IsNullOrEmpty(name))
                    {
                        var repository = _lifetimeScope.Resolve <RepositoryViewModel>
                                         (
                            new NamedParameter("name", name),
                            new TypedParameter(typeof(RegistryViewModel), _parent)
                                         );

                        Repositories.Add(repository);
                    }

                    return(Task.CompletedTask);
                }).IgnoreAsync();
            }
        }
        private void AddVariable()
        {
            //Create a name for the variable
            var name = Function.Variables
                       .Select(v => v.Name)
                       .CreateUniqueName($"{SelectedType.Name} {{0}}");

            bool wasAccepted = false;

            //Edit the name
            _textEditService.EditText(name, "Name", "Add Variable", t =>
            {
                name        = t;
                wasAccepted = true;
            }, t => !string.IsNullOrWhiteSpace(t));

            //See if the user pressed 'ok'
            if (wasAccepted)
            {
                //Create the variable
                var variable = new Variable(Function, SelectedType, Guid.NewGuid())
                {
                    Name = name
                };

                //Add it to the function
                Function.AddVariable(variable);
            }
        }
Пример #4
0
 private void EditText()
 {
     _textEditService.EditText(Text, "Edit the text:", "Edit Text Example", t => Text = t, t => !string.IsNullOrWhiteSpace(t));
 }