void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Gradient = ((System.Windows.Shapes.Ellipse)(target)); return; case 2: this.DaysFromLastScanProgressBar = ((ScottLogic.Shapes.PiePiece)(target)); return; case 3: this.MoreThan = ((System.Windows.Controls.TextBlock)(target)); return; case 4: this.DaysFromLastScan = ((System.Windows.Controls.TextBlock)(target)); return; case 5: #line 152 "..\..\..\Views\PanelScan.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.StartScan); #line default #line hidden return; case 6: this.AutoScan = ((System.Windows.Controls.CheckBox)(target)); #line 170 "..\..\..\Views\PanelScan.xaml" this.AutoScan.Click += new System.Windows.RoutedEventHandler(this.AutoScan_Click); #line default #line hidden return; case 7: this.AutoScanPeriod = ((System.Windows.Controls.ComboBox)(target)); #line 194 "..\..\..\Views\PanelScan.xaml" this.AutoScanPeriod.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.AutoScanPeriod_SelectionChanged); #line default #line hidden return; case 8: this.AutoScanDay = ((System.Windows.Controls.ComboBox)(target)); #line 206 "..\..\..\Views\PanelScan.xaml" this.AutoScanDay.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.AutoScanDay_SelectionChanged); #line default #line hidden return; case 9: this.NADay = ((System.Windows.Controls.ComboBoxItem)(target)); return; case 10: this.AutoScanDate = ((System.Windows.Controls.ComboBox)(target)); #line 222 "..\..\..\Views\PanelScan.xaml" this.AutoScanDate.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.AutoScanDate_SelectionChanged); #line default #line hidden return; case 11: this.AutoScanTime = ((System.Windows.Controls.ComboBox)(target)); #line 262 "..\..\..\Views\PanelScan.xaml" this.AutoScanTime.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.AutoScanTime_SelectionChanged); #line default #line hidden return; case 12: this.AutoUpdate = ((System.Windows.Controls.CheckBox)(target)); #line 297 "..\..\..\Views\PanelScan.xaml" this.AutoUpdate.Click += new System.Windows.RoutedEventHandler(this.AutoUpdate_Click); #line default #line hidden return; } this._contentLoaded = true; }
/// <summary> /// Constructs pie pieces and adds them to the visual tree for this control's canvas /// </summary> private void ConstructPiePieces() { CollectionView myCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(this.DataContext); if (myCollectionView == null) return; double halfWidth = this.Width / 2; double innerRadius = halfWidth * HoleSize; // compute the total for the property which is being plotted double total = 0; foreach (Object item in myCollectionView) { total += GetPlottedPropertyValue(item); } // add the pie pieces canvas.Children.Clear(); piePieces.Clear(); double accumulativeAngle=0; foreach (Object item in myCollectionView) { bool selectedItem = item == myCollectionView.CurrentItem; double wedgeAngle = GetPlottedPropertyValue(item) * 360 / total; PiePiece piece = new PiePiece() { Radius = halfWidth, InnerRadius = innerRadius, CentreX = halfWidth, CentreY = halfWidth, PushOut = (selectedItem ? 10.0 : 0), WedgeAngle = wedgeAngle, PieceValue = GetPlottedPropertyValue(item), RotationAngle = accumulativeAngle, Fill = ColorSelector != null ? ColorSelector.SelectBrush(item, myCollectionView.IndexOf(item)) : Brushes.Black, // record the index of the item which this pie slice represents Tag = myCollectionView.IndexOf(item), ToolTip = new ToolTip() }; piece.ToolTipOpening += new ToolTipEventHandler(PiePieceToolTipOpening); piece.MouseUp += new MouseButtonEventHandler(PiePieceMouseUp); piePieces.Add(piece); canvas.Children.Insert(0, piece); accumulativeAngle += wedgeAngle; } }