Example #1
0
 private void letter_MouseDown(object sender, MouseButtonEventArgs e)
 {
     System.Windows.Media.Effects.DropShadowEffect effect = new System.Windows.Media.Effects.DropShadowEffect();
     effect.ShadowDepth = 15;
     ((Image)sender).Effect = effect;
     Captured = sender;
     prevPoint = e.GetPosition(this);
 }
Example #2
0
        // Hover effect
        private void Glow(HolderImage icon, bool hover)
        {
            System.Windows.Media.Effects.DropShadowEffect dse = new System.Windows.Media.Effects.DropShadowEffect();
            dse.Color       = hover ? Colors.White : Colors.Black;
            dse.ShadowDepth = 0;
            dse.BlurRadius  = 5;

            icon.Effect = dse;
        }
Example #3
0
        private void button_MouseLeave(object sender, MouseEventArgs e)
        {
            System.Windows.Media.Effects.DropShadowEffect littleBlackShadow = new System.Windows.Media.Effects.DropShadowEffect();
            littleBlackShadow.ShadowDepth = 1;
            littleBlackShadow.BlurRadius  = 1;
            littleBlackShadow.Opacity     = 0.7;

            ((FrameworkElement)sender).Effect = littleBlackShadow;
            ((FrameworkElement)((FrameworkElement)sender).Tag).Effect = ((FrameworkElement)sender).Effect;
        }
Example #4
0
 public WrongAnswerLampControl()
 {
     // Required to initialize variables
     InitializeComponent();
     dropShadowEffect             = new System.Windows.Media.Effects.DropShadowEffect();
     dropShadowEffect.Opacity     = 1;
     dropShadowEffect.ShadowDepth = 0;
     dropShadowEffect.BlurRadius  = 51;
     dropShadowEffect.Color       = Color.FromArgb(255, 251, 241, 97);
 }
Example #5
0
        private void button_MouseEnter(object sender, MouseEventArgs e)
        {
            System.Windows.Media.Effects.DropShadowEffect outerGlowShadow = new System.Windows.Media.Effects.DropShadowEffect();
            outerGlowShadow.ShadowDepth = 0;
            outerGlowShadow.BlurRadius  = 12;
            outerGlowShadow.Color       = Colors.White;
            outerGlowShadow.Opacity     = 0.7;

            ((FrameworkElement)sender).Effect = outerGlowShadow;
            ((FrameworkElement)((FrameworkElement)sender).Tag).Effect = ((FrameworkElement)sender).Effect;
        }
Example #6
0
 public AnimationControl(Label label, Button button, Window w, Grid gr)
 {
     btn  = button;
     lb   = label;
     grid = gr;
     //
     effect               = new System.Windows.Media.Effects.DropShadowEffect();
     effect.BlurRadius    = 10;
     effect.Direction     = 180;
     effect.Opacity       = 100;
     effect.RenderingBias = System.Windows.Media.Effects.RenderingBias.Performance;
     effect.ShadowDepth   = 0;
 }
Example #7
0
        public static UIElement RenderLabel(Geometries.Point position, LabelStyle labelStyle, IReadOnlyViewport viewport,
                                            string labelText)
        {
            var screenPosition  = viewport.WorldToScreen(position);
            var windowsPosition = screenPosition.ToXaml();

            // Set some defaults which should be configurable someday
            const double witdhMargin  = 3.0;
            const double heightMargin = 0.0;

            var textblock = new TextBlock
            {
                Text       = labelText,
                Foreground = new SolidColorBrush(labelStyle.ForeColor.ToXaml()),
                FontFamily = new FontFamily(labelStyle.Font.FontFamily),
                FontSize   = labelStyle.Font.Size,
                Margin     = new Thickness(witdhMargin, heightMargin, witdhMargin, heightMargin),
            };

            // TODO: Halo is not supported by WPF, but we CAN do an outer glow-like effect...
            if (labelStyle.Halo != null)
            {
                System.Windows.Media.Effects.DropShadowEffect haloEffect = new System.Windows.Media.Effects.DropShadowEffect();
                haloEffect.ShadowDepth = 0;
                haloEffect.Color       = labelStyle.Halo.Color.ToXaml();
                haloEffect.Opacity     = haloEffect.Color.A / 255.0;
                haloEffect.BlurRadius  = labelStyle.Halo.Width * 2;
                textblock.Effect       = haloEffect;
            }

            var border = new Border
            {
                // TODO: We have no SymbolCache, so we get problems, if there is a bitmap as background
                Background   = labelStyle.BackColor.ToXaml(rotate: (float)viewport.Rotation),
                CornerRadius = new CornerRadius(4),
                Child        = textblock,
                Opacity      = labelStyle.Opacity,
            };

            DetermineTextWidthAndHeightWpf(out var textWidth, out var textHeight, labelStyle, labelText);

            var offsetX = labelStyle.Offset.IsRelative ? textWidth * labelStyle.Offset.X : labelStyle.Offset.X;
            var offsetY = labelStyle.Offset.IsRelative ? textHeight * labelStyle.Offset.Y : labelStyle.Offset.Y;

            border.SetValue(Canvas.LeftProperty, windowsPosition.X + offsetX
                            - (textWidth + 2 * witdhMargin) * (short)labelStyle.HorizontalAlignment * 0.5f);
            border.SetValue(Canvas.TopProperty, windowsPosition.Y + offsetY
                            - (textHeight + 2 * heightMargin) * (short)labelStyle.VerticalAlignment * 0.5f);

            return(border);
        }
Example #8
0
        }//Непосредственно сама анимация

        //---
        //public bool SetAnimationRectangle
        //{
        //    set { AnimationButton = value; }
        //}
        //-----
        public void AddAnimationControl(Grid gr, Rectangle rectangle)
        {
            //btn = button;
            rectangle = rect;
            //lb = label;
            grid = gr;
            //
            effect               = new System.Windows.Media.Effects.DropShadowEffect();
            effect.BlurRadius    = 10;
            effect.Direction     = 180;
            effect.Opacity       = 100;
            effect.RenderingBias = System.Windows.Media.Effects.RenderingBias.Performance;
            effect.ShadowDepth   = 0;
        }//Подготовка значений преде присваиванием
 public MainWindow()
 {
     InitializeComponent();
     #region настройки Блюра
     effect               = new System.Windows.Media.Effects.DropShadowEffect();
     effect.BlurRadius    = 10;
     effect.Direction     = 180;
     effect.Opacity       = 100;
     effect.RenderingBias = System.Windows.Media.Effects.RenderingBias.Performance;
     effect.ShadowDepth   = 0;
     #endregion
     auth = new Authorization(LabelsContainer);
     //f = new AnimationControl(MainForm, MainGrid);
 }
        private void AddLabelOnGrid(Panel panel)
        {
            ushort Height = 3;
            Label  lb     = new Label();

            #region Blur на лбл 1
            System.Windows.Media.Effects.DropShadowEffect effect = new System.Windows.Media.Effects.DropShadowEffect();
            effect.BlurRadius    = 35;
            effect.Direction     = 160;
            effect.Opacity       = 100;
            effect.RenderingBias = System.Windows.Media.Effects.RenderingBias.Performance;
            effect.ShadowDepth   = 0;
            #endregion
            for (int i = 1; i <= fields.Count - 1; i++)
            {
                #region статические настройки label
                lb            = new Label();
                lb.Foreground = new SolidColorBrush(Color.FromRgb(160, 160, 160));
                lb.FontWeight = FontWeights.Bold;
                lb.FontSize   = 16;
                lb.FontFamily = new FontFamily("Tahoma");
                #endregion
                lb.Margin  = new Thickness(10, Height++, 0, 0);
                lb.Content = fields[i - 1];
                panel.Children.Add(lb);
            }
            Console.WriteLine();
            #region до такогото числа опалачено
            #region статические настройки label
            lb            = new Label();
            lb.FontWeight = FontWeights.Bold;
            lb.FontSize   = 16;
            lb.FontFamily = new FontFamily("Tahoma");
            #endregion
            if (fields[fields.Count - 1] == "Сегодня после 10:00 у вас отключат инернет")
            {
                effect.Color = Colors.Red;
            }
            else
            {
                effect.Color = Colors.CornflowerBlue;
            }
            lb.Effect     = effect;
            lb.Foreground = new SolidColorBrush(Color.FromRgb(160, 160, 160));
            lb.Margin     = new Thickness(10, Height++, 0, 0);
            lb.Content    = fields[fields.Count - 1];
            panel.Children.Add(lb);
            #endregion
        }//Добавление на форму меток
 public MainWindow()
 {
     InitializeComponent();
     #region настройки Блюра
     effect               = new System.Windows.Media.Effects.DropShadowEffect();
     effect.BlurRadius    = 10;
     effect.Direction     = 180;
     effect.Opacity       = 100;
     effect.RenderingBias = System.Windows.Media.Effects.RenderingBias.Performance;
     effect.ShadowDepth   = 0;
     #endregion
     provider = new InternetServiceProvider();
     //internetCompany = new Authorization(ref LabelsContainer);
     provider.CheckInternetConnection();
 }
Example #12
0
 public async void ChangeBorderColor(Brush brush, System.Windows.Media.Effects.DropShadowEffect effectlow, System.Windows.Media.Effects.DropShadowEffect effecthigh, double opacity)
 {
     await Task.Factory.StartNew(() =>
     {
         Dispatcher.Invoke(() => RadioLogoLow.BorderBrush  = brush);
         Dispatcher.Invoke(() => RadioLogoLow.Effect       = effectlow);
         Dispatcher.Invoke(() => RadioLogoLow.Opacity      = opacity);
         Dispatcher.Invoke(() => RadioLogoHigh.BorderBrush = brush);
         Dispatcher.Invoke(() => RadioLogoHigh.Effect      = effecthigh);
         Dispatcher.Invoke(() => RadioLogoHigh.Opacity     = opacity);
     })
     .ContinueWith((prevTask) =>
     {
         prevTask.Wait();
         //Dispatcher.Invoke(() => RadioLogoBack.BorderBrush.BeginAnimation(Border.OpacityProperty, AnimHigh));
     });
 }
Example #13
0
        public EditMenu(ref SketchPanel sp, CommandManagement.CommandManager commandManager)
        {
            sketchPanel         = sp;
            activeButtonList    = new List <Popup>();
            this.commandManager = commandManager;
            visible             = false;
            labelFuncSet        = false;
            overButton          = false;
            drawPoint           = new Point();

            #region Initialize the images for undo/redo, brush effects

            undoImage = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapImage undoBitmap = new System.Windows.Media.Imaging.BitmapImage(new Uri(
                                                                                                                   (AppDomain.CurrentDomain.BaseDirectory + @"EditIcons\UndoIcon.bmp")));
            undoImage.Source = undoBitmap;

            redoImage = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapImage redoBitmap = new System.Windows.Media.Imaging.BitmapImage(new Uri(
                                                                                                                   (AppDomain.CurrentDomain.BaseDirectory + @"EditIcons\RedoIcon.bmp")));
            redoImage.Source = redoBitmap;

            undoImageGray = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapImage undoGrayBitmap = new System.Windows.Media.Imaging.BitmapImage(new Uri(
                                                                                                                       (AppDomain.CurrentDomain.BaseDirectory + @"EditIcons\UndoIconGray.bmp")));
            undoImageGray.Source = undoGrayBitmap;

            redoImageGray = new System.Windows.Controls.Image();
            System.Windows.Media.Imaging.BitmapImage redoGrayBitmap = new System.Windows.Media.Imaging.BitmapImage(new Uri(
                                                                                                                       (AppDomain.CurrentDomain.BaseDirectory + @"EditIcons\RedoIconGray.bmp")));
            redoImageGray.Source = redoGrayBitmap;

            // Initialize Button Effects and Brushes
            highlightBrush = new System.Windows.Media.LinearGradientBrush(System.Windows.Media.Colors.White, System.Windows.Media.Colors.SkyBlue,
                                                                          new System.Windows.Point(0, 0), new System.Windows.Point(0, 1));
            normalBrush = new System.Windows.Media.LinearGradientBrush(System.Windows.Media.Colors.White, System.Windows.Media.Colors.Silver,
                                                                       new System.Windows.Point(0, 0), new System.Windows.Point(0, 1));

            highlightEffect             = new System.Windows.Media.Effects.DropShadowEffect();
            highlightEffect.ShadowDepth = 1.0;
            highlightEffect.Color       = System.Windows.Media.Colors.Silver;

            #endregion

            InitializeLabelMenu();
        }
        private void drawCoordinate(Joint joint, Color col)
        {
            Label text1 = new Label();

            text1.Content = "(" + joint.Position.X.ToString() + "," + joint.Position.Y.ToString() + "," + joint.Position.Z.ToString() + ")";

            ColorImagePoint point = kinect.MapSkeletonPointToColor(joint.Position, kinect.ColorStream.Format);

            double[] multiMargin1 = getMargin();
            text1.Margin     = new Thickness(multiMargin1[2] + multiMargin1[0] * point.X, multiMargin1[3] + multiMargin1[1] * point.Y, 0, 0);
            text1.FontSize   = 30;
            text1.Foreground = new SolidColorBrush(col);
            System.Windows.Media.Effects.DropShadowEffect dshadow = new System.Windows.Media.Effects.DropShadowEffect();
            text1.Effect     = dshadow;
            text1.FontFamily = new System.Windows.Media.FontFamily("Agency FB");
            canvas1.Children.Add(text1);
        }
Example #15
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Hoan_Xich_Huong;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot         = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.move_light         = ((System.Windows.Media.Animation.Storyboard)(this.FindName("move_light")));
     this.light_bottom       = ((System.Windows.Media.RadialGradientBrush)(this.FindName("light_bottom")));
     this.main_title         = ((System.Windows.Controls.TextBlock)(this.FindName("main_title")));
     this.title_shadow       = ((System.Windows.Media.Effects.DropShadowEffect)(this.FindName("title_shadow")));
     this.menu_mouse_enter_1 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_1")));
     this.menu_mouse_enter_2 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_2")));
     this.menu_mouse_enter_3 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_3")));
     this.menu_mouse_enter_4 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_4")));
     this.menu_mouse_enter_5 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_5")));
     this.menu_mouse_enter_6 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_6")));
     this.menu_mouse_enter_7 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_7")));
     this.menu_mouse_leave_1 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_1")));
     this.menu_mouse_leave_2 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_2")));
     this.menu_mouse_leave_3 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_3")));
     this.menu_mouse_leave_4 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_4")));
     this.menu_mouse_leave_5 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_5")));
     this.menu_mouse_leave_6 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_6")));
     this.menu_mouse_leave_7 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_7")));
     this.menu_bar           = ((System.Windows.Controls.Grid)(this.FindName("menu_bar")));
     this.trangchu           = ((System.Windows.Controls.Label)(this.FindName("trangchu")));
     this.solid1             = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid1")));
     this.clbhoanxichhuong   = ((System.Windows.Controls.Label)(this.FindName("clbhoanxichhuong")));
     this.solid2             = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid2")));
     this.hoidap             = ((System.Windows.Controls.Label)(this.FindName("hoidap")));
     this.solid3             = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid3")));
     this.tietnieu           = ((System.Windows.Controls.Label)(this.FindName("tietnieu")));
     this.solid4             = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid4")));
     this.video           = ((System.Windows.Controls.Label)(this.FindName("video")));
     this.solid5          = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid5")));
     this.tintuc          = ((System.Windows.Controls.Label)(this.FindName("tintuc")));
     this.solid6          = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid6")));
     this.lienhe          = ((System.Windows.Controls.Label)(this.FindName("lienhe")));
     this.solid7          = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid7")));
     this.viewer          = ((System.Windows.Controls.Grid)(this.FindName("viewer")));
     this.Grid3           = ((System.Windows.Controls.Grid)(this.FindName("Grid3")));
     this.under_textblock = ((System.Windows.Controls.TextBlock)(this.FindName("under_textblock")));
 }
Example #16
0
        void UpdateVisuals(NumericRect tile, int number)
        {
            int valueToShow = (int)Math.Pow(2, number);

            tile.Text = valueToShow.ToString();

            Tuple <Color, Color> selectedTuple;

            if (number > 0 && number <= this.theme.BackForeColorTuples.Count)
            {
                selectedTuple = this.theme.BackForeColorTuples[number - 1];
            }
            else
            {
                // Если соответствия номеру в базе не нашлось, то возвращаем первый элемент
                selectedTuple = this.theme.BackForeColorTuples[0];
            }

            tile.Background = new SolidColorBrush(selectedTuple.Item1);
            tile.Foreground = new SolidColorBrush(selectedTuple.Item2);

            // Определяем, нужен ли эффект блюра вокруг квадрата
            int lowerBlurBound = 7;
            int upperBlurBound = 11;

            if (number >= lowerBlurBound && number <= upperBlurBound)
            {
                // Вычисляем возможное число состояний, т.к. если границы 7 и 11, то состояний будет 5, а не 4
                int possibleStateCount = upperBlurBound - lowerBlurBound + 1;
                // Вычисляем номер текущего состояния. Если число равно 7, то его номер 1, т.к. иначе мы получим прозрачность 0
                int currentStateNum = number - lowerBlurBound + 1;

                double opacity = ((double)currentStateNum / possibleStateCount) * 1; // 1 - максимальная прозрачность

                System.Windows.Media.Effects.DropShadowEffect shadow =
                    new System.Windows.Media.Effects.DropShadowEffect();

                shadow.Opacity     = opacity;
                shadow.Color       = this.theme.BackForeColorTuples[number - 1].Item1; //selectedTuple.Item1;
                shadow.BlurRadius  = 15;
                shadow.ShadowDepth = 0;

                tile.Effect = shadow;
            }
        }
Example #17
0
        private void StackPanel_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            Grid      stt = (Grid)sender;
            Thickness th  = new Thickness(0, 10, 0, 10);

            stt.Background = Brushes.LightGray;
            stt.Height     = 110;
            stt.Margin     = th;

            try
            {
                System.Windows.Media.Effects.DropShadowEffect d = new System.Windows.Media.Effects.DropShadowEffect();
                d.ShadowDepth = 1;
                stt.Effect    = d;
            }
            catch (Exception ex)
            {
            }
        }
        private void chckBxAutoStart_Click(object sender, RoutedEventArgs e)
        {
            #region настройки Блюра
            System.Windows.Media.Effects.DropShadowEffect effect = new System.Windows.Media.Effects.DropShadowEffect();
            effect.Direction     = 180;
            effect.Opacity       = 100;
            effect.RenderingBias = System.Windows.Media.Effects.RenderingBias.Performance;
            effect.ShadowDepth   = 0;
            effect.Color         = Colors.BlanchedAlmond;
            #endregion

            if (chckBxAutoStart.IsChecked.Value)
            {
                effect.BlurRadius           = 10;
                groupBoxAutoStart.IsEnabled = true;
            }
            else
            {
                effect.BlurRadius           = 0;
                groupBoxAutoStart.IsEnabled = false;
            }
            btnShowNotif.Effect = effect;
        }
Example #19
0
 private void textBoxSelectionGlow(object sender, RoutedEventArgs e)
 {
     if (e.Source.GetType() == typeof(TextBox))
     {
         if (e.RoutedEvent.Name == "GotFocus")
         {
             var glowEffect = new System.Windows.Media.Effects.DropShadowEffect();
             Color color = (Color)ColorConverter.ConvertFromString("#4989FF");
             glowEffect.BlurRadius = 15;
             glowEffect.Color = color;
             glowEffect.Opacity = 0.3;
             glowEffect.ShadowDepth = 0;
             ((TextBox)e.Source).Effect = glowEffect;
         }
         if (e.RoutedEvent.Name == "LostFocus")
         {
             ((TextBox)e.Source).Effect = null;
         }
     }
 }
Example #20
0
        private void InitializeComponent()
        {
            AllowsTransparency    = true;
            Background            = Brushes.Transparent;
            WindowStyle           = System.Windows.WindowStyle.None;
            ResizeMode            = ResizeMode.CanMinimize;
            WindowStartupLocation = WindowStartupLocation.CenterOwner;

            Width     = 350;
            Height    = 200;
            MinWidth  = 204;
            MinHeight = 98;

            MainGrid = new Grid()
            {
                Background = Global.backgroundBrush,
                Margin     = new Thickness(-1)
            };

            MainGrid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            MainGrid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            });

            label = new Label();
            label.MouseDoubleClick += Maximize_Window;
            MainGrid.Children.Add(label);

            MinimizeButton = new Button()
            {
                Width      = 45,
                Background = Brushes.Transparent,
                Content    = new Border()
                {
                    SnapsToDevicePixels = true,
                    Height          = 10,
                    Width           = 12,
                    BorderBrush     = Brushes.White,
                    BorderThickness = new Thickness(0, 0, 0, 3)
                }
            };
            MinimizeButton.GotFocus += Button_GotFocus;
            MinimizeButton.Click    += Minimize_Window;

            MaximizeButton = new Button()
            {
                Width      = 45,
                Background = Brushes.Transparent,
                Content    = new Border()
                {
                    SnapsToDevicePixels = true,
                    Height          = 10, Width = 12,
                    BorderBrush     = Brushes.White,
                    BorderThickness = new Thickness(2, 3, 2, 2)
                }
            };
            MaximizeButton.GotFocus += Button_GotFocus;
            MaximizeButton.Click    += Maximize_Window;

            Button CloseButton = new Button()
            {
                Width      = 45,
                Background = Brushes.Transparent,
                Content    = new Path()
                {
                    SnapsToDevicePixels = false,
                    StrokeThickness     = 3,
                    Stroke = Brushes.White,
                    Data   = Geometry.Parse("M 0,0 L 12,12 M 0,12 L 12,0")
                }
            };

            CloseButton.GotFocus += Button_GotFocus;
            CloseButton.Click    += Close_Window;

            MainGrid.Children.Add(new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                Orientation         = Orientation.Horizontal,
                Height   = 25,
                Children = { MinimizeButton, MaximizeButton, CloseButton }
            });

            Icon = new Image()
            {
                IsHitTestVisible    = false,
                Margin              = new Thickness(2),
                Height              = 21,
                Width               = 21,
                VerticalAlignment   = VerticalAlignment.Top,
                HorizontalAlignment = HorizontalAlignment.Left,
                Source              = new BitmapImage(
                    new Uri("pack://application:,,,/icon.ico", UriKind.Absolute))
            };

            RenderOptions.SetBitmapScalingMode(Icon, BitmapScalingMode.Fant);

            MainGrid.Children.Add(Icon);

            MainGrid.Children.Add(new Rectangle()
            {
                VerticalAlignment = VerticalAlignment.Bottom,
                Margin            = new Thickness(0, -3, 0, -3),
                Height            = 3,
                Fill = new LinearGradientBrush(
                    Color.FromArgb(34, 0, 0, 0),
                    Color.FromArgb(0, 0, 0, 0), 90)
            });

            RootGrid = new Grid();
            Grid.SetRow(RootGrid, 1);
            MainGrid.Children.Add(RootGrid);

            Host = new Border()
            {
                BorderBrush     = new SolidColorBrush(Color.FromArgb(34, 0, 0, 0)),
                BorderThickness = new Thickness(1),
                Margin          = new Thickness(12),
                Child           = MainGrid
            };

            Effect = new System.Windows.Media.Effects.DropShadowEffect()
            {
                BlurRadius  = 7,
                Direction   = 270,
                Opacity     = 0.5,
                ShadowDepth = 0.5,
                Color       = Color.FromRgb(51, 51, 51)
            };

            Content = Host;
        }
Example #21
0
        public Bitmap Shadow(Bitmap src, Color color, int width, double opacity = 0.6f, double angle = 315)
        {
            Bitmap result = new Bitmap(src);

            #region Get DPI
            float dpiX = 96f;
            float dpiY = 96f;

            using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
            {
                dpiX = g.DpiX;
                dpiY = g.DpiY;
            }
            #endregion

            int offset = 4 * width;

            #region Create Effect
            var effect = new Media.Effects.DropShadowEffect();
            effect.BlurRadius  = width;
            effect.Color       = color.ToMediaColor();
            effect.Direction   = angle;
            effect.Opacity     = opacity;
            effect.ShadowDepth = width;

            //var effect = new Media.Effects.BlurEffect();
            //effect.Radius = 50;
            #endregion

            #region Draw source bitmap to DrawingVisual
            Media.DrawingVisual drawingVisual = new Media.DrawingVisual();

            drawingVisual.Effect = effect;
            using (var drawingContext = drawingVisual.RenderOpen())
            {
                System.Windows.Rect dRect = new System.Windows.Rect(2 * width, 2 * width, src.Width, src.Height);
                drawingContext.DrawImage(src.ToBitmapSource(), dRect);
                drawingContext.Close();
            }
            #endregion

            #region Render the DrawingVisual into a RenderTargetBitmap
            var rtb = new Media.Imaging.RenderTargetBitmap(
                src.Width + offset, src.Height + offset,
                dpiX, dpiY,
                Media.PixelFormats.Pbgra32);
            rtb.Render(drawingVisual);
            #endregion

            #region Create a System.Drawing.Bitmap
            var bitmap = new Bitmap(rtb.PixelWidth, rtb.PixelHeight, PixelFormat.Format32bppArgb);
            #endregion

            #region Copy the RenderTargetBitmap pixels into the bitmap's pixel buffer
            var pdata = bitmap.LockBits(
                new Rectangle(0, 0, bitmap.Width, bitmap.Height),
                ImageLockMode.WriteOnly,
                bitmap.PixelFormat);
            rtb.CopyPixels(System.Windows.Int32Rect.Empty,
                           pdata.Scan0, pdata.Stride * pdata.Height, pdata.Stride);
            bitmap.UnlockBits(pdata);
            #endregion

            #region Crop Transparent Area
            var rect = bitmap.ContentBound();
            result = new Bitmap(rect.Width, rect.Height, bitmap.PixelFormat);
            using (var g = Graphics.FromImage(result))
            {
                g.DrawImage(bitmap, 0, 0, rect, GraphicsUnit.Pixel);
            }
            #endregion

            return(result);
        }
        private void button_MouseEnter(object sender, MouseEventArgs e)
        {
            System.Windows.Media.Effects.DropShadowEffect outerGlowShadow = new System.Windows.Media.Effects.DropShadowEffect();
            outerGlowShadow.ShadowDepth = 0;
            outerGlowShadow.BlurRadius = 12;
            outerGlowShadow.Color = Colors.White;
            outerGlowShadow.Opacity = 0.7;

            ((FrameworkElement)sender).Effect = outerGlowShadow;
            ((FrameworkElement)((FrameworkElement)sender).Tag).Effect = ((FrameworkElement)sender).Effect;
        }
        private void UpdateLinks()
        {
            if (this.canv_links == null)
            {
                return;
            }
            if (this.links == null)
            {
                return;
            }
            if (this.links.Count == 0)
            {
                return;
            }

            this.canv_links.Children.Clear();

            int   counter     = 0;
            Point last_target = new Point(-1, -1);

            foreach (System.Windows.Media.Media3D.Point4D link in this.links)
            {
                double connecing_line_Y = Math.Max(link.Y, link.W) + VIS_SIZE;

                Line line_1 = new Line();
                line_1.X1 = link.X;
                line_1.Y1 = link.Y;
                line_1.X2 = line_1.X1;
                line_1.Y2 = connecing_line_Y;

                Line link_line = new Line();
                link_line.X1 = link.X;
                link_line.Y1 = connecing_line_Y;
                link_line.X2 = this.canv_comp_forest.ActualWidth + this.canv_middle_measure.ActualWidth + link.Z;
                link_line.Y2 = connecing_line_Y;

                Line line_2 = new Line();
                line_2.X1 = link_line.X2;
                line_2.Y1 = connecing_line_Y;
                line_2.X2 = line_2.X1;
                line_2.Y2 = link.W;

                if (line_2.X2 != last_target.X || line_2.Y2 != last_target.Y)
                {
                    last_target = new Point(line_2.X2, line_2.Y2);
                    counter++;
                }

                line_1.StrokeThickness    = 1;
                line_1.Stroke             = new SolidColorBrush(GenericTreeVisWindow.GetLinkColorFor(counter % 2));
                link_line.StrokeThickness = 1;
                link_line.Stroke          = new SolidColorBrush(GenericTreeVisWindow.GetLinkColorFor(counter % 2));
                line_2.StrokeThickness    = 1;
                line_2.Stroke             = new SolidColorBrush(GenericTreeVisWindow.GetLinkColorFor(counter % 2));

                System.Windows.Media.Effects.DropShadowEffect line_effect = new System.Windows.Media.Effects.DropShadowEffect
                {
                    Color       = GenericTreeVisWindow.GetLinkColorFor(counter % 2),
                    BlurRadius  = 3,
                    Direction   = 315,
                    ShadowDepth = 2,
                    Opacity     = 0.5
                };

                line_1.Effect    = line_effect;
                link_line.Effect = line_effect;
                line_2.Effect    = line_effect;

                this.canv_links.Children.Add(line_1);
                this.canv_links.Children.Add(link_line);
                this.canv_links.Children.Add(line_2);
            }
        }
Example #24
0
        private void initXps(int pages, Grid g)
        {
            cLeft.Background = Brushes.Black;
            cLeft.Margin = new Thickness(20, 80, 600, 80);
            cRight.Margin = new Thickness(600, 80, 20, 80);
            cRight.Background = Brushes.Black;
            cLeft.MouseLeftButtonUp += new MouseButtonEventHandler(btLeft_MouseLeftButtonUp);
            cRight.MouseLeftButtonUp += new MouseButtonEventHandler(btRight_MouseLeftButtonUp);
            g.Children.Add(cLeft);
            g.Children.Add(cRight);

            for (int i = pages; i > 0; i--)
            {
                System.Windows.Media.Effects.DropShadowEffect dse = new System.Windows.Media.Effects.DropShadowEffect();
                DocumentViewer dv = new DocumentViewer();
                dv.MouseMove += new MouseEventHandler(dv_MouseMove);
                //dv.MouseLeftButtonDown += new MouseButtonEventHandler(dv_MouseLeftButtonDown);
                dv.MouseLeftButtonUp += new MouseButtonEventHandler(dv_MouseLeftButtonUp);
                if (i == 1)
                {
                    dv.Margin = thCenter;
                    dse.BlurRadius = 24;
                    dse.Color = Colors.Violet;
                }
                else
                {
                    dv.Margin = cRight.Margin;
                    dse.Color = Colors.Wheat;
                    dse.BlurRadius = 16;
                }
                dv.Tag = i - 1;
                dv.Effect = dse;
                g.Children.Add(dv);
                if (dvArrs.Count == 0)
                    dvArrs.Add(dv);
                else
                    dvArrs.Insert(0, dv);
            }
            //g.MouseLeftButtonUp += new MouseButtonEventHandler(g_MouseLeftButtonUp);
        }
Example #25
0
        private void TreeViewDirectorys_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {


            WrapPanelFiles.Children.Clear();

            System.Windows.Media.Effects.DropShadowEffect ds = new System.Windows.Media.Effects.DropShadowEffect();
            ds.BlurRadius = 3;
            ds.ShadowDepth = 4;
            ds.Opacity = 0.5;
            ds.Direction = 240;

            TreeViewItem tvi = (TreeViewItem)e.NewValue;
            DirectoryInfo SelectedPath = (DirectoryInfo)tvi.Tag;
            FolderPath = SelectedPath.FullName;
            FileInfo[] files = SelectedPath.GetFiles("*.jpg", SearchOption.TopDirectoryOnly);


            foreach (FileInfo file in files)
            {
                
                Image image = new Image();
                image.Tag = file.FullName;
                image.Margin = new Thickness(5);
                image.Effect = ds;
                image.PreviewMouseDown += Image_PreviewMouseDown;
                //image.Width = 50;
                //image.Height = 50;
                image.Stretch = Stretch.Uniform;
                image.Source = (new ImageSourceConverter()).ConvertFromString(file.FullName) as ImageSource;

                WrapPanelFiles.Children.Add(image);

                //ListViewItem lvi = new ListViewItem();
                //lvi.Content = image;
                //ListViewFiles.Items.Add(lvi);
            }

            //TreeNode newSelected = e.Node;

            //ListViewFiles.Items.Clear();
            //DirectoryInfo nodeDirInfo = (DirectoryInfo)newSelected.Tag;
            //ListViewItem.ListViewSubItem[] subItems;
            //ListViewItem item = null;

            //foreach (DirectoryInfo dir in nodeDirInfo.GetDirectories())
            //{
            //    item = new ListViewItem(dir.Name, 0);
            //    subItems = new ListViewItem.ListViewSubItem[]
            //        {new ListViewItem.ListViewSubItem(item, "Directory"),
            // new ListViewItem.ListViewSubItem(item,
            //    dir.LastAccessTime.ToShortDateString())};
            //    item.SubItems.AddRange(subItems);
            //    listView1.Items.Add(item);
            //}
            //foreach (FileInfo file in nodeDirInfo.GetFiles())
            //{
            //    item = new ListViewItem(file.Name, 1);
            //    subItems = new ListViewItem.ListViewSubItem[]
            //        { new ListViewItem.ListViewSubItem(item, "File"),
            // new ListViewItem.ListViewSubItem(item,
            //    file.LastAccessTime.ToShortDateString())};

            //    item.SubItems.AddRange(subItems);
            //    listView1.Items.Add(item);
            //}

            //ListViewFiles.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Example #26
0
		void freqDot_MouseEnter(object sender, MouseEventArgs e)
		{
			var glowEffect = new System.Windows.Media.Effects.DropShadowEffect();
			Color color = (Color)ColorConverter.ConvertFromString("#00AAFF");
			glowEffect.BlurRadius = ((Ellipse)e.Source).Width;
			glowEffect.Color = color;
			glowEffect.Opacity = 0.5;
			glowEffect.ShadowDepth = 0;
			((Ellipse)e.Source).Effect = glowEffect;
		}
        private void drawCoordinate(Joint joint, Color col)
        {
            Label text1 = new Label();
            text1.Content = "(" + joint.Position.X.ToString() + "," + joint.Position.Y.ToString() + "," + joint.Position.Z.ToString() + ")";

            ColorImagePoint point = kinect.MapSkeletonPointToColor(joint.Position, kinect.ColorStream.Format);
            double[] multiMargin1 = getMargin();
            text1.Margin = new Thickness(multiMargin1[2] + multiMargin1[0] * point.X, multiMargin1[3] + multiMargin1[1] * point.Y, 0, 0);
            text1.FontSize = 30;
            text1.Foreground = new SolidColorBrush(col);
            System.Windows.Media.Effects.DropShadowEffect dshadow = new System.Windows.Media.Effects.DropShadowEffect();
            text1.Effect = dshadow;
            text1.FontFamily = new System.Windows.Media.FontFamily("Agency FB");
            canvas1.Children.Add(text1);
        }
Example #28
0
        private void AddNode(Graph.Node node)
        {
            VapeTeam.Psimulex.Core.Types.String s = new VapeTeam.Psimulex.Core.Types.String(rnd.Next(0, 100).ToString());
            var graphics = new Simulex.Graphics.Components.ScalarGraphics(s);
            graphics.IsHitTestVisible = true;

            Border b = new Border { Child = graphics, CornerRadius = new CornerRadius(10.0) };
            b.BorderBrush = new SolidColorBrush(Colors.LightBlue);
            b.Background = new LinearGradientBrush(Color.FromArgb(0xFF, 0x8B, 0xC4, 0xE0), Color.FromArgb(0xFF, 0xEF, 0xFA, 0xFF), 90);
            b.BorderBrush = new SolidColorBrush(Colors.Black);
            b.BorderThickness = new Thickness(0.5f);
            b.IsHitTestVisible = false;
            b.Tag = node;
            b.Opacity = 1.0;

            b.MinWidth = node.Size.Width;
            b.MinHeight = node.Size.Height;

            b.MouseEnter += new MouseEventHandler(b_MouseEnter);
            b.MouseLeave += new MouseEventHandler(b_MouseLeave);

            var eff = new System.Windows.Media.Effects.DropShadowEffect { BlurRadius = 5, Color = Colors.Black, ShadowDepth = 1, Opacity = 0.5 };
            b.Effect = eff;

            var uielem = AddElement(b, node.Position);
            nodesMap.Add(node, uielem);
            //Canvas.SetLeft(b, node.Position.X);
            //Canvas.SetTop(b, node.Position.Y);
        }
Example #29
0
        //private DocumentViewer GetNextDv(DocumentViewer dv, int k)
        //{
        //    if ((k > 0 && (int)dv.Tag < dvArrs.Count) || (k < 0 && (int)dv.Tag > 1))
        //    {
        //        return (DocumentViewer)dvArrs[(int)dv.Tag + k-1];
        //    }
        //    return null;
        //}
        private void AnLeft(int j)
        {
            if (dvArrs.Count > 0)
            {
                if (pDV == null)
                {
                    pDV = GetCurDv();
                }
                int iIndex = (int)pDV.Tag;
                DocumentViewer dvNext = null;
                if (pDV.Margin.Top < cLeft.Margin.Top - 5)
                {
                    if (iIndex >= dvArrs.Count - 1)
                    {
                        return;
                    }
                    dvNext = (DocumentViewer)dvArrs[iIndex + 1];
                }
                else
                {
                    dvNext = pDV;
                    pDV = (DocumentViewer)dvArrs[iIndex - 1];
                }
                System.Windows.Media.Animation.Storyboard sb = new System.Windows.Media.Animation.Storyboard();
                System.Windows.Media.Animation.ThicknessAnimation da2 = new System.Windows.Media.Animation.ThicknessAnimation(thCenter, cLeft.Margin, new Duration(TimeSpan.FromSeconds(2)));
                System.Windows.Media.Animation.ThicknessAnimation da6 = new System.Windows.Media.Animation.ThicknessAnimation(cRight.Margin, thCenter, new Duration(TimeSpan.FromSeconds(2)));

                System.Windows.Media.Animation.Storyboard.SetTarget(da2, pDV);
                System.Windows.Media.Animation.Storyboard.SetTargetProperty(da2, new PropertyPath(MarginProperty));
                sb.Children.Add(da2);

                System.Windows.Media.Animation.Storyboard.SetTarget(da6, dvNext);
                System.Windows.Media.Animation.Storyboard.SetTargetProperty(da6, new PropertyPath(MarginProperty));
                sb.Children.Add(da6);

                if (j > 0)
                {
                    sb.SpeedRatio = 4.0;
                }else
                    sb.SpeedRatio = 2.0;

                if (!Resources.Contains("ShowImagesLeftAn"))
                    Resources.Add("ShowImagesLeftAn", sb);

                sb.Completed+=new EventHandler(sbLeft_Completed);
                sb.Begin();

                Grid.SetZIndex(pDV, zindex++);
                Grid.SetZIndex(dvNext, zindex++);

                System.Windows.Media.Effects.DropShadowEffect dse1 = new System.Windows.Media.Effects.DropShadowEffect();
                System.Windows.Media.Effects.DropShadowEffect dse2 = new System.Windows.Media.Effects.DropShadowEffect();
                dse1.BlurRadius = 18;
                dse1.Color = Colors.Wheat;
                pDV.Effect = dse1;

                dse2.BlurRadius = 24;
                dse2.Color = Colors.Violet;
                dvNext.Effect = dse2;

                pDV = dvNext;
            }
        }
Example #30
0
        private void AnRight(int j)
        {
            if (dvArrs.Count > 0)
            {
                if (pDV == null)
                {
                    pDV = GetCurDv();
                }
                int iIndex = (int)pDV.Tag;

                DocumentViewer dvPre = null;
                if (pDV.Margin.Top < cRight.Margin.Top - 5)
                {
                    if (iIndex < 1)
                        return;
                    dvPre = (DocumentViewer)dvArrs[iIndex - 1];
                }
                else
                {
                    dvPre = pDV;
                    pDV = (DocumentViewer)dvArrs[iIndex + 1];
                }

                System.Windows.Media.Animation.ThicknessAnimation da2 = new System.Windows.Media.Animation.ThicknessAnimation(thCenter, cRight.Margin, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da3 = new System.Windows.Media.Animation.DoubleAnimation(pDV.Margin.Top, cRight.Margin.Top, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da4 = new System.Windows.Media.Animation.DoubleAnimation(pDV.Margin.Right, cRight.Margin.Right, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da5 = new System.Windows.Media.Animation.DoubleAnimation(pDV.Margin.Bottom, cRight.Margin.Bottom, new Duration(TimeSpan.FromSeconds(2)));

                System.Windows.Media.Animation.ThicknessAnimation da6 = new System.Windows.Media.Animation.ThicknessAnimation(dvPre.Margin, thCenter, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da7 = new System.Windows.Media.Animation.DoubleAnimation(dvPre.Margin.Top,pDV.Margin.Top, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da8 = new System.Windows.Media.Animation.DoubleAnimation(dvPre.Margin.Right,pDV.Margin.Right,new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da9 = new System.Windows.Media.Animation.DoubleAnimation(dvPre.Margin.Bottom, pDV.Margin.Bottom, new Duration(TimeSpan.FromSeconds(2)));

                System.Windows.Media.Animation.Storyboard sb = new System.Windows.Media.Animation.Storyboard();

                System.Windows.Media.Animation.Storyboard.SetTarget(da2, pDV);
                System.Windows.Media.Animation.Storyboard.SetTargetProperty(da2, new PropertyPath(MarginProperty));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da3, pDV);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da3, new PropertyPath(MarginProperty));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da4, pDV);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da4, new PropertyPath(MarginProperty));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da5, pDV);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da5, new PropertyPath(MarginProperty));

                System.Windows.Media.Animation.Storyboard.SetTarget(da6, dvPre);
                System.Windows.Media.Animation.Storyboard.SetTargetProperty(da6, new PropertyPath(MarginProperty));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da7, dvPre);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da7, new PropertyPath(MarginProperty));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da8, dvPre);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da8, new PropertyPath(MarginProperty));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da9, dvPre);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da9, new PropertyPath(MarginProperty));

                sb.Children.Add(da2);
                //sb.Children.Add(da3);
                //sb.Children.Add(da4);
                //sb.Children.Add(da5);
                sb.Children.Add(da6);
                //sb.Children.Add(da7);
                //sb.Children.Add(da8);
                //sb.Children.Add(da9);
                if (j > 0)
                {
                    sb.SpeedRatio = 4.0;
                }
                else
                    sb.SpeedRatio = 2.0;

                if (!Resources.Contains("ShowImagesRightAn"))
                    Resources.Add("ShowImagesRightAn", sb);

                sb.Completed += new EventHandler(sbRight_Completed);
                sb.Begin();

                Grid.SetZIndex(pDV, zindex++);
                Grid.SetZIndex(dvPre, zindex++);

                System.Windows.Media.Effects.DropShadowEffect dse1 = new System.Windows.Media.Effects.DropShadowEffect();
                System.Windows.Media.Effects.DropShadowEffect dse2 = new System.Windows.Media.Effects.DropShadowEffect();
                dse1.BlurRadius=18;
                dse1.Color=Colors.Wheat;
                pDV.Effect = dse1;

                dse2.BlurRadius=24;
                dse2.Color=Colors.Violet;
                dvPre.Effect = dse2;

                pDV = dvPre;
            }
        }
Example #31
0
        //Assign and display team name
        public void TeamDisplay( )
        {
            Team   team   = Globals.listOfTeams[Globals.currentTeam - 1];
            Random random = new Random();

            byte[] colorBytes = new byte[3];
            random.NextBytes(colorBytes);
            System.Windows.Media.Color randomColor = System.Windows.Media.Color.FromRgb(colorBytes[0], colorBytes[1], colorBytes[2]);

            //Team
            Label TeamNameLabel = new Label();

            TeamNameLabel.Name     = "TeamNameLabel";
            TeamNameLabel.Width    = 188;
            TeamNameLabel.Height   = 40;
            TeamNameLabel.FontSize = 20;
            TeamNameLabel.VerticalContentAlignment = VerticalAlignment.Center;
            TeamNameLabel.Content         = "Team " + Globals.listOfTeams[Globals.currentTeam - 1].getName();
            TeamNameLabel.Foreground      = new SolidColorBrush(Colors.Black);
            TeamNameLabel.Background      = new SolidColorBrush(randomColor);
            TeamNameLabel.BorderBrush     = System.Windows.Media.Brushes.Black;
            TeamNameLabel.BorderThickness = new Thickness(0, 1, 0, 1);

            Canvas.SetLeft(TeamNameLabel, 0);
            Canvas.SetTop(TeamNameLabel, TeamNameLabelPosition);
            Team_display.Children.Add(TeamNameLabel);

            //Members
            ImageBrush imgb = new ImageBrush();
            int        NumberOfLevel0Members = 0;
            int        NumberOfLevel1Members = 0;
            int        NumberOfLevel2Members = 0;
            int        pos = 0;
            TeamMember member;

            while ((member = team.getMember(pos++)) != null)
            {
                Label newMember = new Label();
                newMember.Name     = "TeamMember" + pos;
                newMember.Width    = 188;
                newMember.Height   = 30;
                newMember.FontSize = 16;
                newMember.VerticalContentAlignment = VerticalAlignment.Center;
                newMember.Foreground = new SolidColorBrush(Colors.Black);
                //newMember.Background = new SolidColorBrush(Colors.Aqua);
                newMember.BorderBrush = System.Windows.Media.Brushes.Black;
                switch (member.getTrainingLevel())
                {
                case 0:
                    newMember.Tag = "first_aid";
                    NumberOfLevel0Members++;
                    break;

                case 1:
                    newMember.Tag = "first_responder";
                    NumberOfLevel1Members++;
                    break;

                case 2:
                    newMember.Tag = "medicine";
                    NumberOfLevel2Members++;
                    break;
                }

                if (NumberOfLevel0Members >= NumberOfLevel1Members)
                {
                    imgb.ImageSource = new BitmapImage(new Uri(AbsolutePath + @"Icons\First_Aid2.png"));
                }
                else if (NumberOfLevel1Members >= NumberOfLevel0Members)
                {
                    imgb.ImageSource = new BitmapImage(new Uri(AbsolutePath + @"Icons\First_Responder2.png"));
                }
                else
                {
                    imgb.ImageSource = new BitmapImage(new Uri(AbsolutePath + @"Icons\Medicine2.png"));
                }

                newMember.Content = member.getName();
                Canvas.SetLeft(newMember, 0);
                Canvas.SetTop(newMember, TeamMemberPosition);
                LevelOfTraining(newMember);
                TeamMemberPosition += 30;
                Team_display.Children.Add(newMember);
            }

            TeamNameLabelPosition = TeamMemberPosition + 15;
            TeamMemberPosition   += 90;
            TeamNumberPosition++;

            System.Windows.Shapes.Rectangle r = new System.Windows.Shapes.Rectangle();
            r.Name   = "team_" + rectangleCtr++;
            r.Width  = shapeRadius * 2;
            r.Height = shapeRadius * 2;
            r.Stroke = new SolidColorBrush(Colors.Black);

            r.Fill = imgb;
            r.MouseLeftButtonDown += new MouseButtonEventHandler(team_MouseLeftButtonDown);
            r.MouseLeftButtonUp   += new MouseButtonEventHandler(team_MouseLeftButtonUp);
            r.MouseMove           += new MouseEventHandler(team_MouseMove);

            Label l = new Label();

            l.Content    = team.getName();
            l.Width      = shapeRadius * 2;
            l.Height     = shapeRadius * 2;
            l.Margin     = new Thickness(0);
            l.Padding    = new Thickness(0);
            l.FontWeight = FontWeights.DemiBold;
            System.Windows.Media.Effects.DropShadowEffect shadow = new System.Windows.Media.Effects.DropShadowEffect();
            shadow.ShadowDepth = 3;
            shadow.Direction   = 315;
            shadow.Opacity     = 1.0;
            shadow.BlurRadius  = 3;
            shadow.Color       = Colors.White;
            l.Effect           = shadow;

            switch (l.Content.ToString().Length)
            {
            case 1: l.FontSize = 28;
                break;

            case 2: l.FontSize = 24;
                break;

            case 3: l.FontSize = 20;
                break;

            case 4: l.FontSize = 16;
                break;

            case 5: l.FontSize = 12;
                break;

            case 6: l.FontSize = 12;
                break;

            default: l.FontSize = 16;
                break;
            }
            l.HorizontalContentAlignment = HorizontalAlignment.Center;
            l.VerticalContentAlignment   = VerticalAlignment.Center;
            l.IsHitTestVisible           = false;
            Canvas.SetTop(r, 0);
            Canvas.SetLeft(r, 0);
            Canvas.SetTop(l, 0);
            Canvas.SetLeft(l, 0);
            Map.Children.Add(r);
            Map.Children.Add(l);
            Globals.listOfTeams[Globals.currentTeam - 1].setRectangle(r);
            Globals.listOfTeams[Globals.currentTeam - 1].setLabel(l);

            label_Click();
        }
Example #32
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Hoan_Xich_Huong;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.move_light = ((System.Windows.Media.Animation.Storyboard)(this.FindName("move_light")));
     this.light_bottom = ((System.Windows.Media.RadialGradientBrush)(this.FindName("light_bottom")));
     this.main_title = ((System.Windows.Controls.TextBlock)(this.FindName("main_title")));
     this.title_shadow = ((System.Windows.Media.Effects.DropShadowEffect)(this.FindName("title_shadow")));
     this.menu_mouse_enter_1 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_1")));
     this.menu_mouse_enter_2 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_2")));
     this.menu_mouse_enter_3 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_3")));
     this.menu_mouse_enter_4 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_4")));
     this.menu_mouse_enter_5 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_5")));
     this.menu_mouse_enter_6 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_6")));
     this.menu_mouse_enter_7 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_enter_7")));
     this.menu_mouse_leave_1 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_1")));
     this.menu_mouse_leave_2 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_2")));
     this.menu_mouse_leave_3 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_3")));
     this.menu_mouse_leave_4 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_4")));
     this.menu_mouse_leave_5 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_5")));
     this.menu_mouse_leave_6 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_6")));
     this.menu_mouse_leave_7 = ((System.Windows.Media.Animation.Storyboard)(this.FindName("menu_mouse_leave_7")));
     this.menu_bar = ((System.Windows.Controls.Grid)(this.FindName("menu_bar")));
     this.trangchu = ((System.Windows.Controls.Label)(this.FindName("trangchu")));
     this.solid1 = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid1")));
     this.clbhoanxichhuong = ((System.Windows.Controls.Label)(this.FindName("clbhoanxichhuong")));
     this.solid2 = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid2")));
     this.hoidap = ((System.Windows.Controls.Label)(this.FindName("hoidap")));
     this.solid3 = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid3")));
     this.tietnieu = ((System.Windows.Controls.Label)(this.FindName("tietnieu")));
     this.solid4 = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid4")));
     this.video = ((System.Windows.Controls.Label)(this.FindName("video")));
     this.solid5 = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid5")));
     this.tintuc = ((System.Windows.Controls.Label)(this.FindName("tintuc")));
     this.solid6 = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid6")));
     this.lienhe = ((System.Windows.Controls.Label)(this.FindName("lienhe")));
     this.solid7 = ((System.Windows.Media.SolidColorBrush)(this.FindName("solid7")));
     this.viewer = ((System.Windows.Controls.Grid)(this.FindName("viewer")));
     this.Grid3 = ((System.Windows.Controls.Grid)(this.FindName("Grid3")));
     this.under_textblock = ((System.Windows.Controls.TextBlock)(this.FindName("under_textblock")));
 }
Example #33
0
        public Grid makeQuestionGrid(int number)
        {
            //intialize grid
            Grid question_grid = new Grid();

            question_grid.Name = "question_g_" + number;
            BrushConverter bc = new BrushConverter();

            question_grid.Background = (Brush)bc.ConvertFrom("#FFC2C6C9");
            question_grid.Margin     = new Thickness(10, 10, 10, 0);

            System.Windows.Media.Effects.DropShadowEffect shadowEffect = new System.Windows.Media.Effects.DropShadowEffect();
            shadowEffect.BlurRadius = 14;
            shadowEffect.Opacity    = 0.5;
            question_grid.Effect    = shadowEffect;

            grid_num            = new TextBlock();
            grid_num.Text       = "Question " + (number) + " :";
            grid_num.Foreground = Brushes.Black;
            question_grid.Children.Add(grid_num);

            //set cloumn
            ColumnDefinition col = new ColumnDefinition();

            col.Width = new GridLength(4, GridUnitType.Star);
            question_grid.ColumnDefinitions.Add(col);
            col       = new ColumnDefinition();
            col.Width = new GridLength();
            question_grid.ColumnDefinitions.Add(col);
            col       = new ColumnDefinition();
            col.Width = new GridLength(5, GridUnitType.Star);
            question_grid.ColumnDefinitions.Add(col);

            // textbox
            TextBox question_txt = new TextBox();

            question_txt.Margin       = new Thickness(10, 30, 10, 10);
            question_txt.Height       = 70;
            question_txt.FontSize     = 20;
            question_txt.TextWrapping = TextWrapping.Wrap;
            Grid.SetColumn(question_txt, 0);
            question_txt.Name = "question_txt_" + number;

            controls.Add(question_txt.Name, question_txt);

            question_grid.Children.Add(question_txt);


            //combobox

            ComboBox numOfAnmsers_cb = new ComboBox();

            numOfAnmsers_cb.Margin = new Thickness(10);
            numOfAnmsers_cb.Height = 30;
            Grid.SetColumn(numOfAnmsers_cb, 1);
            numOfAnmsers_cb.Name = "question_cb_" + number;

            for (int i = 2; i <= 5; i++)
            {
                numOfAnmsers_cb.Items.Add(i);
            }
            numOfAnmsers_cb.SelectionChanged += new SelectionChangedEventHandler(makeAnswersGrid);
            question_grid.Children.Add(numOfAnmsers_cb);
            controls.Add(numOfAnmsers_cb.Name, numOfAnmsers_cb);

            controls.Add(question_grid.Name, question_grid);

            return(question_grid);
        }
Example #34
0
        public void SetReserveList(List <ReserveViewItem> reserveList)
        {
            try
            {
                for (int i = 0; i < canvas.Children.Count; i++)
                {
                    if (canvas.Children[i] is Rectangle)
                    {
                        canvas.Children.RemoveAt(i--);
                    }
                }

                //0→50で塗りつぶしの不透明度が上がる
                int fillOpacity = Math.Min(EpgSetting.ReserveRectFillOpacity, 50) * 2;
                //50→100で枠の不透明度が下がる
                int strokeOpacity = Math.Min(100 - EpgSetting.ReserveRectFillOpacity, 50) * 2;
                //予約枠が色名指定のときは少し透過(0xA0)する
                Brush strokeNormal  = ColorDef.CustColorBrush(EpgSetting.ReserveRectColorNormal, EpgSetting.ContentCustColorList[17], 0xA0, strokeOpacity);
                Brush strokeNo      = ColorDef.CustColorBrush(EpgSetting.ReserveRectColorNo, EpgSetting.ContentCustColorList[18], 0xA0, strokeOpacity);
                Brush strokeNoTuner = ColorDef.CustColorBrush(EpgSetting.ReserveRectColorNoTuner, EpgSetting.ContentCustColorList[19], 0xA0, strokeOpacity);
                Brush strokeWarning = ColorDef.CustColorBrush(EpgSetting.ReserveRectColorWarning, EpgSetting.ContentCustColorList[20], 0xA0, strokeOpacity);
                Brush fillNormal    = ColorDef.CustColorBrush(EpgSetting.ReserveRectColorNormal, EpgSetting.ContentCustColorList[17], 0xA0, fillOpacity);
                Brush fillNo        = ColorDef.CustColorBrush(EpgSetting.ReserveRectColorNo, EpgSetting.ContentCustColorList[18], 0xA0, fillOpacity);
                Brush fillNoTuner   = ColorDef.CustColorBrush(EpgSetting.ReserveRectColorNoTuner, EpgSetting.ContentCustColorList[19], 0xA0, fillOpacity);
                Brush fillWarning   = ColorDef.CustColorBrush(EpgSetting.ReserveRectColorWarning, EpgSetting.ContentCustColorList[20], 0xA0, fillOpacity);
                var   blurEffect    = new System.Windows.Media.Effects.DropShadowEffect()
                {
                    BlurRadius = 10
                };
                blurEffect.Freeze();
                var dashArray = new DoubleCollection()
                {
                    2.5, 1.5
                };
                dashArray.Freeze();

                foreach (ReserveViewItem info in reserveList)
                {
                    Rectangle rect         = new Rectangle();
                    Rectangle fillOnlyRect = EpgSetting.ReserveRectFillWithShadow ? null : new Rectangle();
                    Rectangle fillRect     = fillOnlyRect ?? rect;

                    if (info.ReserveInfo.RecSetting.IsNoRec())
                    {
                        rect.Stroke   = strokeNo;
                        fillRect.Fill = fillNo;
                    }
                    else if (info.ReserveInfo.OverlapMode == 2)
                    {
                        rect.Stroke   = strokeNoTuner;
                        fillRect.Fill = fillNoTuner;
                    }
                    else if (info.ReserveInfo.OverlapMode == 1)
                    {
                        rect.Stroke   = strokeWarning;
                        fillRect.Fill = fillWarning;
                    }
                    else
                    {
                        rect.Stroke   = strokeNormal;
                        fillRect.Fill = fillNormal;
                    }

                    rect.Effect          = blurEffect;
                    rect.StrokeThickness = 3;
                    if (info.ReserveInfo.RecSetting.GetRecMode() == 4)
                    {
                        rect.StrokeDashArray = dashArray;
                        rect.StrokeDashCap   = PenLineCap.Round;
                    }
                    rect.Width                = info.Width;
                    rect.Height               = info.Height;
                    rect.IsHitTestVisible     = false;
                    fillRect.Width            = info.Width;
                    fillRect.Height           = info.Height;
                    fillRect.IsHitTestVisible = false;

                    Canvas.SetLeft(rect, info.LeftPos);
                    Canvas.SetTop(rect, info.TopPos);
                    Canvas.SetZIndex(rect, 10);
                    canvas.Children.Add(rect);

                    if (fillOnlyRect != null)
                    {
                        Canvas.SetLeft(fillOnlyRect, info.LeftPos);
                        Canvas.SetTop(fillOnlyRect, info.TopPos);
                        Canvas.SetZIndex(fillOnlyRect, 9);
                        canvas.Children.Add(fillOnlyRect);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #35
0
 private void play_MouseEnter(object sender, MouseEventArgs e)
 {
     System.Windows.Media.Effects.DropShadowEffect effect = new System.Windows.Media.Effects.DropShadowEffect();
     effect.ShadowDepth     = 15;
     ((Image)sender).Effect = effect;
 }
        private void button_MouseLeave(object sender, MouseEventArgs e)
        {
            System.Windows.Media.Effects.DropShadowEffect littleBlackShadow = new System.Windows.Media.Effects.DropShadowEffect();
            littleBlackShadow.ShadowDepth = 1;
            littleBlackShadow.BlurRadius = 1;
            littleBlackShadow.Opacity = 0.7;

            ((FrameworkElement)sender).Effect = littleBlackShadow;
            ((FrameworkElement)((FrameworkElement)sender).Tag).Effect = ((FrameworkElement)sender).Effect;
        }
Example #37
0
        private void AnLeft()
        {
            if (dvArrs.Count > 0)
            {
                if (pDV == null)
                {
                    pDV = GetCurDv();
                }
                int iIndex = (int)pDV.Tag;
                DocumentViewer dvNext = null;
                if (pDV.Margin.Top < cLeft.Margin.Top - 1)
                {
                    if (iIndex >= dvArrs.Count - 1)
                    {
                        return;
                    }
                    dvNext = (DocumentViewer)dvArrs[iIndex + 1];
                }
                else
                {
                    dvNext = pDV;
                    pDV = (DocumentViewer)dvArrs[iIndex - 1];
                }
                System.Windows.Media.Animation.ThicknessAnimation da2 = new System.Windows.Media.Animation.ThicknessAnimation(pDV.Margin, cLeft.Margin, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da2 = new System.Windows.Media.Animation.DoubleAnimation(pDV.Margin.Left, cLeft.Margin.Left, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da3 = new System.Windows.Media.Animation.DoubleAnimation(pDV.Margin.Top, cLeft.Margin.Top, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da4 = new System.Windows.Media.Animation.DoubleAnimation(pDV.Margin.Right, cLeft.Margin.Right, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da5 = new System.Windows.Media.Animation.DoubleAnimation(pDV.Margin.Bottom, cLeft.Margin.Bottom, new Duration(TimeSpan.FromSeconds(2)));
                System.Windows.Media.Animation.ThicknessAnimation da6 = new System.Windows.Media.Animation.ThicknessAnimation(dvNext.Margin, pDV.Margin, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da6 = new System.Windows.Media.Animation.DoubleAnimation(dvNext.Margin.Left, pDV.Margin.Left, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da7 = new System.Windows.Media.Animation.DoubleAnimation(dvNext.Margin.Top, pDV.Margin.Top, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da8 = new System.Windows.Media.Animation.DoubleAnimation(dvNext.Margin.Right, pDV.Margin.Right, new Duration(TimeSpan.FromSeconds(2)));
                //System.Windows.Media.Animation.DoubleAnimation da9 = new System.Windows.Media.Animation.DoubleAnimation(dvNext.Margin.Bottom, pDV.Margin.Bottom, new Duration(TimeSpan.FromSeconds(2)));

                System.Windows.Media.Animation.Storyboard sb = new System.Windows.Media.Animation.Storyboard();

                System.Windows.Media.Animation.Storyboard.SetTarget(da2, pDV);
                System.Windows.Media.Animation.Storyboard.SetTargetProperty(da2, new PropertyPath(MarginProperty));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da3, pDV);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da3, new PropertyPath("Margin.Top"));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da4, pDV);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da4, new PropertyPath("Margin.Right"));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da5, pDV);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da5, new PropertyPath("Margin.Bottom"));

                System.Windows.Media.Animation.Storyboard.SetTarget(da6, dvNext);
                System.Windows.Media.Animation.Storyboard.SetTargetProperty(da6, new PropertyPath(MarginProperty));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da7, dvNext);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da7, new PropertyPath("Margin.Top"));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da8, dvNext);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da8, new PropertyPath("Margin.Right"));
                //System.Windows.Media.Animation.Storyboard.SetTarget(da9, dvNext);
                //System.Windows.Media.Animation.Storyboard.SetTargetProperty(da9, new PropertyPath("Margin.Bottom"));

                sb.Children.Add(da2);
                //sb.Children.Add(da3);
                //sb.Children.Add(da4);
                //sb.Children.Add(da5);
                sb.Children.Add(da6);
                //sb.Children.Add(da7);
                //sb.Children.Add(da8);
                //sb.Children.Add(da9);

                //sb.SpeedRatio = 2.0;

                if (!Resources.Contains("ShowImagesLeftAn"))
                    Resources.Add("ShowImagesLeftAn", sb);

                sb.Begin();

                Grid.SetZIndex(pDV, zindex++);
                Grid.SetZIndex(dvNext, zindex++);

                System.Windows.Media.Effects.DropShadowEffect dse1 = new System.Windows.Media.Effects.DropShadowEffect();
                System.Windows.Media.Effects.DropShadowEffect dse2 = new System.Windows.Media.Effects.DropShadowEffect();
                dse1.BlurRadius = 18;
                dse1.Color = Colors.Wheat;
                pDV.Effect = dse1;

                dse2.BlurRadius = 24;
                dse2.Color = Colors.Violet;
                dvNext.Effect = dse2;

                pDV = null;
            }
        }
        public void SetGeocacheMarkers(List <MapControl.Marker> markers)
        {
            _geocacheMarkers.Clear();

            if (markers != null && markers.Count > 0)
            {
                System.Windows.Media.RadialGradientBrush rb1 = new RadialGradientBrush(Color.FromArgb(0xFF, 0x0C, 0x5A, 0xA6), Color.FromArgb(0x66, 0x0C, 0x5A, 0xA6));
                System.Windows.Media.RadialGradientBrush rb2 = new RadialGradientBrush(Color.FromArgb(0xFF, 0xFF, 0xAE, 0x00), Color.FromArgb(0x66, 0xFF, 0xAE, 0x00));
                System.Windows.Media.RadialGradientBrush rb3 = new RadialGradientBrush(Color.FromArgb(0xFF, 0xA6, 0x0C, 0x00), Color.FromArgb(0x66, 0xA6, 0x0C, 0x00));

                System.Windows.Media.Effects.DropShadowEffect effect = new System.Windows.Media.Effects.DropShadowEffect();
                effect.Color       = Colors.Black;
                effect.BlurRadius  = 3;
                effect.ShadowDepth = 2;

                foreach (var m in markers)
                {
                    Grid rootElement = new Grid();
                    rootElement.Height     = 34;
                    rootElement.Width      = 34;
                    rootElement.Margin     = new Thickness(-17, -34, 0, 0);
                    rootElement.Visibility = System.Windows.Visibility.Hidden;

                    if (m.ImagePath.Length > 0)
                    {
                        Image       imgElement = new Image();
                        BitmapImage bi3        = new BitmapImage();
                        bi3.BeginInit();
                        bi3.UriSource = new Uri(m.ImagePath);
                        bi3.EndInit();
                        imgElement.Stretch = Stretch.None;
                        imgElement.Source  = bi3;
                        rootElement.Children.Add(imgElement);
                    }
                    else
                    {
                        System.Windows.Shapes.Ellipse el = new Ellipse();
                        el.Width  = 34;
                        el.Height = 34;
                        int cnt = int.Parse(m.Tag.ToString());
                        if (cnt < 10)
                        {
                            el.Fill = rb1;
                        }
                        else if (cnt < 50)
                        {
                            el.Fill = rb2;
                        }
                        else
                        {
                            el.Fill = rb3;
                        }
                        el.StrokeThickness = 2;

                        TextBlock elT = new TextBlock();
                        elT.Foreground          = System.Windows.Media.Brushes.White;
                        elT.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                        elT.VerticalAlignment   = System.Windows.VerticalAlignment.Center;
                        elT.Text     = m.Tag.ToString();
                        elT.FontSize = 18;

                        /*
                         *                           <TextBlock.Effect>
                         *  <DropShadowEffect BlurRadius="3" Color="#C222" ShadowDepth="2" />
                         * </TextBlock.Effect>
                         *
                         */
                        elT.Effect = effect;

                        rootElement.Children.Add(el);
                        rootElement.Children.Add(elT);
                    }

                    rootElement.DataContext = m;
                    rootElement.MouseDown  += new MouseButtonEventHandler(rootElement_MouseDown);
                    _geocacheMarkers.Add(rootElement);
                }
            }
            tileCanvas.SetMassMarkers(_geocacheMarkers);
        }
        public void SetGeocacheMarkers(List<MapControl.Marker> markers)
        {
            _geocacheMarkers.Clear();

            if (markers != null && markers.Count > 0)
            {
                System.Windows.Media.RadialGradientBrush rb1 = new RadialGradientBrush(Color.FromArgb(0xFF, 0x0C, 0x5A, 0xA6), Color.FromArgb(0x66, 0x0C, 0x5A, 0xA6));
                System.Windows.Media.RadialGradientBrush rb2 = new RadialGradientBrush(Color.FromArgb(0xFF, 0xFF, 0xAE, 0x00), Color.FromArgb(0x66, 0xFF, 0xAE, 0x00));
                System.Windows.Media.RadialGradientBrush rb3 = new RadialGradientBrush(Color.FromArgb(0xFF, 0xA6, 0x0C, 0x00), Color.FromArgb(0x66, 0xA6, 0x0C, 0x00));

                System.Windows.Media.Effects.DropShadowEffect effect = new System.Windows.Media.Effects.DropShadowEffect();
                effect.Color = Colors.Black;
                effect.BlurRadius = 3;
                effect.ShadowDepth = 2;

                foreach (var m in markers)
                {
                    Grid rootElement = new Grid();
                    rootElement.Height = 34;
                    rootElement.Width = 34;
                    rootElement.Margin = new Thickness(-17, -34, 0, 0);
                    rootElement.Visibility = System.Windows.Visibility.Hidden;

                    if (m.ImagePath.Length > 0)
                    {
                        Image imgElement = new Image();
                        BitmapImage bi3 = new BitmapImage();
                        bi3.BeginInit();
                        bi3.UriSource = new Uri(m.ImagePath);
                        bi3.EndInit();
                        imgElement.Stretch = Stretch.None;
                        imgElement.Source = bi3;
                        rootElement.Children.Add(imgElement);
                    }
                    else
                    {
                        System.Windows.Shapes.Ellipse el = new Ellipse();
                        el.Width = 34;
                        el.Height = 34;
                        int cnt = int.Parse(m.Tag.ToString());
                        if (cnt < 10)
                        {
                            el.Fill = rb1;
                        }
                        else if (cnt < 50)
                        {
                            el.Fill = rb2;
                        }
                        else
                        {
                            el.Fill = rb3;
                        }
                        el.StrokeThickness = 2;

                        TextBlock elT = new TextBlock();
                        elT.Foreground = System.Windows.Media.Brushes.White;
                        elT.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                        elT.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                        elT.Text = m.Tag.ToString();
                        elT.FontSize = 18;

                        /*
                         *                           <TextBlock.Effect>
                            <DropShadowEffect BlurRadius="3" Color="#C222" ShadowDepth="2" />
                          </TextBlock.Effect>

                         */
                        elT.Effect = effect;

                        rootElement.Children.Add(el);
                        rootElement.Children.Add(elT);
                    }

                    rootElement.DataContext = m;
                    rootElement.MouseDown += new MouseButtonEventHandler(rootElement_MouseDown);
                    _geocacheMarkers.Add(rootElement);
                }
            }
            tileCanvas.SetMassMarkers(_geocacheMarkers);
        }