Ejemplo n.º 1
0
        public DashboardWindow()
        {
            InitializeComponent();

            vm = new DashboardWindowViewModel(this, OnClosing);
            this.DataContext = vm;
        }
Ejemplo n.º 2
0
 public DashboardWindow(Session session)
 {
     InitializeComponent();
     this.session = session;
     this.session.Appearance.RegisterDependency(this);
     viewModel   = new DashboardWindowViewModel(session);
     DataContext = viewModel;
 }
Ejemplo n.º 3
0
        public DashboardWindow()
            : base(new DashboardWindowViewModel())
        {
            InitializeComponent();

            this.viewModel = (DashboardWindowViewModel)this.ViewModel;

            this.Initialize(this.StatusBar);
        }
        public DashboardWindow()
            : base(new DashboardWindowViewModel())
        {
            InitializeComponent();

            this.viewModel = (DashboardWindowViewModel)this.ViewModel;

            this.Initialize(this.StatusBar);

            if (ChannelSession.AppSettings.DashboardWidth > 0)
            {
                this.WindowStartupLocation = WindowStartupLocation.Manual;
                this.Height             = ChannelSession.AppSettings.DashboardHeight;
                this.Width              = ChannelSession.AppSettings.DashboardWidth;
                this.Top                = ChannelSession.AppSettings.DashboardTop;
                this.Left               = ChannelSession.AppSettings.DashboardLeft;
                this.viewModel.IsPinned = ChannelSession.AppSettings.IsDashboardPinned;
                RefreshPin();

                var rect   = new System.Drawing.Rectangle((int)this.Left, (int)this.Top, (int)this.Width, (int)this.Height);
                var screen = System.Windows.Forms.Screen.FromRectangle(rect);
                if (!screen.Bounds.Contains(rect))
                {
                    // Off the bottom of the screen?
                    if (this.Top + this.Height > screen.Bounds.Top + screen.Bounds.Height)
                    {
                        this.Top = screen.Bounds.Top + screen.Bounds.Height - this.Height;
                    }

                    // Off the right side of the screen?
                    if (this.Left + this.Width > screen.Bounds.Left + screen.Bounds.Width)
                    {
                        this.Left = screen.Bounds.Left + screen.Bounds.Width - this.Width;
                    }

                    // Off the top of the screen?
                    if (this.Top < screen.Bounds.Top)
                    {
                        this.Top = screen.Bounds.Top;
                    }

                    // Off the left side of the screen?
                    if (this.Left < screen.Bounds.Left)
                    {
                        this.Left = screen.Bounds.Left;
                    }
                }

                if (ChannelSession.AppSettings.IsMaximized)
                {
                    WindowState = WindowState.Maximized;
                }
            }
        }