예제 #1
0
        private void FullWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            Trace.WriteLine("FullWindow FullWindow_Closing");

            Instance = null;
            _viewModel.Close();
        }
예제 #2
0
        public FullWindow(MainViewModel viewModel)
        {
            Instance = this;

            _viewModel               = new FullWindowViewModel(viewModel);
            _viewModel.AppExpanded  += (_, e) => AppPopup.PositionAndShow(this, e);
            _viewModel.AppCollapsed += (_, __) => AppPopup.HideWithAnimation();

            InitializeComponent();

            AppPopup.Closed += (_, __) => _viewModel.CollapseApp();
            LocationChanged += (_, __) => _viewModel.CollapseApp();
            SizeChanged     += (_, __) => _viewModel.CollapseApp();
            DataContext      = _viewModel;

            PreviewKeyDown += FullWindow_PreviewKeyDown;

            this.FlowDirection = SystemSettings.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;

            Instance = this;
            Closing += (s, e) =>
            {
                Instance = null;
                _viewModel.Close();
            };

            SourceInitialized += (_, __) =>
            {
                this.Cloak();
                AccentPolicyLibrary.SetWindowBlur(this, true, true);
            };

            Microsoft.Win32.SystemEvents.DisplaySettingsChanged += (s, e) => Dispatcher.BeginInvoke((Action)(() => _viewModel.CollapseApp()));
        }
예제 #3
0
        public static void ActivateSingleInstance()
        {
            if (Instance == null)
            {
                var window = new FullWindow(MainViewModel.Instance);

                window.Show();
                WindowAnimationLibrary.BeginWindowEntranceAnimation(window, () => { });
            }
            else
            {
                Instance.RaiseWindow();
            }
        }
예제 #4
0
        public static void ActivateSingleInstance(MainViewModel mainViewModel)
        {
            Trace.WriteLine("FullWindow ActivateSingleInstance");
            if (Instance == null)
            {
                var window = new FullWindow(mainViewModel);

                window.Show();
                WindowAnimationLibrary.BeginWindowEntranceAnimation(window, () => { });
            }
            else
            {
                Instance.RaiseWindow();
            }
        }
예제 #5
0
        public FullWindow(MainViewModel viewModel)
        {
            Trace.WriteLine("FullWindow .ctor");
            Instance = this;

            InitializeComponent();

            _viewModel               = new FullWindowViewModel(viewModel);
            _viewModel.AppExpanded  += ViewModel_AppExpanded;
            _viewModel.AppCollapsed += ViewModel_AppCollapsed;

            AppPopup.Closed   += AppPopup_Closed;
            SourceInitialized += FullWindow_SourceInitialized;
            LocationChanged   += FullWindow_LocationChanged;
            SizeChanged       += FullWindow_SizeChanged;
            PreviewKeyDown    += FullWindow_PreviewKeyDown;
            Closing           += FullWindow_Closing;
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;

            DataContext = _viewModel;

            this.FlowDirection = SystemSettings.IsRTL ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
        }