Ejemplo n.º 1
0
        private void CompleteBt_Clicked(object sender, EventArgs e)
        {
            string title       = TitleEntry.Text;
            string description = DescriptionEntry.Text;

            if (title == null || title == "")
            {
                TitleEntry.TextColor = Color.Accent;
            }
            else if (_purpose == EditPurpose.createNew && _localData.GetGroups().Any(u => u.Title == title))
            {
                TitleEntry.TextColor = Color.Accent;
            }
            else if (description == null || description == "")
            {
                TitleEntry.TextColor       = Color.DarkCyan;
                DescriptionEntry.TextColor = Color.Accent;
            }
            else
            {
                TitleEntry.TextColor       = Color.DarkCyan;
                DescriptionEntry.TextColor = Color.DarkCyan;

                Group group = new Group(0, title, description, link);

                if (_purpose == EditPurpose.createNew)
                {
                    _localData.AddNewGroup(group);
                    group.Id = _localData.GetGroups().Find(u => u.Title == group.Title).Id;
                }
                else if (_purpose is EditPurpose.edit)
                {
                    _localData.UpdateGroup(_oldGroup, group);
                    group.Id = _localData.GetGroups().Find(u => u.Title == group.Title).Id;
                }

                EditorResult();
            }
        }