Esempio n. 1
0
 partial void deleteButton(NSObject sender)
 {
     if (DataSource.Students.Count > 0 && selected != -1)
     {
         DataSource.Students.RemoveAt(selected);
         StudentTable.ReloadData();
         selected = -1;
         groupField.StringValue    = "";
         nameField.StringValue     = "";
         surnameField.StringValue  = "";
         birthField.StringValue    = "";
         hometownField.StringValue = "";
     }
 }
Esempio n. 2
0
        partial void saveButton(NSObject sender)
        {
            var alert = new NSAlert()
            {
                AlertStyle      = NSAlertStyle.Critical,
                InformativeText = "Group and Birth year must be integer.",
                MessageText     = "Format error",
            };

            if (selected != -1 && int.TryParse(groupField.StringValue, out int groupInt) && int.TryParse(birthField.StringValue, out int birthInt))
            {
                DataSource.Students[selected].Group     = groupInt;
                DataSource.Students[selected].Name      = nameField.StringValue;
                DataSource.Students[selected].SurName   = surnameField.StringValue;
                DataSource.Students[selected].BirthYear = birthInt;
                DataSource.Students[selected].IsLocal   = hometownField.StringValue;

                StudentTable.ReloadData();
            }
            else
            {
                alert.RunModal();
            }
        }
Esempio n. 3
0
 partial void addButton(NSObject sender)
 {
     DataSource.Students.Add(new Student());
     Console.WriteLine(DataSource.Students.Count);
     StudentTable.ReloadData();
 }