-using System;
+/*
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
{
if ((needsGetter && part.LastGetter == null) || (needsSetter && part.NextPart == null && part.LastSetter == null))
{
- Console.WriteLine("Binding", PropertyNotFoundErrorMessage, part.Content, current, target.GetType(), property.PropertyName);
+ Console.WriteLine("Binding, " + PropertyNotFoundErrorMessage, part.Content, current, target.GetType(), property.PropertyName);
break;
}
}
if (!TryConvert(ref value, property.ReturnType, true))
{
- Console.WriteLine("Binding", "{0} can not be converted to type '{1}'", value, property.ReturnType);
+ Console.WriteLine($"Binding : {value} can not be converted to type {property.ReturnType}");
return;
}
- target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted, false);
+ target.SetValueCore(property, value, SetValueFlags.ClearDynamicResource, BindableObject.SetValuePrivateFlags.Default | BindableObject.SetValuePrivateFlags.Converted);
}
else if (needsSetter && part.LastSetter != null && current != null)
{
if (!TryConvert(ref value, part.SetterType, false))
{
- Console.WriteLine("Binding", "{0} can not be converted to type '{1}'", value, part.SetterType);
+ Console.WriteLine($"Binding : {value} can not be converted to type {part.SetterType}");
return;
}
IEnumerable<BindingExpressionPart> GetPart(string part)
{
part = part.Trim();
- if (part == string.Empty)
+ if (string.IsNullOrEmpty(part))
throw new FormatException("Path contains an empty part");
BindingExpressionPart indexer = null;
if (sourceType.IsArray)
{
int index;
- if (!int.TryParse(part.Content, out index))
- Console.WriteLine("Binding", "{0} could not be parsed as an index for a {1}", part.Content, sourceType);
+ if (!int.TryParse(part.Content, NumberStyles.Number, CultureInfo.InvariantCulture, out index))
+ Console.WriteLine($"Binding : {part.Content} could not be parsed as an index for a {sourceType}");
else
part.Arguments = new object[] { index };