diff options
author | Chris King <kingces95@gmail.com> | 2016-03-25 13:53:19 -0700 |
---|---|---|
committer | Chris King <kingces95@gmail.com> | 2016-03-25 13:53:19 -0700 |
commit | b3365b7f7db2ab9505d9f0c704f86dd3b24b0caa (patch) | |
tree | 3e9c78ed3397f34d54daed530da2a7669c7f63b4 | |
parent | 03c84382c7bfa6d8712e07dfa48e569f9a9b66a7 (diff) | |
download | xamarin-forms-b3365b7f7db2ab9505d9f0c704f86dd3b24b0caa.tar.gz xamarin-forms-b3365b7f7db2ab9505d9f0c704f86dd3b24b0caa.tar.bz2 xamarin-forms-b3365b7f7db2ab9505d9f0c704f86dd3b24b0caa.zip |
Reformat using statements
40 files changed, 97 insertions, 97 deletions
diff --git a/Xamarin.Forms.Build.Tasks/XamlCTask.cs b/Xamarin.Forms.Build.Tasks/XamlCTask.cs index 81f06427..7c429d31 100644 --- a/Xamarin.Forms.Build.Tasks/XamlCTask.cs +++ b/Xamarin.Forms.Build.Tasks/XamlCTask.cs @@ -301,7 +301,7 @@ namespace Xamarin.Forms.Build.Tasks 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); @@ -358,7 +358,7 @@ namespace Xamarin.Forms.Build.Tasks 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()) { @@ -388,7 +388,7 @@ namespace Xamarin.Forms.Build.Tasks 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); diff --git a/Xamarin.Forms.Build.Tasks/XamlGTask.cs b/Xamarin.Forms.Build.Tasks/XamlGTask.cs index 28158e6b..72375d6b 100644 --- a/Xamarin.Forms.Build.Tasks/XamlGTask.cs +++ b/Xamarin.Forms.Build.Tasks/XamlGTask.cs @@ -171,7 +171,7 @@ namespace Xamarin.Forms.Build.Tasks initcomp.Statements.Add(assign); } - using(var writer = new StreamWriter(outFile)) + using (var writer = new StreamWriter(outFile)) Provider.GenerateCodeFromCompileUnit(ccu, writer, new CodeGeneratorOptions()); } @@ -180,7 +180,7 @@ namespace Xamarin.Forms.Build.Tasks 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); } diff --git a/Xamarin.Forms.Platform.Android/AppCompat/ButtonRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/ButtonRenderer.cs index c6e31e18..c7df08e2 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/ButtonRenderer.cs @@ -121,7 +121,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat int id = GlobalResource.Attribute.ButtonTint; unchecked { - using(var value = new TypedValue()) + using (var value = new TypedValue()) { try { diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs b/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs index 916f1859..b7c02205 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/FormsAppCompatActivity.cs @@ -293,7 +293,7 @@ namespace Xamarin.Forms.Platform.Android { FormsAppCompatActivity context = this; int id = global::Android.Resource.Attribute.ColorPrimaryDark; - using(var value = new TypedValue()) + using (var value = new TypedValue()) { try { diff --git a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs index fd4cb72b..7edbffb2 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs @@ -320,7 +320,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat 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)) diff --git a/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs index d59d9f6e..dd7fb85c 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/PickerRenderer.cs @@ -87,7 +87,7 @@ namespace Xamarin.Forms.Platform.Android.AppCompat 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(); diff --git a/Xamarin.Forms.Platform.Android/CellAdapter.cs b/Xamarin.Forms.Platform.Android/CellAdapter.cs index 9f439157..58c35a89 100644 --- a/Xamarin.Forms.Platform.Android/CellAdapter.cs +++ b/Xamarin.Forms.Platform.Android/CellAdapter.cs @@ -159,7 +159,7 @@ namespace Xamarin.Forms.Platform.Android 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); diff --git a/Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs b/Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs index 7855b01e..46959c08 100644 --- a/Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs +++ b/Xamarin.Forms.Platform.Android/Cells/BaseCellView.cs @@ -46,7 +46,7 @@ namespace Xamarin.Forms.Platform.Android RightMargin = 0, Gravity = GravityFlags.Center }; - using(imageParams) + using (imageParams) AddView(_imageView, imageParams); var textLayout = new LinearLayout(context) { Orientation = Orientation.Vertical }; @@ -56,7 +56,7 @@ namespace Xamarin.Forms.Platform.Android _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); @@ -65,12 +65,12 @@ namespace Xamarin.Forms.Platform.Android _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)); @@ -118,7 +118,7 @@ namespace Xamarin.Forms.Platform.Android 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; diff --git a/Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs b/Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs index c0206f1e..f94709d0 100644 --- a/Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs +++ b/Xamarin.Forms.Platform.Android/Cells/EntryCellView.cs @@ -32,7 +32,7 @@ namespace Xamarin.Forms.Platform.Android _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); @@ -43,7 +43,7 @@ namespace Xamarin.Forms.Platform.Android 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); } diff --git a/Xamarin.Forms.Platform.Android/ColorExtensions.cs b/Xamarin.Forms.Platform.Android/ColorExtensions.cs index afe7286d..707363ed 100644 --- a/Xamarin.Forms.Platform.Android/ColorExtensions.cs +++ b/Xamarin.Forms.Platform.Android/ColorExtensions.cs @@ -16,7 +16,7 @@ namespace Xamarin.Forms.Platform.Android { if (self == Color.Default) { - using(Resources resources = Resources.System) + using (Resources resources = Resources.System) return resources.GetColor(defaultColorResourceId); } diff --git a/Xamarin.Forms.Platform.Android/ContextExtensions.cs b/Xamarin.Forms.Platform.Android/ContextExtensions.cs index 9a22c570..b3a219fd 100644 --- a/Xamarin.Forms.Platform.Android/ContextExtensions.cs +++ b/Xamarin.Forms.Platform.Android/ContextExtensions.cs @@ -34,7 +34,7 @@ namespace Xamarin.Forms.Platform.Android 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; @@ -51,7 +51,7 @@ namespace Xamarin.Forms.Platform.Android if (s_displayDensity != float.MinValue) return; - using(DisplayMetrics metrics = context.Resources.DisplayMetrics) + using (DisplayMetrics metrics = context.Resources.DisplayMetrics) s_displayDensity = metrics.Density; } } diff --git a/Xamarin.Forms.Platform.Android/Deserializer.cs b/Xamarin.Forms.Platform.Android/Deserializer.cs index 4c62ad1a..b1eafa88 100644 --- a/Xamarin.Forms.Platform.Android/Deserializer.cs +++ b/Xamarin.Forms.Platform.Android/Deserializer.cs @@ -18,9 +18,9 @@ namespace Xamarin.Forms.Platform.Android // 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; @@ -49,9 +49,9 @@ namespace Xamarin.Forms.Platform.Android 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 { @@ -69,7 +69,7 @@ namespace Xamarin.Forms.Platform.Android if (!success) return; - using(IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) + using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) { try { diff --git a/Xamarin.Forms.Platform.Android/Forms.cs b/Xamarin.Forms.Platform.Android/Forms.cs index 8eb50380..b2ded248 100644 --- a/Xamarin.Forms.Platform.Android/Forms.cs +++ b/Xamarin.Forms.Platform.Android/Forms.cs @@ -161,7 +161,7 @@ namespace Xamarin.Forms 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); @@ -352,8 +352,8 @@ namespace Xamarin.Forms 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(); } @@ -366,8 +366,8 @@ namespace Xamarin.Forms { get { - using(Looper my = Looper.MyLooper()) - using(Looper main = Looper.MainLooper) + using (Looper my = Looper.MyLooper()) + using (Looper main = Looper.MainLooper) return my != main; } } @@ -415,13 +415,13 @@ namespace Xamarin.Forms 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; diff --git a/Xamarin.Forms.Platform.Android/KeyboardManager.cs b/Xamarin.Forms.Platform.Android/KeyboardManager.cs index 649c99bd..db478578 100644 --- a/Xamarin.Forms.Platform.Android/KeyboardManager.cs +++ b/Xamarin.Forms.Platform.Android/KeyboardManager.cs @@ -11,7 +11,7 @@ namespace Xamarin.Forms.Platform.Android { 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; @@ -26,7 +26,7 @@ namespace Xamarin.Forms.Platform.Android 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) { diff --git a/Xamarin.Forms.Platform.Android/Platform.cs b/Xamarin.Forms.Platform.Android/Platform.cs index 1de13b41..baf7fa44 100644 --- a/Xamarin.Forms.Platform.Android/Platform.cs +++ b/Xamarin.Forms.Platform.Android/Platform.cs @@ -463,7 +463,7 @@ namespace Xamarin.Forms.Platform.Android 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); } @@ -663,7 +663,7 @@ namespace Xamarin.Forms.Platform.Android { 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); diff --git a/Xamarin.Forms.Platform.Android/Renderers/ActionSheetRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ActionSheetRenderer.cs index ca51a709..8495d807 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ActionSheetRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ActionSheetRenderer.cs @@ -49,7 +49,7 @@ namespace Xamarin.Forms.Platform.Android _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) diff --git a/Xamarin.Forms.Platform.Android/Renderers/ButtonDrawable.cs b/Xamarin.Forms.Platform.Android/Renderers/ButtonDrawable.cs index f25f9301..62eaecbf 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ButtonDrawable.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ButtonDrawable.cs @@ -101,7 +101,7 @@ namespace Xamarin.Forms.Platform.Android 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); @@ -129,8 +129,8 @@ namespace Xamarin.Forms.Platform.Android 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; diff --git a/Xamarin.Forms.Platform.Android/Renderers/FrameRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/FrameRenderer.cs index 63fb5da4..a0cbd4d3 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/FrameRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/FrameRenderer.cs @@ -86,7 +86,7 @@ namespace Xamarin.Forms.Platform.Android _normalBitmap = CreateBitmap(false, width, height); } Bitmap bitmap = _normalBitmap; - using(var paint = new Paint()) + using (var paint = new Paint()) canvas.DrawBitmap(bitmap, 0, 0, paint); } @@ -122,10 +122,10 @@ namespace Xamarin.Forms.Platform.Android 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); @@ -136,11 +136,11 @@ namespace Xamarin.Forms.Platform.Android 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); @@ -157,11 +157,11 @@ namespace Xamarin.Forms.Platform.Android 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); @@ -179,7 +179,7 @@ namespace Xamarin.Forms.Platform.Android { 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(); diff --git a/Xamarin.Forms.Platform.Android/Renderers/ImageLoaderSourceHandler.cs b/Xamarin.Forms.Platform.Android/Renderers/ImageLoaderSourceHandler.cs index 541dbeaf..8d0ae3d9 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ImageLoaderSourceHandler.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ImageLoaderSourceHandler.cs @@ -13,7 +13,7 @@ namespace Xamarin.Forms.Platform.Android 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; diff --git a/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs b/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs index 28f1696e..53426644 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs @@ -289,7 +289,7 @@ namespace Xamarin.Forms.Platform.Android { 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)) diff --git a/Xamarin.Forms.Platform.Android/Renderers/StreamImagesourceHandler.cs b/Xamarin.Forms.Platform.Android/Renderers/StreamImagesourceHandler.cs index 708ed665..44066975 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/StreamImagesourceHandler.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/StreamImagesourceHandler.cs @@ -13,7 +13,7 @@ namespace Xamarin.Forms.Platform.Android 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; diff --git a/Xamarin.Forms.Platform.Android/Renderers/TableViewModelRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/TableViewModelRenderer.cs index a7659ed8..ea07dbf2 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/TableViewModelRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/TableViewModelRenderer.cs @@ -123,7 +123,7 @@ namespace Xamarin.Forms.Platform.Android 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)) diff --git a/Xamarin.Forms.Platform.Android/Renderers/ToolbarRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ToolbarRenderer.cs index f40b75f3..92a774e8 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ToolbarRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ToolbarRenderer.cs @@ -57,7 +57,7 @@ namespace Xamarin.Forms.Platform.Android 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); } } diff --git a/Xamarin.Forms.Platform.Android/ResourcesProvider.cs b/Xamarin.Forms.Platform.Android/ResourcesProvider.cs index 334ef56a..5c7e1de3 100644 --- a/Xamarin.Forms.Platform.Android/ResourcesProvider.cs +++ b/Xamarin.Forms.Platform.Android/ResourcesProvider.cs @@ -27,12 +27,12 @@ namespace Xamarin.Forms.Platform.Android 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); diff --git a/Xamarin.Forms.Platform.Android/ViewExtensions.cs b/Xamarin.Forms.Platform.Android/ViewExtensions.cs index 04a80ef2..12faa1ed 100644 --- a/Xamarin.Forms.Platform.Android/ViewExtensions.cs +++ b/Xamarin.Forms.Platform.Android/ViewExtensions.cs @@ -38,7 +38,7 @@ namespace Xamarin.Forms.Platform.Android 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)) { @@ -50,7 +50,7 @@ namespace Xamarin.Forms.Platform.Android 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; } diff --git a/Xamarin.Forms.Platform.WP8/Deserializer.cs b/Xamarin.Forms.Platform.WP8/Deserializer.cs index a0c2de00..29c0e374 100644 --- a/Xamarin.Forms.Platform.WP8/Deserializer.cs +++ b/Xamarin.Forms.Platform.WP8/Deserializer.cs @@ -18,9 +18,9 @@ namespace Xamarin.Forms.Platform.WinPhone // 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; @@ -48,9 +48,9 @@ namespace Xamarin.Forms.Platform.WinPhone 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 { @@ -67,7 +67,7 @@ namespace Xamarin.Forms.Platform.WinPhone if (!success) return; - using(IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) + using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) { try { diff --git a/Xamarin.Forms.Platform.WP8/ImageRenderer.cs b/Xamarin.Forms.Platform.WP8/ImageRenderer.cs index 8be9c15d..ba0649fb 100644 --- a/Xamarin.Forms.Platform.WP8/ImageRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/ImageRenderer.cs @@ -133,7 +133,7 @@ namespace Xamarin.Forms.Platform.WinPhone 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); @@ -151,7 +151,7 @@ namespace Xamarin.Forms.Platform.WinPhone 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) { diff --git a/Xamarin.Forms.Platform.WP8/WebViewRenderer.cs b/Xamarin.Forms.Platform.WP8/WebViewRenderer.cs index 4b3151b0..364babe2 100644 --- a/Xamarin.Forms.Platform.WP8/WebViewRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/WebViewRenderer.cs @@ -109,7 +109,7 @@ namespace Xamarin.Forms.Platform.WinPhone 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); diff --git a/Xamarin.Forms.Platform.WinRT/ImageLoaderSourceHandler.cs b/Xamarin.Forms.Platform.WinRT/ImageLoaderSourceHandler.cs index c9c711e0..d2b223b5 100644 --- a/Xamarin.Forms.Platform.WinRT/ImageLoaderSourceHandler.cs +++ b/Xamarin.Forms.Platform.WinRT/ImageLoaderSourceHandler.cs @@ -28,7 +28,7 @@ namespace Xamarin.Forms.Platform.WinRT return null; } - using(IRandomAccessStream stream = streamImage.AsRandomAccessStream()) + using (IRandomAccessStream stream = streamImage.AsRandomAccessStream()) { try { diff --git a/Xamarin.Forms.Platform.WinRT/StreamImagesourceHandler.cs b/Xamarin.Forms.Platform.WinRT/StreamImagesourceHandler.cs index ecf8c0db..faaa4988 100644 --- a/Xamarin.Forms.Platform.WinRT/StreamImagesourceHandler.cs +++ b/Xamarin.Forms.Platform.WinRT/StreamImagesourceHandler.cs @@ -21,7 +21,7 @@ namespace Xamarin.Forms.Platform.WinRT 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; diff --git a/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs b/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs index bff32b78..dcda2c2f 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsBasePlatformServices.cs @@ -115,7 +115,7 @@ namespace Xamarin.Forms.Platform.WinRT 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); diff --git a/Xamarin.Forms.Platform.WinRT/WindowsSerializer.cs b/Xamarin.Forms.Platform.WinRT/WindowsSerializer.cs index 4e0ad794..0eeb2f8f 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsSerializer.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsSerializer.cs @@ -23,7 +23,7 @@ namespace Xamarin.Forms.Platform.WinRT 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); @@ -41,7 +41,7 @@ namespace Xamarin.Forms.Platform.WinRT 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 { diff --git a/Xamarin.Forms.Platform.iOS/Deserializer.cs b/Xamarin.Forms.Platform.iOS/Deserializer.cs index bdab44df..86657578 100644 --- a/Xamarin.Forms.Platform.iOS/Deserializer.cs +++ b/Xamarin.Forms.Platform.iOS/Deserializer.cs @@ -18,9 +18,9 @@ namespace Xamarin.Forms.Platform.iOS // 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; @@ -49,9 +49,9 @@ namespace Xamarin.Forms.Platform.iOS 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 { @@ -69,7 +69,7 @@ namespace Xamarin.Forms.Platform.iOS if (!success) return; - using(var store = IsolatedStorageFile.GetUserStoreForApplication()) + using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { try { diff --git a/Xamarin.Forms.Platform.iOS/Forms.cs b/Xamarin.Forms.Platform.iOS/Forms.cs index b7a41826..b0d581c9 100644 --- a/Xamarin.Forms.Platform.iOS/Forms.cs +++ b/Xamarin.Forms.Platform.iOS/Forms.cs @@ -238,8 +238,8 @@ namespace Xamarin.Forms 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(); } diff --git a/Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs index f60ed6c1..ad408c1f 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/BoxRenderer.cs @@ -28,7 +28,7 @@ namespace Xamarin.Forms.Platform.iOS public override void Draw(RectangleF rect) { - using(var context = UIGraphics.GetCurrentContext()) + using (var context = UIGraphics.GetCurrentContext()) { _colorToRenderer.SetFill(); context.FillRect(rect); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs index f227f9a5..aa6ce913 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/ImageRenderer.cs @@ -197,7 +197,7 @@ namespace Xamarin.Forms.Platform.iOS 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); diff --git a/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs index 7136a61d..b3269927 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/NavigationMenuRenderer.cs @@ -43,7 +43,7 @@ namespace Xamarin.Forms.Platform.iOS 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); diff --git a/Xamarin.Forms.UITest.TestCloud/Mono.Options/StringCoda.cs b/Xamarin.Forms.UITest.TestCloud/Mono.Options/StringCoda.cs index 76eaf575..ae8b59bb 100644 --- a/Xamarin.Forms.UITest.TestCloud/Mono.Options/StringCoda.cs +++ b/Xamarin.Forms.UITest.TestCloud/Mono.Options/StringCoda.cs @@ -167,7 +167,7 @@ namespace Mono.Options 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); diff --git a/Xamarin.Forms.Xaml.Xamlg/Mono.Options/Options.cs b/Xamarin.Forms.Xaml.Xamlg/Mono.Options/Options.cs index d74ebf64..454f01a2 100644 --- a/Xamarin.Forms.Xaml.Xamlg/Mono.Options/Options.cs +++ b/Xamarin.Forms.Xaml.Xamlg/Mono.Options/Options.cs @@ -173,7 +173,7 @@ namespace Mono.Options 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); diff --git a/Xamarin.Forms.Xaml/XamlLoader.cs b/Xamarin.Forms.Xaml/XamlLoader.cs index 6d7674b9..8bf08f65 100644 --- a/Xamarin.Forms.Xaml/XamlLoader.cs +++ b/Xamarin.Forms.Xaml/XamlLoader.cs @@ -49,7 +49,7 @@ namespace Xamarin.Forms.Xaml 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()) { @@ -167,8 +167,8 @@ namespace Xamarin.Forms.Xaml 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) { |