예제 #1
0
        public Set()
        {
            InitializeComponent();

            WindowBlur.SetIsEnabled(this, true);
            WindowXCaption.SetForeground(this, MainWindow.brush);

            //刷新窗口前景色
            updateUI();
            Timer timer = new Timer();

            timer          = new Timer(1000);
            timer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
            timer.Enabled  = true;


            if (WindowXCaption.GetHeight(MainWindow.windowMain) == 0)
            {
                GD.IsChecked = true;
            }
            if (MainWindow.windowMain.fx)
            {
                GT.IsChecked = true;
            }
            if (MainWindow.wherefind != "全国")
            {
                WHERE.Text = MainWindow.wherefind;
            }
            TIME.Text     = MainWindow.times.ToString();
            TOP.IsChecked = MainWindow.top;
        }
예제 #2
0
        private UIElement CreatePreviewView(WindowX view, object content)
        {
            var contentControl = new ContentControl()
            {
                Foreground = view.Foreground,
                Content    = content,
            };
            var grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(view.DisableDragMove ? 0 : WindowXCaption.GetHeight(view))
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Star)
            });
            grid.Children.Add(new Border()
            {
                Background = WindowXCaption.GetBackground(view),
                Child      = new ContentControl()
                {
                    Content         = view.DataContext is Window ? "" : view.DataContext,
                    ContentTemplate = WindowXCaption.GetHeaderTemplate(view),
                }
            });
            Grid.SetRow(contentControl, 1);
            grid.Children.Add(contentControl);
            var border = new Border()
            {
                Background      = view.Background,
                BorderBrush     = view.BorderBrush ?? Brushes.Gray,
                BorderThickness = view.BorderThickness.Left == 0 ? new Thickness(1) : view.BorderThickness,
                Width           = view.Width,
                Height          = view.Height,
                Child           = grid,
            };

            return(border);
        }