- 1
- 2
- 3
- 4
- 5
public override bool IsViewFromObject(View view, Java.Lang.Object @object)
{
// actually... i don't know
return true;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 4
−1
public override bool IsViewFromObject(View view, Java.Lang.Object @object)
{
// actually... i don't know
return true;
}
Прод код одного ведро-приложения, адаптер к листалке
−1
public static class TaskExtension
{
// Silences compiler warning: Because this call is not awaited,
// execution of the current method continues before the call is completed.
// Consider applying the 'await' operator to the result of the call
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NoWarning(this Task task) { }
}
Коллеги добавили в код после введения правила treat warnings as errors
−11
private readonly ScrollViewer _gestureListener = new ScrollViewer
{
Background = new SolidColorBrush { Color = Colors.Transparent },
Content = new Rectangle { Height = 5000 },
HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
IsScrollInertiaEnabled = false,
};
private async void _gestureListener_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
{
if (_flipLock) return;
var threshold = ActualHeight > 320 ? 48 : 32;
var delta = 2500 - _gestureListener.VerticalOffset;
if (e.IsIntermediate)
{
var abs = Math.Abs(delta);
var hit = abs > threshold;
var transparency = hit ? 0.5 : 1;
var currentDot = _counterCanvas.Children[SelectedIndex] as FrameworkElement;
var predictedDot = _counterCanvas.Children[delta > 0 ? PrevIndex : NextIndex] as FrameworkElement;
await AwaitAll(
_layer1Control.TranslateByYAsync(TimeSpan.Zero, null, -abs),
_layer1Control.ChangeOpacityAsync(MidAnimationLength, null, transparency),
_layer2Control.TranslateByYAsync(TimeSpan.Zero, null, abs),
_layer2Control.ChangeOpacityAsync(MidAnimationLength, null, transparency),
currentDot.ScaleAsync(QuickAnimationLength, null, hit ? 0.7 : 1.3),
predictedDot.ScaleAsync(QuickAnimationLength, null, hit ? 1.6 : 1),
currentDot.ChangeOpacityAsync(QuickAnimationLength, null, hit ? 0.5 : 1),
predictedDot.ChangeOpacityAsync(QuickAnimationLength, null, hit ? 1 : 0.5));
}
else
{
HandleGesture(delta, threshold);
}
}
private void HandleGesture(double delta, double threshold)
{
var down = delta < -threshold;
var up = delta > threshold;
if (down) FlipForward();
if (up) FlipBackward();
if (!down && !up) ResetPosition();
}
UserControl, по поведению близкий к FlipView
−1
_colorFlashlightAnimation = compositor.CreateExpressionAnimation(
"1.0 - min("
+ " 1.0,"
+ " ("
+ " ("
+ " ( frame.Offset.x + (frame.Size.x * 0.5) + grid.Offset.x - (windowWidth * 0.5) )"
+ " * ( frame.Offset.x + (frame.Size.x * 0.5) + grid.Offset.x - (windowWidth * 0.5) )"
+ " ) + ("
+ " ( frame.Offset.y + (frame.Size.y * 0.5) + grid.Offset.y - (windowHeight * 0.5) )"
+ " * ( frame.Offset.y + (frame.Size.y * 0.5) + grid.Offset.y - (windowHeight * 0.5) )"
+ " )"
+ " ) / ( radius * radius )"
+ ")");
Удивитесь, но это Microsoft
https://github.com/Microsoft/WindowsUIDevLabs/blob/master/Demos/SlideShow/SlideShow/TransitionLibrary.cs