Пример #1
0
 public void BLE_GetShortRangeDisplay(BLE_DataType dataType, Action <string> onSuccess, OnErr onError)
 {
     try {
         DataTypeDisplay display = this.validator.GetRange(dataType);
         onSuccess(
             string.Format("{0},  {1}: {2},  {3}: {4}",
                           display.DataType, this.GetText(MsgCode.Min), display.Min, this.GetText(MsgCode.Max), display.Max));
     }
     catch (Exception e) {
         this.log.Exception(9999, "", e);
         WrapErr.SafeAction(() => {
             onError.Invoke(this.GetText(MsgCode.UnhandledError));
         });
     }
 }
Пример #2
0
 public void BLE_GetRangeDisplay(BLE_CharacteristicDataModel dataModel, Action <string, string> onSuccess, OnErr onError)
 {
     try {
         if (dataModel != null)
         {
             DataTypeDisplay display = this.validator.GetRange(dataModel.Parser.DataType);
             onSuccess(
                 dataModel.CharName,
                 string.Format("{0}: {1},  {2}: {3},  {4}: {5}",
                               this.GetText(MsgCode.DataType), display.DataType,
                               this.GetText(MsgCode.Min), display.Min,
                               this.GetText(MsgCode.Max), display.Max));
         }
     }
     catch (Exception e) {
         this.log.Exception(9999, "", e);
         WrapErr.SafeAction(() => {
             onError.Invoke(this.GetText(MsgCode.UnhandledError));
         });
     }
 }
Пример #3
0
        // Umbraco.Code.MapAll -HasPrevalues
        private void Map(IDataType source, DataTypeDisplay target, MapperContext context)
        {
            target.AvailableEditors = MapAvailableEditors(source, context);
            target.Id = source.Id;
            target.IsSystemDataType = SystemIds.Contains(source.Id);
            target.Key            = source.Key;
            target.Name           = source.Name;
            target.ParentId       = source.ParentId;
            target.Path           = source.Path;
            target.PreValues      = MapPreValues(source, context);
            target.SelectedEditor = source.EditorAlias.IsNullOrWhiteSpace() ? null : source.EditorAlias;
            target.Trashed        = source.Trashed;
            target.Udi            = Udi.Create(Constants.UdiEntityType.DataType, source.Key);

            if (!_propertyEditors.TryGet(source.EditorAlias, out var editor))
            {
                return;
            }

            target.Alias = editor.Alias;
            target.Group = editor.Group;
            target.Icon  = editor.Icon;
        }