private async void _settingVM_Deactivated(object sender, DeactivationEventArgs e)
        {
            _settingVM.Deactivated -= _settingVM_Deactivated;
            bool ok = _settingVM.DialogResult;

            if (ok)
            {
                await AppManager.ReApplySetting();

                await _eventAggregator.PublishOnUIThreadAsync(new SettingSaved());
            }
            _settingVM = null;
        }
Exemple #2
0
        private async void _settingVM_Deactivated(object sender, DeactivationEventArgs e)
        {
            _settingVM.Deactivated -= _settingVM_Deactivated;
            bool ok = _settingVM.DialogResult;

            if (ok)
            {
                var config = await JsonHelper.JsonDeserializeFromFileAsync <SettingObject>(AppManager.SettingPath);

                await AppManager.ApplySetting(config);

                await _eventAggregator.PublishOnUIThreadAsync(new SettingSaved());
            }
            _settingVM = null;
        }
        public void Config(object owner)
        {
            if (_settingVM != null)
            {
                return;
            }

            _settingVM              = IoC.Get <SettingViewModel>();
            _settingVM.Deactivated += _settingVM_Deactivated;
            dynamic windowSettings = new ExpandoObject();

            if (owner == null)
            {
                windowSettings.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            }
            else
            {
                windowSettings.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                windowSettings.Owner = owner;
            }
            _windowManager.ShowWindow(_settingVM, null, windowSettings);
        }