/// <summary>
 /// 加载双层窗口的样式
 /// </summary>
 private void InitializeWindowStyle()
 {
     _shadowWindow = new ShadowWindow();
     Dispatcher.BeginInvoke(new Action <UIElement>(x =>
     {
         Thread.Sleep(70);
         _shadowWindow.Left = this.Left - 30;
         _shadowWindow.Top  = this.Top - 30;
         ShadowWindowVisibility(true); //初始化
         Owner = _shadowWindow;        //绑定阴影窗体
         Activate();
     }), DispatcherPriority.ApplicationIdle, this);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 加载双层窗口的样式
        /// </summary>
        private void InitializeWindowStyle()
        {
            _shadowWindow = new ShadowWindow();
            Dispatcher.BeginInvoke(new Action <UIElement>(x =>
            {
                Thread.Sleep(70);
                _shadowWindow.Left = this.Left - 30;
                _shadowWindow.Top  = this.Top - 30;
                ShadowWindowVisibility(true); //初始化
                Owner = _shadowWindow;        //绑定阴影窗体
                Activate();
            }), DispatcherPriority.ApplicationIdle, this);

            ResourceDictionary dic = new ResourceDictionary {
                Source = new Uri(packButtonUri, UriKind.Relative)
            };

            Resources.MergedDictionaries.Add(dic);

            Style = (Style)dic["MainWindow"];
        }
Exemplo n.º 3
0
        private void OpenWindowMode()
        {
            ReadWindowMode();
            //根据系统加载模式
            if (DMWindowMode == WindowMode.Auto)
            {
                Version vs = Environment.OSVersion.Version;
                Version compareToVersion = new Version("6.2");
                //WIN8+
                if (vs >= compareToVersion)
                {
                    //OS版本号的主要版本号
                    //Debug.WriteLine("Major:{0}", vs.Major + "." + vs.Minor);
                    DMWindowMode = WindowMode.TwoWindow;
                }
                //WIN7-
                else
                {
                    DMWindowMode = WindowMode.OneWindow;
                }
            }

            if (DMWindowMode == WindowMode.OneWindow)
            {
                AllowsTransparency = true;
                WindowStyle        = WindowStyle.None;
                Background         = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
                InitializeWindowStyle(OnepackUri);
            }
            else if (DMWindowMode == WindowMode.TwoWindow)
            {
                _shadowWindow = new ShadowWindow();
                ShadowWindowVisibility(true); //初始化
                Owner = _shadowWindow;        //绑定阴影窗体
                InitializeWindowStyle(TwopackUri);
            }
        }