Пример #1
0
        private void AddButtonTapped(object sender, EventArgs e)
        {
            UIAlertController alertController = UIAlertController.Create("Новая подзадача", "", UIAlertControllerStyle.Alert);

            alertController.AddTextField((obj) =>
            {
                obj.Placeholder = "Текст";
            });

            UIAlertAction saveAction = UIAlertAction.Create("Сохранить", UIAlertActionStyle.Default, (obj) =>
            {
                UITextField tf  = alertController.TextFields[0];
                var sub         = new SubTask();
                sub.Title       = tf.Text;
                sub.SuperTaskID = Task.ID;
                Database.SaveSubtask(sub);
                subtasksList = Database.GetSubtasksByMainTaskID(Task.ID);
                tableView.ReloadData();
            });

            UIAlertAction cancelAction = UIAlertAction.Create("Отмена", UIAlertActionStyle.Cancel, null);

            alertController.AddAction(saveAction);
            alertController.AddAction(cancelAction);
            PresentViewController(alertController, true, null);
        }
Пример #2
0
 public static void SaveSubtask(SubTask task)
 {
     using (var conn = new SQLite.SQLiteConnection(Database.dbPath))
     {
         conn.Insert(task);
     }
 }