// Add new DataType. // you need two object to add new DataType: DataTypeAddOptions and SettingController. // specify the field by drop-down box, You cannot add DataType with duplicate DataType's name. // You can add multiple field,For simplicity, only one field is added here. public async void AddNewDataType() { // get DataType name from EditText view, // The name must start with package name, and End with a custom name. string dataTypeName = DataTypeNameView.Text; // create DataTypeAddOptions,You must specify the Field that you want to add, // You can add multiple Fields here. DataTypeAddOptions dataTypeAddOptions = new DataTypeAddOptions.Builder().SetName(dataTypeName).AddField(SelectedField).Build(); // create SettingController and add new DataType // The added results are displayed in the phone screen Task <DataType> AddTask = MySettingController.AddDataTypeAsync(dataTypeAddOptions); try { await AddTask; if (AddTask.IsCompleted) { if (AddTask.Exception == null && AddTask.Result != null) { Logger("Add dataType of " + SelectedFieldStr + " is true "); } else { PrintFailureMessage(AddTask.Exception, "AddNewDataType"); } } } catch (System.Exception ex) { PrintFailureMessage(ex, "AddNewDataType"); } }