示例#1
0
        private void InitAppIcons()
        {
            for (var i = 0; i < 3; ++i)
            {
                var list = new List <KeyValuePair <AppObj, Label> >();
                for (var j = 0; j < 3; ++j)
                {
                    var label = new Label
                    {
                        Style                      = Resources["RoundLabel"] as Style,
                        FontSize                   = 16,
                        Foreground                 = Brushes.Black,
                        Margin                     = new Thickness(0),
                        VerticalAlignment          = VerticalAlignment.Bottom,
                        HorizontalAlignment        = HorizontalAlignment.Center,
                        BorderThickness            = new Thickness(2),
                        BorderBrush                = Brushes.DarkSlateGray,
                        HorizontalContentAlignment = HorizontalAlignment.Center,
                        VerticalContentAlignment   = VerticalAlignment.Center,
                        Visibility                 = Visibility.Hidden,
                        Background                 = new SolidColorBrush
                        {
                            Color   = Colors.SkyBlue,
                            Opacity = 0.5
                        }
                    };

                    var app = new AppObj
                    {
                        Height = 100,
                        Width  = 100,
                        Margin = new Thickness(0)
                    };

                    var border = new Border
                    {
                        Width        = 100,
                        Height       = 100,
                        CornerRadius = new CornerRadius(10),
                        Child        = new Grid
                        {
                            Children =
                            {
                                label,
                                app
                            }
                        }
                    };
                    border.MouseDown += MouseClickOnApp;

                    AppPanel.Children.Add(border);
                    Grid.SetColumn(border, j);
                    Grid.SetRow(border, i);
                    Panel.SetZIndex(label, 2);
                    Panel.SetZIndex(app, 1);
                    list.Add(new KeyValuePair <AppObj, Label>(app, label));
                }
                _appObjList.Add(list);
            }
        }
        private void ShowLoader(Panel control)
        {
            var rect = new Rectangle
            {
                Margin = new Thickness(0),
                Fill   = new SolidColorBrush(WPFColor.FromArgb(192, 40, 40, 40)),
                Name   = "prLoaderContainer"
            };

            var loader = new ProgressRing
            {
                Foreground          = (Brush)FindResource("AccentColorBrush"),
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                Width    = 80,
                Height   = 80,
                IsActive = true,
                Name     = "prLoader"
            };

            Panel.SetZIndex(rect, 10000);
            Panel.SetZIndex(loader, 10001);

            control.Children.Add(rect);
            control.Children.Add(loader);
        }
示例#3
0
        public void AddTempFrame(Page page)
        {
            Frame fr = new Frame();

            BaseGrid.Children.Add(fr);
            Panel.SetZIndex(fr, 1000);
            fr.Content = page;
        }
        private void Window_Loaded()
        {
            _dots     = new ObservableCollection <Dot>();
            _circuits = new ObservableCollection <Circuit>();

            #region 初始化图层
            //高亮蒙版
            _maskCanvas = new Canvas {
                Opacity = 0
            };
            Panel.SetZIndex(_maskCanvas, MaskLayer); //图层
            ZoomCanvas.Children.Add(_maskCanvas);

            //选择框
            _selectCanvas = new Canvas {
                Opacity = 0
            };
            ZoomCanvas.Children.Add(_selectCanvas);

            //辅助线
            _auxiliaryLineCanvas = new Canvas {
                Opacity = 0
            };
            ZoomCanvas.Children.Add(_auxiliaryLineCanvas);
            #endregion

            //回路
            CircuitsTreeView.ItemsSource = _circuits;
            List <CircuitInfo> allCircuits;
            CacheGraph.GetCircuits(out allCircuits);
            var circuits = allCircuits.Where(circuit => circuit.ParentCableId == Cable.CableId);
            foreach (var circuit in circuits)
            {
                GraphAddCircuit(circuit);
            }
            //点
            List <DotInfo> alldots;
            CacheGraph.GetDos(out alldots);
            foreach (var circuit in _circuits)
            {
                var dots = alldots.Where(dot => (dot.ParentCableId == Cable.CableId && dot.ParentCircuitId == circuit.Info.CircuitId))
                           .ToList();
                foreach (var dotInfo in dots)
                {
                    GraphAddDot(dotInfo, circuit);
                }
                circuit.GetAllLines(_zoomScale);
            }
            LoadPointLocation();
            //信息
            LbCableName.Content = Cable.CableName;
            LbRemark.Content    = Cable.Remark;
            LbOperator.Content  = User.UserName;
            //背景
            InitBgConfig();
        }
        private void HightLightCircuit(Circuit curCircuit)
        {
            _maskCanvas.Opacity = 0.8;
            Panel.SetZIndex(_maskCanvas, HightLightMaskLayer);

            foreach (var dot in curCircuit.CircuitDots)
            {
                Panel.SetZIndex(dot.DotCanvas, HightLightDotLayer);
            }
            Panel.SetZIndex(curCircuit.CircuitCanvas, HightLightCircuitLayer);
        }
示例#6
0
        /// <summary>
        /// Adds a splitter control to the specified grid row. The splitter control will always have its Z Index set to 1 so that
        /// it displays on the bottom of the Windows Forms control residing inside the grid row.
        /// </summary>
        /// <param name="rowNumber"></param>
        private void AddSplitterToGrid(int rowNumber)
        {
            var splitter = new GridSplitter
            {
                Name   = $"Splitter{rowNumber}",
                Height = 5,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Bottom
            };

            LayoutGrid.Children.Add(splitter);
            Grid.SetRow(splitter, rowNumber);
            Panel.SetZIndex(splitter, 1);
        }
 private void UpdataDotPhyAddr(Dot dot, string phyAddr)
 {
     dot.Info.PhyAddr = phyAddr;
     foreach (var curDot in _dots)
     {
         if (curDot.Info.PhyAddr == phyAddr && curDot != dot)
         {
             InfoBox.ErrorMsg(dot.Info.Name + "与" + curDot.Info.Name + "物理地址重复");
         }
     }
     InfoBox.PlaySound(true);
     Panel.SetZIndex(dot.DotCanvas, DotLayer);         //暗光
     dot.FlushDotStyle(dot.Info.DotStyle, _zoomScale); //去边框
 }
示例#8
0
        private void updateValidMoves(PlayerEventArgs e)
        {
            Board      board  = e.Board;
            BoardState state  = e.State;
            Player     player = e.Player;

            // Reset all current valid moves excluding the just played move
            foreach (Move move in validMoves.Where(move => !playedMoves.Contains(move)))
            {
                PlayableGameBoardGridEventListener.Children.Remove(activeImages[move.Row, move.Col]);

                inactiveImages[move.Row, move.Col].Opacity = 0;
                activeImages[move.Row, move.Col]           = null;
            }

            if (player is HumanPlayer)
            {
                validMoves = board.GetPossibleMoves(state);
            }
            else
            {
                validMoves = new Move[0];
            }

            if (PlayerTwo is HardAiPlayer)
            {
                return;
            }

            foreach (Move move in validMoves)
            {
                Sprite duplicate = originalPossibleMoveSprite.Duplicate();
                duplicate.Margin = inactiveImages[move.Row, move.Col].Margin;

                duplicate.Margin = new Thickness(
                    duplicate.Margin.Left + 20,
                    duplicate.Margin.Top,
                    duplicate.Margin.Right,
                    duplicate.Margin.Bottom);

                inactiveImages[move.Row, move.Col].Opacity = 0;

                activeImages[move.Row, move.Col] = duplicate;
                PlayableGameBoardGridEventListener.Children.Add(duplicate);
                Panel.SetZIndex(duplicate, 2);
            }
        }
 private void ResetLayers()
 {
     _maskCanvas.Background = Brushes.White;
     _maskCanvas.Opacity    = 0;
     _maskCanvas.Height     = ZoomCanvas.Height;
     _maskCanvas.Width      = ZoomCanvas.Width;
     Panel.SetZIndex(_maskCanvas, MaskLayer);           //蒙版层
     Panel.SetZIndex(ImgBackGround, BackgroundLayer);   //背景层
     //暗光层
     foreach (var dot in _dots)
     {
         Panel.SetZIndex(dot.DotCanvas, DotLayer);      //所有点
     }
     foreach (var circuit in _circuits)
     {
         Panel.SetZIndex(circuit.CircuitCanvas, CircuitLayer);//所有回路
     }
 }
        private void InsertSprites()
        {
            // Sprite resource name and width
            Sprite hardRobotSprite = new Sprite("HardRobotIdle", 311, AnimationType.AnimateForever)
            {
                Width  = 310,
                Height = 310,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Stretch             = Stretch.Fill,
                Name   = "HardRobotIdle",
                Margin = new Thickness(0, 0, 0, 0)
            };

            //Easy or Hard AI
            PlayerTwoSpriteCanvas.Children.Add(hardRobotSprite);
            Panel.SetZIndex(hardRobotSprite, 3);

            VolumeManager.play(@"Resources/Audio/RobotPodDown.wav");
        }
示例#11
0
        public FunnelExample()
        {
            InitializeComponent();

            //Credit https://dribbble.com/shots/2673159-Funnel-UI-concept
            //Icons http://www.flaticon.com/authors/madebyoliver

            BackColor = Color.FromArgb(255, 20, 20, 75);

            cartesianChart1.Series.Add(new LineSeries
            {
                Values = new ChartValues <double> {
                    100, 85, 50, 35, 5, 3
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(33, 106, 254)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            });
            cartesianChart1.Series.Add(new LineSeries
            {
                Values = new ChartValues <double> {
                    -100, -85, -50, -35, -5, 3
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(33, 106, 254)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            });

            var s2 = new LineSeries
            {
                Values = new ChartValues <double> {
                    110, 94, 60, 40, 10, 10
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(34, 44, 120)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            };
            var s3 = new LineSeries
            {
                Values = new ChartValues <double> {
                    -110, -94, -60, -40, -10, -10
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(34, 44, 120)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            };
            var s4 = new LineSeries
            {
                Values = new ChartValues <double> {
                    120, 104, 70, 50, 15, 15
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(20, 24, 89)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            };
            var s5 = new LineSeries
            {
                Values = new ChartValues <double> {
                    -120, -104, -70, -50, -15, -15
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(20, 24, 89)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            };

            Panel.SetZIndex(s2, -1);
            Panel.SetZIndex(s3, -1);
            Panel.SetZIndex(s4, -2);
            Panel.SetZIndex(s5, -2);

            cartesianChart1.Series.Add(s2);
            cartesianChart1.Series.Add(s3);
            cartesianChart1.Series.Add(s4);
            cartesianChart1.Series.Add(s5);

            cartesianChart1.AxisY.Add(new Axis {
                IsEnabled = false, ShowLabels = false
            });
            var section1 = new AxisSection
            {
                Value           = 1.5,
                Stroke          = new SolidColorBrush(System.Windows.Media.Color.FromArgb(38, 255, 255, 255)),
                StrokeThickness = 5
            };
            var section2 = new AxisSection
            {
                Value           = 3.5,
                Stroke          = new SolidColorBrush(System.Windows.Media.Color.FromArgb(38, 255, 255, 255)),
                StrokeThickness = 5
            };

            Panel.SetZIndex(section1, 1);
            Panel.SetZIndex(section2, 1);
            cartesianChart1.AxisX.Add(new Axis
            {
                IsEnabled  = false,
                ShowLabels = false,
                Sections   = new SectionsCollection
                {
                    section1,
                    section2
                }
            });

            var userUri   = new Uri(@"Cartesian/FunnelChart/Resources/user.png", UriKind.Relative);
            var fingerUri = new Uri("Cartesian/FunnelChart/Resources/fingerprint.png", UriKind.Relative);
            var viewUri   = new Uri("Cartesian/FunnelChart/Resources/view.png", UriKind.Relative);

            var ve1 = new VisualElement
            {
                X = 0.75,
                Y = 120,
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new StackPanel
                {
                    Children =
                    {
                        new Image     {
                            Source = new BitmapImage(userUri)
                        },
                        new TextBlock {
                            Text = "LOADED THE AD", FontSize = 16, Foreground = Brushes.White
                        }
                    }
                }
            };
            var ve2 = new VisualElement
            {
                X = 0.75,
                Y = 0,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new TextBlock {
                    Text = "100 %", FontSize = 40, Foreground = Brushes.White
                }
            };

            var ve3 = new VisualElement
            {
                X = 2.5,
                Y = 120,
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new StackPanel
                {
                    Children =
                    {
                        new Image     {
                            Source = new BitmapImage(viewUri)
                        },
                        new TextBlock {
                            Text = "SAW THE AD", FontSize = 16, Foreground = Brushes.White
                        }
                    }
                }
            };

            var ve4 = new VisualElement
            {
                X = 2.5,
                Y = 0,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new TextBlock {
                    Text = "50 %", FontSize = 40, Foreground = Brushes.White
                }
            };

            var ve5 = new VisualElement
            {
                X = 4.25,
                Y = 120,
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new StackPanel
                {
                    Children =
                    {
                        new Image     {
                            Source = new BitmapImage(fingerUri)
                        },
                        new TextBlock {
                            Text = "INTERACTED", FontSize = 16, Foreground = Brushes.White
                        }
                    }
                }
            };
            var ve6 = new VisualElement
            {
                X = 4.25,
                Y = 0,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new TextBlock {
                    Text = "100 %", FontSize = 40, Foreground = Brushes.White
                }
            };

            cartesianChart1.VisualElements.AddRange(new[]
            {
                ve1, ve2, ve3, ve4, ve5, ve6
            });
        }
示例#12
0
        private void SetLines()
        {
            var points = new List <Point>();

            foreach (var child in canvas.Children)
            {
                if (child is Button button)
                {
                    points.Add(new Point(Canvas.GetLeft(button), Canvas.GetTop(button)));
                }
            }

            for (var i = 1; i < points.Count; i++)
            {
                var button1 = (Button)canvas.Children[i - 1];
                var button2 = (Button)canvas.Children[i];

                var width1  = button1.Width;
                var height1 = button1.Height;

                var width2  = button2.Width;
                var height2 = button2.Height;

                var x1 = points[i - 1].X + width1 / 2;
                var y1 = points[i - 1].Y + height1 / 2;

                var x2 = points[i].X + width2 / 2;
                var y2 = points[i].Y + height2 / 2;

                var line2 = new Line
                {
                    Stroke          = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                    StrokeThickness = 5,
                    X2 = x2,
                    Y2 = y2
                };

                if (!string.IsNullOrEmpty(button1.Uid))
                {
                    // если угол
                    double tempX, tempY;

                    var line1 = new Line
                    {
                        Stroke          = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                        StrokeThickness = 5,
                        X1 = x1,
                        Y1 = y1
                    };

                    switch (int.Parse(button1.Uid))
                    {
                    case 0:
                        tempX = x2;
                        tempY = y1;
                        break;

                    case 1:
                        tempX = x1;
                        tempY = y2;
                        break;

                    case 2:
                        tempX = x2;
                        tempY = y1;
                        break;

                    case 3:
                        tempX = x1;
                        tempY = y2;
                        break;

                    default: throw new Exception("Angles");
                    }

                    line1.X2 = tempX;
                    line1.Y2 = tempY;

                    line2.X1 = tempX;
                    line2.Y1 = tempY;

                    Panel.SetZIndex(line1, 1);
                    Panel.SetZIndex(line2, 1);

                    canvas.Children.Add(line1);
                    canvas.Children.Add(line2);
                }
                else
                {
                    var line = new Line
                    {
                        Stroke          = new SolidColorBrush(Color.FromRgb(0, 0, 0)),
                        StrokeThickness = 5,
                        X1 = x1,
                        X2 = x2,
                        Y1 = y1,
                        Y2 = y2
                    };

                    Panel.SetZIndex(line, 1);

                    canvas.Children.Add(line);
                }
            }
        }
示例#13
0
        public UielementsExample()
        {
            InitializeComponent();

            var lineSeries = new LineSeries
            {
                Values = new ChartValues <double> {
                    4, 6, 6, 3, 5
                },
                Fill            = Brushes.Transparent,
                StrokeThickness = 4,
                PointGeometry   = null
            };
            var barSeries = new ColumnSeries
            {
                Values = new ChartValues <double> {
                    2, 6, 8, 9, 4
                }
            };

            cartesianChart1.Series.Add(lineSeries);
            cartesianChart1.Series.Add(barSeries);

            cartesianChart1.VisualElements.Add(new VisualElement
            {
                X = 0.5,
                Y = 7,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Top,
                UIElement           = new TextBlock //notice this property must be a wpf control
                {
                    Text       = "Warning!",
                    FontWeight = FontWeights.Bold,
                    FontSize   = 16,
                    Opacity    = 0.6
                }
            });
            var uri = new Uri("Cartesian/UielementsExample/warning.png", UriKind.Relative);

            cartesianChart1.VisualElements.Add(new VisualElement
            {
                X = 0.5,
                Y = 6.9,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom,
                UIElement           = new System.Windows.Controls.Image
                {
                    Source = new BitmapImage(uri),
                    Width  = 24,
                    Height = 24
                }
            });

            cartesianChart1.AxisY.Add(new Axis
            {
                IsMerged = true,
                Sections = new SectionsCollection
                {
                    new AxisSection
                    {
                        Value           = 7,
                        Stroke          = Brushes.YellowGreen,
                        StrokeThickness = 3,
                        StrokeDashArray = new DoubleCollection(new [] { 10d })
                    }
                }
            });
            cartesianChart1.AxisX.Add(new Axis
            {
                Labels = new[] { "Jan", "Feb", "Mar", "Apr", "May" }
            });

            Panel.SetZIndex(barSeries, 0);
            Panel.SetZIndex(lineSeries, 1);

            cartesianChart1.Base.MouseMove += BaseOnMouseMove;
            cartesianChart1.DataClick      += cartesianChart1_DataClick;
        }
示例#14
0
        //credit goes to infiniteLoop, the creators of Locomotion
        private Sprite addPod(PieceType playerMoved, Image flyToImage, Move move)
        {
            string     podType;
            Storyboard dropPod;
            string     sound;

            //determines the relative size of the sprite depending on row position
            int wid;
            int hit;

            if (move.Row > 6)
            {
                wid = 125;
                hit = 125;
            }
            else if (move.Row > 4)
            {
                wid = 115;
                hit = 115;
            }
            else if (move.Row > 2)
            {
                wid = 105;
                hit = 105;
            }
            else
            {
                wid = 95;
                hit = 95;
            }


            if (playerMoved == PieceType.Red)
            {
                podType = "dropPodHuman";
                dropPod = FindResource("DropHumanPod") as Storyboard;
                sound   = "Resources/Audio/HumanPodDown.wav";
            }
            else
            {
                if (difficultyIsHard)
                {
                    podType = "HardRobotSprite";
                    dropPod = FindResource("DropRobotPod") as Storyboard;
                    sound   = "Resources/Audio/HardRobotSound.wav";
                }
                else
                {
                    podType = "EasyRobotSprite";
                    dropPod = FindResource("DropRobotPod") as Storyboard;
                    sound   = "Resources/Audio/EasyRobotSound.wav";
                }
            }

            // Sprite resource name and width
            Sprite podImage = new Sprite(podType, 311)
            {
                Width  = wid,
                Height = hit,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Stretch             = Stretch.Fill,
                Name = podType
            };

            //attempt to resolve the location of the piece
            Vector offset = VisualTreeHelper.GetOffset(flyToImage);

            double left = offset.X;      //getPegLeft(row, col) - 6 + (col - row);
            double top  = offset.Y - 20; //getPegTop(row, col) + 109 + (row + col);

            podImage.Margin = new Thickness(left, top, 0, 0);
            //podImage.Visibility = Visibility.Hidden;

            PlayableGameBoardGridEventListener.Children.Add(podImage);
            Panel.SetZIndex(podImage, 3);

            if (podType.Equals("dropPodHuman"))
            {
                podImage.BeginStoryboard(dropPod);
                MoveTo(podImage, offset.X, offset.Y);
            }

            VolumeManager.play(sound);

            return(podImage);
        }
示例#15
0
        private void FunnelChart()
        {
            cartesianChart2.Background = new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 255, 255));

            cartesianChart2.Series.Add(new LineSeries
            {
                Values = new ChartValues <double> {
                    100, 85, 50, 35, 5, 3
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(33, 106, 254)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            });
            cartesianChart2.Series.Add(new LineSeries
            {
                Values = new ChartValues <double> {
                    -100, -85, -50, -35, -5, 3
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(33, 106, 254)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            });

            var s2 = new LineSeries
            {
                Values = new ChartValues <double> {
                    110, 94, 60, 40, 10, 10
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(34, 44, 120)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            };
            var s3 = new LineSeries
            {
                Values = new ChartValues <double> {
                    -110, -94, -60, -40, -10, -10
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(34, 44, 120)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            };
            var s4 = new LineSeries
            {
                Values = new ChartValues <double> {
                    120, 104, 70, 50, 15, 15
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(20, 24, 89)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            };
            var s5 = new LineSeries
            {
                Values = new ChartValues <double> {
                    -120, -104, -70, -50, -15, -15
                },
                Fill            = new SolidColorBrush(System.Windows.Media.Color.FromRgb(20, 24, 89)),
                PointGeometry   = null,
                AreaLimit       = 0,
                StrokeThickness = 0
            };

            Panel.SetZIndex(s2, -1);
            Panel.SetZIndex(s3, -1);
            Panel.SetZIndex(s4, -2);
            Panel.SetZIndex(s5, -2);

            cartesianChart2.Series.Add(s2);
            cartesianChart2.Series.Add(s3);
            cartesianChart2.Series.Add(s4);
            cartesianChart2.Series.Add(s5);

            cartesianChart2.AxisY.Add(new Axis {
                IsEnabled = false, ShowLabels = false
            });
            var section1 = new AxisSection
            {
                Value           = 1.5,
                Stroke          = new SolidColorBrush(System.Windows.Media.Color.FromArgb(38, 255, 255, 255)),
                StrokeThickness = 5
            };
            var section2 = new AxisSection
            {
                Value           = 3.5,
                Stroke          = new SolidColorBrush(System.Windows.Media.Color.FromArgb(38, 255, 255, 255)),
                StrokeThickness = 5
            };

            Panel.SetZIndex(section1, 1);
            Panel.SetZIndex(section2, 1);
            cartesianChart2.AxisX.Add(new Axis
            {
                IsEnabled  = false,
                ShowLabels = false,
                Sections   = new SectionsCollection
                {
                    section1,
                    section2
                }
            });

            var userUri   = new Uri(@"Cartesian/FunnelChart/Resources/user.png", UriKind.Relative);
            var fingerUri = new Uri("Cartesian/FunnelChart/Resources/fingerprint.png", UriKind.Relative);
            var viewUri   = new Uri("Cartesian/FunnelChart/Resources/view.png", UriKind.Relative);

            List <double> Percentages = new List <double>();

            int totalClients = clients.GetClientCount(clients);

            List <double> salesPipeline = clients.GetClientByPipeline(clients);

            foreach (var item in salesPipeline)
            {
                Percentages.Add(Math.Round(item / totalClients, 4) * 100);
            }

            var ve1 = new VisualElement
            {
                X = 0.75,
                Y = 150,
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new StackPanel
                {
                    Children =
                    {
                        new System.Windows.Controls.Image {
                            Source = new BitmapImage(userUri)
                        },
                        new TextBlock                     {
                            Text = "Awareness", FontSize = 16, Foreground = System.Windows.Media.Brushes.Black
                        }
                    }
                }
            };
            var ve2 = new VisualElement
            {
                X = 0.75,
                Y = 0,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new TextBlock {
                    Text = $"{Percentages[0]}%", FontSize = 40, Foreground = System.Windows.Media.Brushes.Black
                }
            };

            var ve3 = new VisualElement
            {
                X = 1.9,
                Y = 150,
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new StackPanel
                {
                    Children =
                    {
                        new System.Windows.Controls.Image {
                            Source = new BitmapImage(viewUri)
                        },
                        new TextBlock                     {
                            Text = "Interest", FontSize = 16, Foreground = System.Windows.Media.Brushes.Black
                        }
                    }
                }
            };

            var ve4 = new VisualElement
            {
                X = 1.9,
                Y = 0,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new TextBlock {
                    Text = $"{Percentages[1]}%", FontSize = 40, Foreground = System.Windows.Media.Brushes.Black
                }
            };

            var ve5 = new VisualElement
            {
                X = 3.1,
                Y = 150,
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new StackPanel
                {
                    Children =
                    {
                        new System.Windows.Controls.Image {
                            Source = new BitmapImage(fingerUri)
                        },
                        new TextBlock                     {
                            Text = "Decision", FontSize = 16, Foreground = System.Windows.Media.Brushes.Black
                        }
                    }
                }
            };
            var ve6 = new VisualElement
            {
                X = 3.1,
                Y = 0,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new TextBlock {
                    Text = $"{Percentages[2]}%", FontSize = 40, Foreground = System.Windows.Media.Brushes.Black
                }
            };

            var ve7 = new VisualElement
            {
                X = 4.25,
                Y = 150,
                VerticalAlignment   = VerticalAlignment.Bottom,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new StackPanel
                {
                    Children =
                    {
                        new System.Windows.Controls.Image {
                            Source = new BitmapImage(fingerUri)
                        },
                        new TextBlock                     {
                            Text = "Action", FontSize = 16, Foreground = System.Windows.Media.Brushes.Black
                        }
                    }
                }
            };
            var ve8 = new VisualElement
            {
                X = 4.25,
                Y = 0,
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                UIElement           = new TextBlock {
                    Text = $"{Percentages[3]}%", FontSize = 40, Foreground = System.Windows.Media.Brushes.Black
                }
            };

            cartesianChart2.VisualElements.AddRange(new[]
            {
                ve1, ve2, ve3, ve4, ve5, ve6, ve7, ve8
            });
        }
示例#16
0
        private void InsertSprites()
        {
            string easyRobotFile;
            string hardRobotFile;
            string goFirstFile;
            string goSecondFile;
            string sound;

            easyRobotFile = "EasyRobotIdle";
            hardRobotFile = "HardRobotIdle";
            sound         = "Resources/Audio/RobotPodDown.wav";

            goFirstFile  = "GoFirstSprite";
            goSecondFile = "GoSecondSprite";

            // Sprite resource name and width
            Sprite easyRobotSprite = new Sprite(easyRobotFile, 311, AnimationType.AnimateForever)
            {
                Width  = 310,
                Height = 310,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Stretch             = Stretch.Fill,
                Name = easyRobotFile
            };
            // Sprite resource name and width
            Sprite hardRobotSprite = new Sprite(hardRobotFile, 311, AnimationType.AnimateForever)
            {
                Width  = 310,
                Height = 310,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Stretch             = Stretch.Fill,
                Name = hardRobotFile
            };
            // Sprite resource name and width
            Sprite goFirstSprite = new Sprite(goFirstFile, 311, AnimationType.AnimateForever)
            {
                Width  = 310,
                Height = 310,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Stretch             = Stretch.Fill,
                Name = goFirstFile
            };
            // Sprite resource name and width
            Sprite goSecondSprite = new Sprite(goSecondFile, 311, AnimationType.AnimateForever)
            {
                Width  = 310,
                Height = 310,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Stretch             = Stretch.Fill,
                Name = goSecondFile
            };

            //Easy or Hard AI
            easyRobotSprite.Margin = new Thickness(0, 0, 0, 0);
            hardRobotSprite.Margin = new Thickness(0, 0, 0, 0);

            EasyRobotCanvas.Children.Add(easyRobotSprite);
            HardRobotCanvas.Children.Add(hardRobotSprite);

            //Going First or Second
            goFirstSprite.Margin  = new Thickness(0, 0, 0, 0);
            goSecondSprite.Margin = new Thickness(0, 0, 0, 0);

            GoFirstCanvas.Children.Add(goFirstSprite);
            GoSecondCanvas.Children.Add(goSecondSprite);


            Panel.SetZIndex(easyRobotSprite, 3);
            Panel.SetZIndex(hardRobotSprite, 3);

            Panel.SetZIndex(goFirstSprite, 3);
            Panel.SetZIndex(goFirstSprite, 3);

            VolumeManager.play(sound);
        }
示例#17
0
 private void HightLightDot(Dot dot)
 {
     _maskCanvas.Opacity = 0.8;
     Panel.SetZIndex(_maskCanvas, HightLightMaskLayer);
     Panel.SetZIndex(dot.DotCanvas, HightLightDotLayer);
 }