Resolving warnings and treating warnings as errors in WinUI project. (#824)
This commit is contained in:
@@ -76,7 +76,7 @@ public static class AnimationExtensions
|
||||
|
||||
public static void Animate(this DependencyObject target, double? from, double to,
|
||||
string propertyPath, int duration = 400, int startTime = 0,
|
||||
EasingFunctionBase easing = null, Action completed = null, bool enableDependentAnimation = false)
|
||||
EasingFunctionBase? easing = null, Action? completed = null, bool enableDependentAnimation = false)
|
||||
{
|
||||
if (easing == null)
|
||||
{
|
||||
|
||||
@@ -17,12 +17,12 @@ public static partial class CompositionExtensions
|
||||
var compositor = elementVisual.Compositor;
|
||||
ElementCompositionPreview.SetIsTranslationEnabled(element, true);
|
||||
|
||||
ScalarKeyFrameAnimation hideOpacityAnimation = null;
|
||||
ScalarKeyFrameAnimation showOpacityAnimation = null;
|
||||
ScalarKeyFrameAnimation hideOffsetAnimation = null;
|
||||
ScalarKeyFrameAnimation showOffsetAnimation = null;
|
||||
Vector2KeyFrameAnimation hideScaleAnimation = null;
|
||||
Vector2KeyFrameAnimation showeScaleAnimation = null;
|
||||
ScalarKeyFrameAnimation? hideOpacityAnimation = null;
|
||||
ScalarKeyFrameAnimation? showOpacityAnimation = null;
|
||||
ScalarKeyFrameAnimation? hideOffsetAnimation = null;
|
||||
ScalarKeyFrameAnimation? showOffsetAnimation = null;
|
||||
Vector2KeyFrameAnimation? hideScaleAnimation = null;
|
||||
Vector2KeyFrameAnimation? showeScaleAnimation = null;
|
||||
|
||||
if (animateOpacity)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ public static partial class CompositionExtensions
|
||||
}
|
||||
|
||||
public static void EnableImplicitAnimation(this UIElement element, VisualPropertyType typeToAnimate,
|
||||
double duration = 800, double delay = 0, CompositionEasingFunction easing = null)
|
||||
double duration = 800, double delay = 0, CompositionEasingFunction? easing = null)
|
||||
{
|
||||
var visual = element.Visual();
|
||||
var compositor = visual.Compositor;
|
||||
@@ -142,7 +142,7 @@ public static partial class CompositionExtensions
|
||||
}
|
||||
|
||||
public static void EnableImplicitAnimation(this Visual visual, VisualPropertyType typeToAnimate,
|
||||
double duration = 800, double delay = 0, CompositionEasingFunction easing = null)
|
||||
double duration = 800, double delay = 0, CompositionEasingFunction? easing = null)
|
||||
{
|
||||
var compositor = visual.Compositor;
|
||||
|
||||
@@ -163,8 +163,8 @@ public static partial class CompositionExtensions
|
||||
visual.ImplicitAnimations = animationCollection;
|
||||
}
|
||||
|
||||
private static KeyFrameAnimation CreateAnimationByType(Compositor compositor, VisualPropertyType type,
|
||||
double duration = 800, double delay = 0, CompositionEasingFunction easing = null)
|
||||
private static KeyFrameAnimation? CreateAnimationByType(Compositor compositor, VisualPropertyType type,
|
||||
double duration = 800, double delay = 0, CompositionEasingFunction? easing = null)
|
||||
{
|
||||
KeyFrameAnimation animation;
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ public static class UtilExtensions
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(parent, i);
|
||||
|
||||
if (child is FrameworkElement)
|
||||
if (child is FrameworkElement frameworkElement)
|
||||
{
|
||||
list.Add(child as FrameworkElement);
|
||||
list.Add(frameworkElement);
|
||||
}
|
||||
|
||||
list.AddRange(Children(child));
|
||||
@@ -33,20 +33,13 @@ public static class UtilExtensions
|
||||
return list;
|
||||
}
|
||||
|
||||
public static T GetChildByName<T>(this DependencyObject parent, string name)
|
||||
public static T? GetChildByName<T>(this DependencyObject parent, string name) where T : class
|
||||
{
|
||||
var childControls = Children(parent);
|
||||
var controls = childControls.OfType<FrameworkElement>();
|
||||
|
||||
if (controls == null)
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
|
||||
var control = controls
|
||||
.Where(x => x.Name.Equals(name))
|
||||
.Cast<T>()
|
||||
.First();
|
||||
.FirstOrDefault(x => x.Name.Equals(name)) as T;
|
||||
|
||||
return control;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user