Skip to content

Commit

Permalink
Refactor: use nameof where Intellisense suggests.
Browse files Browse the repository at this point in the history
Refactor: use expression bodies where Intellisense suggests.
Remove warnings when doing clean build of entire solution.
Fix slidepuzzledemo.
Fix wpfclock - use .net 4.0 so it compiles cleanly
Remove duplicated files from DocumentSerialization.

Issues filed to track oustanding issues found.
  • Loading branch information
korygill committed Aug 13, 2015
1 parent 1d04131 commit 34860ee
Show file tree
Hide file tree
Showing 126 changed files with 255 additions and 2,634 deletions.
11 changes: 2 additions & 9 deletions Accessibility/FragmentProvider/CustomListControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ public int SelectedIndex
/// </summary>
/// <param name="i">The zero-based index of the item.</param>
/// <returns>The control for the item.</returns>
public CustomListItem GetItem(int i)
{
return (CustomListItem) _itemsArray[i];
}
public CustomListItem GetItem(int i) => (CustomListItem)_itemsArray[i];

/// <summary>
/// Gets the number of items in the list.
Expand All @@ -102,11 +99,7 @@ public CustomListItem GetItem(int i)
/// </summary>
/// <param name="listItem">The item.</param>
/// <returns>The zero-based index.</returns>
public int ItemIndex(CustomListItem listItem)
{
// Allows CustomListItem to requery its index, as it can change.
return _itemsArray.IndexOf(listItem);
}
public int ItemIndex(CustomListItem listItem) => _itemsArray.IndexOf(listItem);

/// <summary>
/// Removes an item from the list.
Expand Down
10 changes: 2 additions & 8 deletions Accessibility/FragmentProvider/ListItemProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,13 @@ public Rect BoundingRectangle
/// Gets any fragment roots that are embedded in this fragment.
/// </summary>
/// <returns>Null in this case.</returns>
public IRawElementProviderSimple[] GetEmbeddedFragmentRoots()
{
return null;
}
public IRawElementProviderSimple[] GetEmbeddedFragmentRoots() => null;

/// <summary>
/// Gets the runtime identifier of the UI Automation element.
/// </summary>
/// <returns>An array of integers.</returns>
public int[] GetRuntimeId()
{
return new[] {AutomationInteropProvider.AppendRuntimeId, _listItemControl.Id};
}
public int[] GetRuntimeId() => new[] { AutomationInteropProvider.AppendRuntimeId, _listItemControl.Id };

/// <summary>
/// Navigate to adjacent elements in the UI Automation tree.
Expand Down
10 changes: 2 additions & 8 deletions Accessibility/FragmentProvider/ListProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,13 @@ IRawElementProviderSimple IRawElementProviderSimple.HostRawElementProvider
/// Gets any fragment roots that are embedded in this fragment.
/// </summary>
/// <returns>Null in this case.</returns>
IRawElementProviderSimple[] IRawElementProviderFragment.GetEmbeddedFragmentRoots()
{
return null;
}
IRawElementProviderSimple[] IRawElementProviderFragment.GetEmbeddedFragmentRoots() => null;

/// <summary>
/// Gets the runtime identifier of the UI Automation element.
/// </summary>
/// <returns>Fragment roots return null.</returns>
int[] IRawElementProviderFragment.GetRuntimeId()
{
return null;
}
int[] IRawElementProviderFragment.GetRuntimeId() => null;

/// <summary>
/// Navigates to adjacent elements in the UI Automation tree.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions Accessibility/InsertText/InsertTextClient/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,7 @@ private IntPtr GetWindowHandleFromAutomationElement
/// <param name="flags">The flag(s) of interest.</param>
/// <param name="bit">The bit value(s).</param>
/// --------------------------------------------------------------------
private bool IsBitSet(int flags, int bit)
{
return (flags & bit) == bit;
}
private bool IsBitSet(int flags, int bit) => (flags & bit) == bit;

/// --------------------------------------------------------------------
/// <summary>
Expand Down
20 changes: 4 additions & 16 deletions Accessibility/InsertText/InsertTextClient/UnmanagedClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ public static Hwnd Cast(IntPtr h)
return hTemp;
}

public static implicit operator IntPtr(Hwnd h)
{
return h.h;
}
public static implicit operator IntPtr(Hwnd h) => h.h;

public static Hwnd Null
{
Expand All @@ -70,26 +67,17 @@ public static Hwnd Null
}
}

public static bool operator ==(Hwnd hl, Hwnd hr)
{
return hl.h == hr.h;
}
public static bool operator ==(Hwnd hl, Hwnd hr) => hl.h == hr.h;

public static bool operator !=(Hwnd hl, Hwnd hr)
{
return hl.h != hr.h;
}
public static bool operator !=(Hwnd hl, Hwnd hr) => hl.h != hr.h;

public override bool Equals(object oCompare)
{
var hr = Cast((Hwnd) oCompare);
return h == hr.h;
}

public override int GetHashCode()
{
return (int) h;
}
public override int GetHashCode() => (int)h;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,7 @@ internal void SetControlPropertiesText(int controlCounter)
/// Index of current list box item.
/// </param>
/// --------------------------------------------------------------------
internal ListBoxItem GetClientItemFromIndex(ListBox listBox, int index)
{
return
(ListBoxItem) (listBox.ItemContainerGenerator.ContainerFromIndex(index));
}
internal ListBoxItem GetClientItemFromIndex(ListBox listBox, int index) => (ListBoxItem)(listBox.ItemContainerGenerator.ContainerFromIndex(index));

/// --------------------------------------------------------------------
/// <summary>
Expand Down
5 changes: 1 addition & 4 deletions Animation/AnimationExamples/BackDoubleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ public double Suppression
return returnValue;
}

protected override Freezable CreateInstanceCore()
{
return new BackDoubleAnimation();
}
protected override Freezable CreateInstanceCore() => new BackDoubleAnimation();

private static double EaseOut(double timeFraction, double start, double delta, double amplitude,
double suppression)
Expand Down
5 changes: 1 addition & 4 deletions Animation/AnimationExamples/BounceDoubleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ public double Bounciness
return returnValue;
}

protected override Freezable CreateInstanceCore()
{
return new BounceDoubleAnimation();
}
protected override Freezable CreateInstanceCore() => new BounceDoubleAnimation();

private static double EaseOut(double timeFraction, double start, double delta, double bounciness, int bounces)
{
Expand Down
5 changes: 1 addition & 4 deletions Animation/AnimationExamples/CircleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ public DirectionEnum Direction
return returnValue*Radius + defaultOriginValue;
}

protected override Freezable CreateInstanceCore()
{
return new CircleAnimation();
}
protected override Freezable CreateInstanceCore() => new CircleAnimation();
}
}
5 changes: 1 addition & 4 deletions Animation/AnimationExamples/ElasticDoubleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ public double Oscillations
return returnValue;
}

protected override Freezable CreateInstanceCore()
{
return new ElasticDoubleAnimation();
}
protected override Freezable CreateInstanceCore() => new ElasticDoubleAnimation();

private static double EaseOut(double timeFraction, double start, double delta, double springiness,
double oscillations)
Expand Down
5 changes: 1 addition & 4 deletions Animation/AnimationExamples/ExponentialDoubleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ public double Power
return returnValue;
}

protected override Freezable CreateInstanceCore()
{
return new ExponentialDoubleAnimation();
}
protected override Freezable CreateInstanceCore() => new ExponentialDoubleAnimation();

private static double EaseIn(double timeFraction, double start, double delta, double power)
{
Expand Down
5 changes: 1 addition & 4 deletions Animation/CustomAnimation/BackDoubleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ public double Suppression
return returnValue;
}

protected override Freezable CreateInstanceCore()
{
return new BackDoubleAnimation();
}
protected override Freezable CreateInstanceCore() => new BackDoubleAnimation();

private static double EaseOut(double timeFraction, double start, double delta, double amplitude,
double suppression)
Expand Down
5 changes: 1 addition & 4 deletions Animation/CustomAnimation/BounceDoubleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ public double Bounciness
return returnValue;
}

protected override Freezable CreateInstanceCore()
{
return new BounceDoubleAnimation();
}
protected override Freezable CreateInstanceCore() => new BounceDoubleAnimation();

private static double EaseOut(double timeFraction, double start, double delta, double bounciness, int bounces)
{
Expand Down
5 changes: 1 addition & 4 deletions Animation/CustomAnimation/CircleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ public DirectionEnum Direction
return returnValue*Radius + defaultOriginValue;
}

protected override Freezable CreateInstanceCore()
{
return new CircleAnimation();
}
protected override Freezable CreateInstanceCore() => new CircleAnimation();
}
}
5 changes: 1 addition & 4 deletions Animation/CustomAnimation/ElasticDoubleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,7 @@ public double Oscillations
return returnValue;
}

protected override Freezable CreateInstanceCore()
{
return new ElasticDoubleAnimation();
}
protected override Freezable CreateInstanceCore() => new ElasticDoubleAnimation();

private static double EaseOut(double timeFraction, double start, double delta, double springiness,
double oscillations)
Expand Down
5 changes: 1 addition & 4 deletions Animation/CustomAnimation/ExponentialDoubleAnimation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ public double Power
return returnValue;
}

protected override Freezable CreateInstanceCore()
{
return new ExponentialDoubleAnimation();
}
protected override Freezable CreateInstanceCore() => new ExponentialDoubleAnimation();

private static double EaseIn(double timeFraction, double start, double delta, double power)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,7 @@ private void SetTruePosition(UIElement e, Point p)
SetRenderTransformOffset(e, renderTranslation);
}

private Point GetCenter(Rect r)
{
return new Point((r.Left + r.Right)/2.0, (r.Top + r.Bottom)/2.0);
}
private Point GetCenter(Rect r) => new Point((r.Left + r.Right) / 2.0, (r.Top + r.Bottom) / 2.0);

#region Private Members

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,7 @@ protected virtual void OnDetachChild(UIElement child)

protected override int VisualChildrenCount => _vc.Count;

protected override Visual GetVisualChild(int index)
{
return _vc[index];
}
protected override Visual GetVisualChild(int index) => _vc[index];

#endregion
}
Expand Down
2 changes: 0 additions & 2 deletions Animation/Per-FrameAnimation/ParticleEffects/SonicEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace PerFrameAnimation

public class SonicEffect : OverlayRenderDecorator
{
private decimal _s;

protected override void OnAttachChild(UIElement child)
{
child.PreviewMouseLeftButtonUp += OnMouseLeftButtonUp;
Expand Down
5 changes: 1 addition & 4 deletions Data Binding/ADODataSet/IntColorConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return numValue < 350 ? Brushes.Green : Brushes.Red;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => null;
}
}
5 changes: 1 addition & 4 deletions Data Binding/BindConversion/MyConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public class MyConverter : IValueConverter
}

public object ConvertBack(object o, Type type,
object parameter, CultureInfo culture)
{
return null;
}
object parameter, CultureInfo culture) => null;
}
}
5 changes: 1 addition & 4 deletions Data Binding/BindValidation/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ private void DisableCustomHandler(object sender, RoutedEventArgs e)
BindingOperations.GetBindingExpression(textBox3, TextBox.TextProperty).UpdateSource();
}

private object ReturnExceptionHandler(object bindingExpression, Exception exception)
{
return "This is from the UpdateSourceExceptionFilterCallBack.";
}
private object ReturnExceptionHandler(object bindingExpression, Exception exception) => "This is from the UpdateSourceExceptionFilterCallBack.";
}
}
5 changes: 1 addition & 4 deletions Data Binding/BindingToMethod/DoubleToString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ namespace BindingToMethod
public class DoubleToString : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
CultureInfo culture)
{
return value?.ToString();
}
CultureInfo culture) => value?.ToString();

public object ConvertBack(object value, Type targetType, object parameter,
CultureInfo culture)
Expand Down
2 changes: 0 additions & 2 deletions Data Binding/CodeOnlyBinding/MyApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ internal class MyApp : Application
public Button Button;
public Button Button2;
public DockPanel Dp;
public Binding MyBinding;
public MyData MyDataObject;
public TextBlock MyText;

public void OnClick(object obj, RoutedEventArgs args)
Expand Down
5 changes: 1 addition & 4 deletions Data Binding/CollectionBinding/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ public string HomeTown

public event PropertyChangedEventHandler PropertyChanged;

public override string ToString()
{
return _firstname;
}
public override string ToString() => _firstname;

protected void OnPropertyChanged(string info)
{
Expand Down
5 changes: 1 addition & 4 deletions Data Binding/Colors/ByteToDoubleConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ namespace Colors

public class ByteToDoubleConverter : IValueConverter
{
object IValueConverter.Convert(object o, Type type, object parameter, CultureInfo culture)
{
return Convert.ChangeType(o, typeof (double));
}
object IValueConverter.Convert(object o, Type type, object parameter, CultureInfo culture) => Convert.ChangeType(o, typeof(double));

object IValueConverter.ConvertBack(object o, Type type, object parameter, CultureInfo culture)
{
Expand Down
10 changes: 2 additions & 8 deletions Data Binding/Colors/DoubleToStringConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ namespace Colors

public class DoubleToStringConverter : IValueConverter
{
object IValueConverter.Convert(object o, Type type, object parameter, CultureInfo culture)
{
return $"{o:f2}";
}
object IValueConverter.Convert(object o, Type type, object parameter, CultureInfo culture) => $"{o:f2}";

object IValueConverter.ConvertBack(object o, Type type, object parameter, CultureInfo culture)
{
return null;
}
object IValueConverter.ConvertBack(object o, Type type, object parameter, CultureInfo culture) => null;
}
}
Loading

0 comments on commit 34860ee

Please sign in to comment.