Ejemplo n.º 1
0
 public void ReloadColorfulConfig()
 {
     GaoSiRadius       = AyWindowShellConfigSetting.GetXmlValue("Gaosi").ToDouble();
     RectangleOpacity1 = AyWindowShellConfigSetting.GetXmlValue("RecOpa1").ToDouble();
     RectangleOpacity2 = AyWindowShellConfigSetting.GetXmlValue("RecOpa2").ToDouble();
     RectangleOpacity3 = AyWindowShellConfigSetting.GetXmlValue("RecOpa3").ToDouble();
 }
Ejemplo n.º 2
0
        public void GetWindowBackgroundConfig()
        {
            string thememode = AyWindowShellConfigSetting.GetXmlValue("themeMode");
            var    bgFolder  = AyWindowShellConfigSetting.GetXmlValue("bgFolder", "value");//图片文件夹

            if (thememode == "img")
            {
                var path = AyWindowShellConfigSetting.GetXmlValue("skinBg", "value");
                if (path.IndexOf(":") < 0)
                {
                    path = System.IO.Path.Combine(bgFolder, path);
                }

                p                 = new AyTransitionPicture(path);
                p.Radius          = CornerRadius.TopLeft;
                p.StrokeThickness = BorderThickness.Top;
                p.Stroke          = BorderBrush;
                this.BgData       = p;
                ReLoadImageBmp(path);
            }
            else if (thememode == "color")
            {
                var path = AyWindowShellConfigSetting.GetXmlValue("skinColorBg", "value");
                p                 = new AyTransitionColor(path);
                p.Radius          = CornerRadius.TopLeft;
                p.StrokeThickness = BorderThickness.Top;
                p.Stroke          = BorderBrush;
                this.BgData       = p;
            }
        }
Ejemplo n.º 3
0
        private void UpdateImage()
        {
            string thememode = AyWindowShellConfigSetting.GetXmlValue("themeMode");

            if (thememode == "img")
            {
                if (AyCommon.ISXP)
                {
                }
                else
                {
                    if (Bmp != null)
                    {
                        CopyMemory(ImagePointer, ImageCopyPointer, DataLength);             // 需要恢复原始的图像数据,不然模糊就会叠加了。
                        System.Drawing.Rectangle Rect = new System.Drawing.Rectangle(0, 0, Bmp.Width, Bmp.Height);
                        Bmp.GaussianBlur(ref Rect, (float)GaoSiRadius, false);
                        //Bmp.UsmSharpen(ref Rect,(float)GaoSiRadius, (float)usmSlider.Value);//暂时不支持
                        BitmapSource bs = AyFuncBitmapWithWpf.Instance.GetBitmapSource(Bmp);
                        ImageBrush   ib = new ImageBrush(bs);
                        if (this.BgData != null)
                        {
                            ib.Stretch     = BackgroundStretch;
                            ib.AlignmentX  = AlignmentX.Left;
                            ib.AlignmentY  = AlignmentY.Top;
                            BgData.ImBrush = ib;
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        //public Grid ayLayerAboveArea = null;

        #region 为元素注册事件
        public override void OnApplyTemplate()
        {
            ControlTemplate baseWindowTemplate = this.Template;

            this.StateChanged += AyWindowShellNew_StateChanged;
            TransitionPresenter tp = (TransitionPresenter)baseWindowTemplate.FindName("tpMainImage", this);

            if (tp != null)
            {
                int a;
                if (int.TryParse(AyWindowShellConfigSetting.GetXmlValue("skinSwitchAnimation"), out a))
                {
                    tp.Transition = AyTransitionGetter.AyTransitionOneWay()[a];
                }
                else
                {
                    tp.Transition = AyTransitionGetter.AyTransitionOneWay()[16];
                }
            }

            Button skinBtn = (Button)baseWindowTemplate.FindName("PART_SKIN", this);

            if (skinBtn != null)
            {
                skinBtn.Click += delegate
                {
                    if (SkinWindowMethodOverride != null)
                    {
                        SkinWindowMethodOverride();
                    }
                    else
                    {
                        OpenSkinWindowShow();
                    }
                };
            }
            Button closeBtn = (Button)baseWindowTemplate.FindName("PART_CLOSE", this);

            if (closeBtn != null)
            {
                closeBtn.Click += delegate
                {
                    try
                    {
                        if (CloseWindowMethodOverride != null)
                        {
                            CloseWindowMethodOverride();
                        }
                        else
                        {
                            DoCloseWindow();
                        }
                    }
                    catch
                    {
                    }
                };
            }


            Button minBtn = (Button)baseWindowTemplate.FindName("PART_MIN", this);

            if (minBtn != null)
            {
                minBtn.Click += delegate
                {
                    if (MinWindowMethodOverride != null)
                    {
                        MinWindowMethodOverride();
                    }
                    else
                    {
                        DoMinWindow();
                    }
                };
            }

            Button maxBtn = (Button)baseWindowTemplate.FindName("PART_MAX", this);

            if (maxBtn != null)
            {
                maxBtn.Click += delegate
                {
                    if (MaxWindowMethodOverride != null)
                    {
                        MaxWindowMethodOverride();
                    }
                    else
                    {
                        DoRestoreOrMax();
                    }
                };
            }

            Button menuWindow = (Button)baseWindowTemplate.FindName("PART_MENU", this);

            if (menuWindow != null)
            {
                if (WindowMenu != null)
                {
                    WindowMenuVisibility       = Visibility.Visible;
                    WindowMenu.Placement       = PlacementMode.Bottom;
                    WindowMenu.PlacementTarget = menuWindow;
                }

                menuWindow.Click += delegate
                {
                    if (MenuWindowMethodOverride != null)
                    {
                        MenuWindowMethodOverride();
                    }
                    else
                    {
                        ShowWindowMenu();
                    }
                };
            }

            Button restoreBtn = (Button)baseWindowTemplate.FindName("restoreWindow", this);

            if (restoreBtn != null)
            {
                restoreBtn.Click += delegate
                {
                    if (MaxWindowMethodOverride != null)
                    {
                        MaxWindowMethodOverride();
                    }
                    else
                    {
                        DoRestoreOrMax();
                    }
                };
            }
            AllCP = (ContentPresenter)baseWindowTemplate.FindName("AllCP", this);

            ayLayerArea      = (Grid)baseWindowTemplate.FindName("AyLayerArea", this);
            ayLayerAboveArea = (Grid)baseWindowTemplate.FindName("AyLayerAboveArea", this);
            AyWindowMaskArea = GetTemplateChild("AyWindowMaskArea") as Rectangle;

            if (this.WindowState == WindowState.Normal)
            {
                restoreWindowVisibility = Visibility.Collapsed;
                maxWindowVisibility     = Visibility.Visible;
            }
            else
            {
                restoreWindowVisibility = Visibility.Visible;
                maxWindowVisibility     = Visibility.Collapsed;
            }



            if (WindowState == WindowState.Maximized)
            {
            }
            if (p != null)
            {
                p.Radius          = CornerRadius.TopLeft;
                p.StrokeThickness = BorderThickness.Top;
                p.Stroke          = BorderBrush;
                this.BgData       = p;
            }

            AyBackgroundBehindLayer = (Border)baseWindowTemplate.FindName("AyBackgroundBehindLayer", this);
            AyBackgroundLayer       = (Border)baseWindowTemplate.FindName("AyBackgroundLayer", this);
        }