Esempio n. 1
0
        private void buttonWheel_Click(object sender, ExecuteRoutedEventArgs e)
        {
            if (_mainViewModel.BlockCount > 1500)
            {
                MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Whoa, it looks like you have *a lot* of duplicate code there. Drawing this much duplication on the wheel may take a long time to draw and will make interaction with the wheel very very slow. Are you sure you want to continue?", "Continue?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
                if (messageBoxResult != MessageBoxResult.Yes)
                {
                    return;
                }
            }

            if (_wheelView == null)
            {
                WheelView wheelView = new WheelView(_mainViewModel.Files, _mainViewModel.RootDirectories.First <CodeDir>());
                wheelView.Closed             += wheelView_Closed;
                wheelView.CodeFileSelected   += wheelView_CodeFileSelected;
                wheelView.SimilaritySelected += wheelView_SimilaritySelected;
                wheelView.Show();

                _wheelView = wheelView;
            }
            else
            {
                _wheelView.Activate();
            }
        }
Esempio n. 2
0
        private void method_18(object sender, EventArgs e)
        {
            WheelView wheelView = (WheelView)sender;

            wheelView.Closed             -= new EventHandler(this.method_18);
            wheelView.CodeFileSelected   -= new EventHandler <CodeFileSelectedEventArgs>(this.method_17);
            wheelView.SimilaritySelected -= new EventHandler <SimilaritySelectedEventArgs>(this.method_16);
            this.wheelView_0              = null;
        }
Esempio n. 3
0
        private void wheelView_Closed(object sender, EventArgs e)
        {
            WheelView wheelView = (WheelView)sender;

            wheelView.Closed             -= wheelView_Closed;
            wheelView.CodeFileSelected   -= wheelView_CodeFileSelected;
            wheelView.SimilaritySelected -= wheelView_SimilaritySelected;

            _wheelView = null;
        }
Esempio n. 4
0
		private void wheelView_Closed(object sender, EventArgs e)
		{
			WheelView wheelView = (WheelView)sender;
			wheelView.Closed -= wheelView_Closed;
			wheelView.CodeFileSelected -= wheelView_CodeFileSelected;
			wheelView.SimilaritySelected -= wheelView_SimilaritySelected;

			_wheelView = null;
		}
Esempio n. 5
0
		private void buttonWheel_Click(object sender, ExecuteRoutedEventArgs e)
		{
			if (_mainViewModel.BlockCount > 1500)
			{
				MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Whoa, it looks like you have *a lot* of duplicate code there. Drawing this much duplication on the wheel may take a long time to draw and will make interaction with the wheel very very slow. Are you sure you want to continue?", "Continue?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
				if (messageBoxResult != MessageBoxResult.Yes)
				{
					return;
				}
			}

			if (_wheelView == null)
			{
				WheelView wheelView = new WheelView(_mainViewModel.Files, _mainViewModel.RootDirectories.First<CodeDir>());
				wheelView.Closed += wheelView_Closed;
				wheelView.CodeFileSelected += wheelView_CodeFileSelected;
				wheelView.SimilaritySelected += wheelView_SimilaritySelected;
				wheelView.Show();

				_wheelView = wheelView;
			}
			else
			{
				_wheelView.Activate();
			}
		}
Esempio n. 6
0
		private void method_18(object sender, EventArgs e)
		{
			WheelView wheelView = (WheelView)sender;
			wheelView.Closed -= new EventHandler(this.method_18);
			wheelView.CodeFileSelected -= new EventHandler<CodeFileSelectedEventArgs>(this.method_17);
			wheelView.SimilaritySelected -= new EventHandler<SimilaritySelectedEventArgs>(this.method_16);
			this.wheelView_0 = null;
		}
        private static Brush smethod0(PiePiece piePiece)
        {
            double h = piePiece.method8() / 360.0;

            return(new SolidColorBrush(WheelView.HSL2RGB(h, 1.0, 0.5)));
        }
        internal void WheelViewLoaded()
        {
            double0       = double4 + (double)(_wheelViewModel.DeepestDir + 1) * double2;
            double1       = double0;
            base.Height   = double1 * 2.0;
            base.Width    = double0 * 2.0;
            canvas.Width  = base.Width;
            canvas.Height = base.Height;
            Color.FromRgb(0, 102, 255);
            Color.FromRgb(255, 0, 0);
            Dictionary <CodeFile, PiePiece> dictionary  = new Dictionary <CodeFile, PiePiece>();
            Dictionary <CodeDir, PiePiece>  dictionary2 = new Dictionary <CodeDir, PiePiece>();
            Dictionary <PiePiece, double>   dictionary3 = new Dictionary <PiePiece, double>();

            double5 = double4 + double2;
            Ellipse element = new Ellipse
            {
                Height          = base.Height * 2.0,
                Width           = base.Width * 2.0,
                StrokeThickness = base.Width - double4,
                Stroke          = Brushes.Black
            };

            Canvas.SetTop(element, -1.0 * base.Height / 2.0);
            Canvas.SetLeft(element, -1.0 * base.Width / 2.0);
            Panel.SetZIndex(element, 5);
            canvas.Children.Add(element);
            double num  = 0.0;
            double num2 = 360.0 / _wheelViewModel.TotalLineSize;

            foreach (CodeFile current in _wheelViewModel.CodeFiles)
            {
                PiePiece piePiece = new PiePiece();
                piePiece.Style = _style0;
                int num3 = _wheelViewModel.DeepestDir - current.DirectParent.Depth;
                piePiece.method11(double0);
                piePiece.method13(double1);
                piePiece.method1(double5 + (double)num3 * double2);
                piePiece.method5(double4);
                piePiece.method9(num);
                piePiece.method7(num2 * (double)current.ProcessedLines);
                num += piePiece.method6();
                piePiece.DataContext = current;
                piePiece.Tag         = current;
                piePiece.Stroke      = Brushes.Black;
                piePiece.Fill        = WheelView.smethod0(piePiece);
                Panel.SetZIndex(piePiece, 10);
                piePiece.Cursor = Cursors.Hand;
                canvas.Children.Add(piePiece);
                dictionary.Add(current, piePiece);
                dictionary3.Add(piePiece, 0.0);
                method1(piePiece, System.IO.Path.GetFileNameWithoutExtension(current.Name), 1.0);
            }

            double[] array = new double[_wheelViewModel.DeepestDir + 1];

            foreach (CodeDir current2 in _codeDir.GetAllDirectories())
            {
                int      processedLines = current2.ProcessedLines;
                int      num3           = _wheelViewModel.DeepestDir - current2.Depth + 1;
                PiePiece piePiece       = new PiePiece();
                piePiece.Style = this._style1;
                piePiece.method11(double0);
                piePiece.method13(double1);
                piePiece.method1(double5 + (double)num3 * double2);
                piePiece.method5(double4 + (double)num3 * double2);
                CodeFile firstDeepestFile = current2.FirstDeepestFile;
                PiePiece piePiece2        = dictionary[firstDeepestFile];
                piePiece.method9(piePiece2.method8());
                piePiece.method7(num2 * (double)processedLines);

                if (piePiece.method6() >= 360.0)
                {
                    piePiece.method7(359.999);
                }

                array[num3]         += piePiece.method6();
                piePiece.DataContext = current2;
                piePiece.Tag         = current2;
                piePiece.Stroke      = Brushes.Black;
                piePiece.Fill        = WheelView.smethod0(piePiece);
                Panel.SetZIndex(piePiece, 10);
                piePiece.Cursor = Cursors.Hand;
                canvas.Children.Add(piePiece);
                dictionary2.Add(current2, piePiece);
                method1(piePiece, System.IO.Path.GetFileName(current2.Name), 0.8);
            }

            IEnumerable <Similarity> enumerable = _wheelViewModel.method1();

            foreach (Similarity current3 in enumerable)
            {
                CanonicalSpline canonicalSpline = new CanonicalSpline();
                canonicalSpline.Tolerance   = 1.5;
                canonicalSpline.DataContext = current3;
                canonicalSpline.Points      = new PointCollection();
                canonicalSpline.Cursor      = Cursors.Hand;
                Panel.SetZIndex(canonicalSpline, 0);
                canonicalSpline.StrokeThickness = (double)current3.MyHashIndexRange.Length * (num2 / 360.0 * double4 * 2.0 * 3.14159);
                canonicalSpline.Stroke          = (current3.SameFile ? WheelView._brush1 : WheelView._brush0);
                PiePiece piePiece3 = dictionary[current3.MyFile];
                PiePiece piePiece4 = dictionary[current3.OtherFile];
                double   num4      = piePiece3.method8() + dictionary3[piePiece3] + (double)current3.MyHashIndexRange.Length * num2 / 2.0;
                Point    point     = Utils.ComputeCartesianCoordinate(num4, double4, double0, double1);
                Point    value     = Utils.ComputeCartesianCoordinate(num4, double4 + double4 / 3.0, double0, double1);
                Dictionary <PiePiece, double> dictionary4;
                PiePiece key;
                (dictionary4 = dictionary3)[key = piePiece3] = dictionary4[key] + (double)current3.MyHashIndexRange.Length * num2;
                double num5   = piePiece4.method8() + dictionary3[piePiece4] + (double)current3.OtherHashIndexRange.Length * num2 / 2.0;
                Point  point2 = Utils.ComputeCartesianCoordinate(num5, double4, double0, double1);
                Point  value2 = Utils.ComputeCartesianCoordinate(num5, double4 + double4 / 3.0, double0, double1);
                (dictionary4 = dictionary3)[key = piePiece4] = dictionary4[key] + (double)current3.OtherHashIndexRange.Length * num2;
                double num6 = method3(num4, num5);
                double num7 = double4 - num6 / 180.0 * double4;

                if (num7 > double4 / 1.2)
                {
                    num7 = double4 / 1.2;
                }

                double angle  = method2(num4, num5);
                Point  value3 = Utils.ComputeCartesianCoordinate(angle, num7, double0, double1);
                canonicalSpline.Points.Add(value);
                canonicalSpline.Points.Add(point);
                canonicalSpline.Points.Add(value3);
                canonicalSpline.Points.Add(point2);
                canonicalSpline.Points.Add(value2);
                canonicalSpline.Stroke = new LinearGradientBrush(((SolidColorBrush)piePiece4.Fill).Color, ((SolidColorBrush)piePiece3.Fill).Color, point, point2)
                {
                    MappingMode = BrushMappingMode.Absolute
                };

                canvas.Children.Add(canonicalSpline);
            }
        }