예제 #1
0
        public WindowViewModel(Window window)
        {
            this.window = window;

            //On window state change handdler
            window.StateChanged += (sender, e) => {
                OnPropertyChanged(nameof(BorderResizeThickness));
                OnPropertyChanged(nameof(CornerRadius));
                OnPropertyChanged(nameof(OutherMarginThickness));
            };

            //Set on connection changed handlers
            UnitOfWork.AddConnectionChangedHandler((s, a) => OnConnectionChanged(s, a));
            ConnectedToServer = UnitOfWork.ServerConnected;

            //commands for buttons
            CloseWindow = new RelayCommand(() => {
                window.Close();
            });
            ColapseWindow = new RelayCommand(() =>
            {
                window.WindowState = WindowState.Minimized;
            });
            MaximazeWindow = new RelayCommand(() =>
            {
                window.WindowState ^= WindowState.Maximized;
            });

            //Fix windew resize Issue
            var resizer = new WindowResizer(window);
        }