var filepath = Path.Combine(Path.GetDirectoryName(Assembly), typeDef.FullName + ".decompiled.cs");
Log(2, " Decompiling {0} into {1}...", typeDef.FullName, filepath);
var decompilerContext = new DecompilerContext(module);
- using(var writer = new StreamWriter(filepath))
+ using (var writer = new StreamWriter(filepath))
{
var output = new PlainTextOutput(writer);
static ILRootNode ParseXaml(Stream stream, TypeReference typeReference)
{
ILRootNode rootnode = null;
- using(var reader = XmlReader.Create(stream))
+ using (var reader = XmlReader.Create(stream))
{
while (reader.Read())
{
if (!resource.Name.EndsWith(".xaml", StringComparison.InvariantCulture))
return false;
- using(var resourceStream = resource.GetResourceStream())
+ using (var resourceStream = resource.GetResourceStream())
{
var xmlDoc = new XmlDocument();
xmlDoc.Load(resourceStream);
initcomp.Statements.Add(assign);
}
- using(var writer = new StreamWriter(outFile))
+ using (var writer = new StreamWriter(outFile))
Provider.GenerateCodeFromCompileUnit(ccu, writer, new CodeGeneratorOptions());
}
string rootType, rootNs;
CodeTypeReference baseType;
IDictionary<string, CodeTypeReference> namesAndTypes;
- using(StreamReader reader = File.OpenText(xamlFile))
+ using (StreamReader reader = File.OpenText(xamlFile))
ParseXaml(reader, out rootType, out rootNs, out baseType, out namesAndTypes);
GenerateCode(rootType, rootNs, baseType, namesAndTypes, outFile);
}
int id = GlobalResource.Attribute.ButtonTint;
unchecked
{
- using(var value = new TypedValue())
+ using (var value = new TypedValue())
{
try
{
{
FormsAppCompatActivity context = this;
int id = global::Android.Resource.Attribute.ColorPrimaryDark;
- using(var value = new TypedValue())
+ using (var value = new TypedValue())
{
try
{
int attr = Resource.Attribute.actionBarSize;
int actionBarHeight;
- using(var tv = new TypedValue())
+ using (var tv = new TypedValue())
{
actionBarHeight = 0;
if (Context.Theme.ResolveAttribute(attr, tv, true))
void OnClick()
{
Picker model = Element;
- using(var builder = new AlertDialog.Builder(Context))
+ using (var builder = new AlertDialog.Builder(Context))
{
builder.SetTitle(model.Title ?? "");
string[] items = model.Items.ToArray();
protected void SetSelectedBackground(AView view, bool isContextTarget = false)
{
int attribute = isContextTarget ? global::Android.Resource.Attribute.ColorLongPressedHighlight : global::Android.Resource.Attribute.ColorActivatedHighlight;
- using(var value = new TypedValue())
+ using (var value = new TypedValue())
{
if (_context.Theme.ResolveAttribute(attribute, value, true))
view.SetBackgroundResource(value.ResourceId);
RightMargin = 0,
Gravity = GravityFlags.Center
};
- using(imageParams)
+ using (imageParams)
AddView(_imageView, imageParams);
var textLayout = new LinearLayout(context) { Orientation = Orientation.Vertical };
_mainText.Ellipsize = TextUtils.TruncateAt.End;
_mainText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
_mainText.SetTextAppearance(context, global::Android.Resource.Attribute.TextAppearanceListItem);
- using(var lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent))
+ using (var lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent))
textLayout.AddView(_mainText, lp);
_detailText = new TextView(context);
_detailText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
_detailText.Visibility = ViewStates.Gone;
_detailText.SetTextAppearance(context, global::Android.Resource.Attribute.TextAppearanceListItemSmall);
- using(var lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent))
+ using (var lp = new LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.WrapContent))
textLayout.AddView(_detailText, lp);
var layoutParams = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { Width = 0, Weight = 1, Gravity = GravityFlags.Center };
- using(layoutParams)
+ using (layoutParams)
AddView(textLayout, layoutParams);
SetMinimumHeight((int)context.ToPixels(DefaultMinHeight));
if (view != null)
{
- using(var layout = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.FillParent))
+ using (var layout = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.FillParent))
AddView(view, layout);
AccessoryView = view;
_label.SetTextAppearance(context, global::Android.Resource.Attribute.TextAppearanceListItem);
var layoutParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Gravity = GravityFlags.CenterVertical };
- using(layoutParams)
+ using (layoutParams)
AddView(_label, layoutParams);
EditText = new EntryCellEditText(context);
EditText.BackButtonPressed += OnBackButtonPressed;
//editText.SetBackgroundDrawable (null);
layoutParams = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { Width = 0, Weight = 1, Gravity = GravityFlags.FillHorizontal | GravityFlags.Center };
- using(layoutParams)
+ using (layoutParams)
AddView(EditText, layoutParams);
}
{
if (self == Color.Default)
{
- using(Resources resources = Resources.System)
+ using (Resources resources = Resources.System)
return resources.GetColor(defaultColorResourceId);
}
internal static double GetThemeAttributeDp(this Context self, int resource)
{
- using(var value = new TypedValue())
+ using (var value = new TypedValue())
{
if (!self.Theme.ResolveAttribute(resource, value, true))
return -1;
if (s_displayDensity != float.MinValue)
return;
- using(DisplayMetrics metrics = context.Resources.DisplayMetrics)
+ using (DisplayMetrics metrics = context.Resources.DisplayMetrics)
s_displayDensity = metrics.Density;
}
}
// Make sure to use Internal
return Task.Run(() =>
{
- using(IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
- using(IsolatedStorageFileStream stream = store.OpenFile(PropertyStoreFile, System.IO.FileMode.OpenOrCreate))
- using(XmlDictionaryReader reader = XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max))
+ using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (IsolatedStorageFileStream stream = store.OpenFile(PropertyStoreFile, System.IO.FileMode.OpenOrCreate))
+ using (XmlDictionaryReader reader = XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max))
{
if (stream.Length == 0)
return null;
return Task.Run(() =>
{
var success = false;
- using(IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
- using(IsolatedStorageFileStream stream = store.OpenFile(PropertyStoreFile + ".tmp", System.IO.FileMode.OpenOrCreate))
- using(XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter(stream))
+ using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (IsolatedStorageFileStream stream = store.OpenFile(PropertyStoreFile + ".tmp", System.IO.FileMode.OpenOrCreate))
+ using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter(stream))
{
try
{
if (!success)
return;
- using(IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
try
{
CheckOrientationChanged(_formsActivity.Resources.Configuration.Orientation);
formsActivity.ConfigurationChanged += ConfigurationChanged;
- using(DisplayMetrics display = formsActivity.Resources.DisplayMetrics)
+ using (DisplayMetrics display = formsActivity.Resources.DisplayMetrics)
{
_scalingFactor = display.Density;
_pixelScreenSize = new Size(display.WidthPixels, display.HeightPixels);
public async Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
{
- using(var client = new HttpClient())
- using(HttpResponseMessage response = await client.GetAsync(uri, cancellationToken))
+ using (var client = new HttpClient())
+ using (HttpResponseMessage response = await client.GetAsync(uri, cancellationToken))
return await response.Content.ReadAsStreamAsync();
}
{
get
{
- using(Looper my = Looper.MyLooper())
- using(Looper main = Looper.MainLooper)
+ using (Looper my = Looper.MyLooper())
+ using (Looper main = Looper.MainLooper)
return my != main;
}
}
val = 0;
try
{
- using(var value = new TypedValue())
+ using (var value = new TypedValue())
{
if (Context.Theme.ResolveAttribute(appearance, value, true))
{
var textSizeAttr = new[] { Resource.Attribute.TextSize };
const int indexOfAttrTextSize = 0;
- using(TypedArray array = Context.ObtainStyledAttributes(value.Data, textSizeAttr))
+ using (TypedArray array = Context.ObtainStyledAttributes(value.Data, textSizeAttr))
{
val = Context.FromPixels(array.GetDimensionPixelSize(indexOfAttrTextSize, -1));
return true;
{
internal static void HideKeyboard(this AView inputView, bool overrideValidation = false)
{
- using(var inputMethodManager = (InputMethodManager)Forms.Context.GetSystemService(Context.InputMethodService))
+ using (var inputMethodManager = (InputMethodManager)Forms.Context.GetSystemService(Context.InputMethodService))
{
IBinder windowToken = null;
internal static void ShowKeyboard(this AView inputView)
{
- using(var inputMethodManager = (InputMethodManager)Forms.Context.GetSystemService(Context.InputMethodService))
+ using (var inputMethodManager = (InputMethodManager)Forms.Context.GetSystemService(Context.InputMethodService))
{
if (inputView is EditText || inputView is TextView || inputView is SearchView)
{
else if (CurrentNavigationPage.BarBackgroundColor != Color.Default)
colorToUse = CurrentNavigationPage.BarBackgroundColor;
}
- using(Drawable drawable = colorToUse == Color.Default ? GetActionBarBackgroundDrawable() : new ColorDrawable(colorToUse.ToAndroid()))
+ using (Drawable drawable = colorToUse == Color.Default ? GetActionBarBackgroundDrawable() : new ColorDrawable(colorToUse.ToAndroid()))
((Activity)_context).ActionBar.SetBackgroundDrawable(drawable);
}
{
int[] backgroundDataArray = { global::Android.Resource.Attribute.Background };
- using(var outVal = new TypedValue())
+ using (var outVal = new TypedValue())
{
_context.Theme.ResolveAttribute(global::Android.Resource.Attribute.ActionBarStyle, outVal, true);
TypedArray actionBarStyle = _context.Theme.ObtainStyledAttributes(outVal.ResourceId, backgroundDataArray);
_layout.Orientation = Orientation.Vertical;
- using(var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent))
+ using (var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent))
SetContentView(_layout, layoutParams);
if (_arguments.Destruction != null)
Bitmap CreateBitmap(bool pressed, int width, int height)
{
Bitmap bitmap = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888);
- using(var canvas = new Canvas(bitmap))
+ using (var canvas = new Canvas(bitmap))
{
DrawBackground(canvas, width, height, pressed);
DrawOutline(canvas, width, height);
if (Button.BorderWidth <= 0)
return;
- using(var paint = new Paint { AntiAlias = true })
- using(var path = new Path())
+ using (var paint = new Paint { AntiAlias = true })
+ using (var path = new Path())
{
float borderWidth = Forms.Context.ToPixels(Button.BorderWidth);
float inset = borderWidth / 2;
_normalBitmap = CreateBitmap(false, width, height);
}
Bitmap bitmap = _normalBitmap;
- using(var paint = new Paint())
+ using (var paint = new Paint())
canvas.DrawBitmap(bitmap, 0, 0, paint);
}
Bitmap CreateBitmap(bool pressed, int width, int height)
{
Bitmap bitmap;
- using(Bitmap.Config config = Bitmap.Config.Argb8888)
+ using (Bitmap.Config config = Bitmap.Config.Argb8888)
bitmap = Bitmap.CreateBitmap(width, height, config);
- using(var canvas = new ACanvas(bitmap))
+ using (var canvas = new ACanvas(bitmap))
{
DrawBackground(canvas, width, height, pressed);
DrawOutline(canvas, width, height);
void DrawBackground(ACanvas canvas, int width, int height, bool pressed)
{
- using(var paint = new Paint { AntiAlias = true })
- using(var path = new Path())
- using(Path.Direction direction = Path.Direction.Cw)
- using(Paint.Style style = Paint.Style.Fill)
- using(var rect = new RectF(0, 0, width, height))
+ using (var paint = new Paint { AntiAlias = true })
+ using (var path = new Path())
+ using (Path.Direction direction = Path.Direction.Cw)
+ using (Paint.Style style = Paint.Style.Fill)
+ using (var rect = new RectF(0, 0, width, height))
{
float rx = Forms.Context.ToPixels(5);
float ry = Forms.Context.ToPixels(5);
void DrawOutline(ACanvas canvas, int width, int height)
{
- using(var paint = new Paint { AntiAlias = true })
- using(var path = new Path())
- using(Path.Direction direction = Path.Direction.Cw)
- using(Paint.Style style = Paint.Style.Stroke)
- using(var rect = new RectF(0, 0, width, height))
+ using (var paint = new Paint { AntiAlias = true })
+ using (var path = new Path())
+ using (Path.Direction direction = Path.Direction.Cw)
+ using (Paint.Style style = Paint.Style.Stroke)
+ using (var rect = new RectF(0, 0, width, height))
{
float rx = Forms.Context.ToPixels(5);
float ry = Forms.Context.ToPixels(5);
{
if (e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName || e.PropertyName == Frame.OutlineColorProperty.PropertyName)
{
- using(var canvas = new ACanvas(_normalBitmap))
+ using (var canvas = new ACanvas(_normalBitmap))
{
int width = Bounds.Width();
int height = Bounds.Height();
var imageLoader = imagesource as UriImageSource;
if (imageLoader != null && imageLoader.Uri != null)
{
- using(Stream imageStream = await imageLoader.GetStreamAsync(cancelationToken).ConfigureAwait(false))
+ using (Stream imageStream = await imageLoader.GetStreamAsync(cancelationToken).ConfigureAwait(false))
return await BitmapFactory.DecodeStreamAsync(imageStream).ConfigureAwait(false);
}
return null;
{
if (s_dividerHorizontalDarkId == int.MinValue)
{
- using(var value = new TypedValue())
+ using (var value = new TypedValue())
{
int id = global::Android.Resource.Drawable.DividerHorizontalDark;
if (_context.Theme.ResolveAttribute(global::Android.Resource.Attribute.ListDivider, value, true))
var streamsource = imagesource as StreamImageSource;
if (streamsource != null && streamsource.Stream != null)
{
- using(Stream stream = await streamsource.GetStreamAsync(cancelationToken).ConfigureAwait(false))
+ using (Stream stream = await streamsource.GetStreamAsync(cancelationToken).ConfigureAwait(false))
return await BitmapFactory.DecodeStreamAsync(stream).ConfigureAwait(false);
}
return null;
bline.SetBackgroundColor(global::Android.Graphics.Color.Transparent);
else
{
- using(var value = new TypedValue())
+ using (var value = new TypedValue())
{
int id = global::Android.Resource.Drawable.DividerHorizontalDark;
if (Context.Theme.ResolveAttribute(global::Android.Resource.Attribute.ListDivider, value, true))
else
view = new AButton(Context);
- using(var param = new LinearLayout.LayoutParams(LayoutParams.WrapContent, (int)Context.ToPixels(48), 1))
+ using (var param = new LinearLayout.LayoutParams(LayoutParams.WrapContent, (int)Context.ToPixels(48), 1))
((LinearLayout)Control).AddView(view, param);
}
}
global::Android.Graphics.Color androidColor = defaultColor;
Context context = Forms.Context;
- using(var value = new TypedValue())
+ using (var value = new TypedValue())
{
if (context.Theme.ResolveAttribute(style, value, true))
{
var styleattrs = new[] { global::Android.Resource.Attribute.TextSize, global::Android.Resource.Attribute.FontFamily, global::Android.Resource.Attribute.TextColor };
- using(TypedArray array = context.ObtainStyledAttributes(value.ResourceId, styleattrs))
+ using (TypedArray array = context.ObtainStyledAttributes(value.ResourceId, styleattrs))
{
fontSize = context.FromPixels(array.GetDimensionPixelSize(0, -1));
fontFamily = array.GetString(1);
public static void SetWindowBackground(this AView view)
{
Context context = view.Context;
- using(var background = new TypedValue())
+ using (var background = new TypedValue())
{
if (context.Theme.ResolveAttribute(global::Android.Resource.Attribute.WindowBackground, background, true))
{
view.SetBackgroundColor(color);
break;
case "drawable":
- using(Drawable drawable = context.Resources.GetDrawable(background.ResourceId))
+ using (Drawable drawable = context.Resources.GetDrawable(background.ResourceId))
view.SetBackgroundDrawable(drawable);
break;
}
// Make sure to use Internal
return Task.Run(() =>
{
- using(IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
- using(IsolatedStorageFileStream stream = store.OpenFile(PropertyStoreFile, System.IO.FileMode.OpenOrCreate))
- using(XmlDictionaryReader reader = XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max))
+ using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (IsolatedStorageFileStream stream = store.OpenFile(PropertyStoreFile, System.IO.FileMode.OpenOrCreate))
+ using (XmlDictionaryReader reader = XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max))
{
if (stream.Length == 0)
return null;
return Task.Run(() =>
{
var success = false;
- using(IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
- using(IsolatedStorageFileStream stream = store.OpenFile(PropertyStoreFile + ".tmp", System.IO.FileMode.OpenOrCreate))
- using(XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter(stream))
+ using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (IsolatedStorageFileStream stream = store.OpenFile(PropertyStoreFile + ".tmp", System.IO.FileMode.OpenOrCreate))
+ using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateBinaryWriter(stream))
{
try
{
if (!success)
return;
- using(IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
try
{
var streamsource = imagesource as StreamImageSource;
if (streamsource != null && streamsource.Stream != null)
{
- using(Stream stream = await streamsource.GetStreamAsync(cancelationToken))
+ using (Stream stream = await streamsource.GetStreamAsync(cancelationToken))
{
bitmapimage = new BitmapImage();
bitmapimage.SetSource(stream);
var imageLoader = imagesoure as UriImageSource;
if (imageLoader != null && imageLoader.Uri != null)
{
- using(Stream streamimage = await imageLoader.GetStreamAsync(cancelationToken))
+ using (Stream streamimage = await imageLoader.GetStreamAsync(cancelationToken))
{
if (streamimage != null && streamimage.CanRead)
{
async Task SaveToIsoStore(string fileName, string html)
{
IIsolatedStorageFile store = Device.PlatformServices.GetUserStoreForApplication();
- using(Stream file = await store.OpenFileAsync(fileName, FileMode.CreateNew, FileAccess.Write).ConfigureAwait(false))
+ using (Stream file = await store.OpenFileAsync(fileName, FileMode.CreateNew, FileAccess.Write).ConfigureAwait(false))
{
byte[] bytes = Encoding.UTF8.GetBytes(html);
await file.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false);
return null;
}
- using(IRandomAccessStream stream = streamImage.AsRandomAccessStream())
+ using (IRandomAccessStream stream = streamImage.AsRandomAccessStream())
{
try
{
var streamsource = imagesource as StreamImageSource;
if (streamsource != null && streamsource.Stream != null)
{
- using(Stream stream = await streamsource.GetStreamAsync(cancellationToken))
+ using (Stream stream = await streamsource.GetStreamAsync(cancellationToken))
{
if (stream == null)
return null;
public async Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
{
- using(var client = new HttpClient())
+ using (var client = new HttpClient())
{
HttpResponseMessage streamResponse = await client.GetAsync(uri.AbsoluteUri).ConfigureAwait(false);
return await streamResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
try
{
StorageFile file = await ApplicationData.Current.RoamingFolder.GetFileAsync(PropertyStoreFile).DontSync();
- using(Stream stream = (await file.OpenReadAsync().DontSync()).AsStreamForRead())
+ using (Stream stream = (await file.OpenReadAsync().DontSync()).AsStreamForRead())
{
if (stream.Length == 0)
return new Dictionary<string, object>(4);
public async Task SerializePropertiesAsync(IDictionary<string, object> properties)
{
StorageFile file = await ApplicationData.Current.RoamingFolder.CreateFileAsync(PropertyStoreFile, CreationCollisionOption.ReplaceExisting).DontSync();
- using(StorageStreamTransaction transaction = await file.OpenTransactedWriteAsync().DontSync())
+ using (StorageStreamTransaction transaction = await file.OpenTransactedWriteAsync().DontSync())
{
try
{
// Make sure to use Internal
return Task.Run(() =>
{
- using(var store = IsolatedStorageFile.GetUserStoreForApplication())
- using(var stream = store.OpenFile(PropertyStoreFile, System.IO.FileMode.OpenOrCreate))
- using(var reader = XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max))
+ using (var store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (var stream = store.OpenFile(PropertyStoreFile, System.IO.FileMode.OpenOrCreate))
+ using (var reader = XmlDictionaryReader.CreateBinaryReader(stream, XmlDictionaryReaderQuotas.Max))
{
if (stream.Length == 0)
return null;
return Task.Run(() =>
{
var success = false;
- using(var store = IsolatedStorageFile.GetUserStoreForApplication())
- using(var stream = store.OpenFile(PropertyStoreFile + ".tmp", System.IO.FileMode.OpenOrCreate))
- using(var writer = XmlDictionaryWriter.CreateBinaryWriter(stream))
+ using (var store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (var stream = store.OpenFile(PropertyStoreFile + ".tmp", System.IO.FileMode.OpenOrCreate))
+ using (var writer = XmlDictionaryWriter.CreateBinaryWriter(stream))
{
try
{
if (!success)
return;
- using(var store = IsolatedStorageFile.GetUserStoreForApplication())
+ using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
try
{
public async Task<Stream> GetStreamAsync(Uri uri, CancellationToken cancellationToken)
{
- using(var client = GetHttpClient())
- using(var response = await client.GetAsync(uri, cancellationToken))
+ using (var client = GetHttpClient())
+ using (var response = await client.GetAsync(uri, cancellationToken))
return await response.Content.ReadAsStreamAsync();
}
public override void Draw(RectangleF rect)
{
- using(var context = UIGraphics.GetCurrentContext())
+ using (var context = UIGraphics.GetCurrentContext())
{
_colorToRenderer.SetFill();
context.FillRect(rect);
var imageLoader = imagesource as UriImageSource;
if (imageLoader != null && imageLoader.Uri != null)
{
- using(var streamImage = await imageLoader.GetStreamAsync(cancelationToken).ConfigureAwait(false))
+ using (var streamImage = await imageLoader.GetStreamAsync(cancelationToken).ConfigureAwait(false))
{
if (streamImage != null)
image = UIImage.LoadFromData(NSData.FromStream(streamImage), scale);
MinimumLineSpacing = margin
}) { DataSource = new DataSource((NavigationMenu)Element), BackgroundColor = UIColor.White };
- using(var navigationCellId = new NSString("NavigationCell"))
+ using (var navigationCellId = new NSString("NavigationCell"))
_collectionView.RegisterClassForCell(typeof(NavigationCell), navigationCellId);
SetNativeControl(_collectionView);
yield return string.Empty;
yield break;
}
- using(IEnumerator<int> ewidths = widths.GetEnumerator())
+ using (IEnumerator<int> ewidths = widths.GetEnumerator())
{
bool? hw = null;
int width = GetNextWidth(ewidths, int.MaxValue, ref hw);
yield return string.Empty;
yield break;
}
- using(IEnumerator<int> ewidths = widths.GetEnumerator())
+ using (IEnumerator<int> ewidths = widths.GetEnumerator())
{
bool? hw = null;
int width = GetNextWidth(ewidths, int.MaxValue, ref hw);
public static void Load(BindableObject view, string xaml)
{
- using(var reader = XmlReader.Create(new StringReader(xaml)))
+ using (var reader = XmlReader.Create(new StringReader(xaml)))
{
while (reader.Read())
{
static string ReadResourceAsXaml(Type type, Assembly assembly, string likelyTargetName, bool validate = false)
{
- using(var stream = assembly.GetManifestResourceStream(likelyTargetName))
- using(var reader = new StreamReader(stream))
+ using (var stream = assembly.GetManifestResourceStream(likelyTargetName))
+ using (var reader = new StreamReader(stream))
{
if (validate)
{