1. Список говнокодов пользователя cherepets

    Всего: 4

  2. C# / Говнокод #24237

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    public override bool IsViewFromObject(View view, Java.Lang.Object @object)
    		{
    			// actually... i don't know
    			return true;
    		}

    Прод код одного ведро-приложения, адаптер к листалке

    cherepets, 09 Мая 2018

    Комментарии (0)
  3. C# / Говнокод #23671

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    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

    cherepets, 25 Января 2018

    Комментарии (6)
  4. C# / Говнокод #22830

    −11

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    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

    cherepets, 18 Апреля 2017

    Комментарии (0)
  5. C# / Говнокод #19990

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    _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

    cherepets, 12 Мая 2016

    Комментарии (31)