public override void Initialize(IConfig config) { // Prepare disposables _disposables?.Dispose(); _disposables = new CompositeDisposable(); // Place this under the Ui parent ParentId = nameof(ConfigIds.Destinations); // Make sure Commit/Rollback is called on the IUiConfiguration config.Register(CoreConfiguration); // automatically update the DisplayName var greenshotLanguageBinding = GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsDestinationPicker)); // Make sure the greenshotLanguageBinding is disposed when this is no longer active _disposables.Add(greenshotLanguageBinding); UsedDestinations.Clear(); if (CoreConfiguration.PickerDestinations.Any()) { foreach (var outputDestination in CoreConfiguration.PickerDestinations) { var pickerDestination = AllDestinations .Where(destination => !"Picker".Equals(destination.Metadata.Designation)) .Where(destination => destination.Value.IsActive) .Where(destination => outputDestination == destination.Value.Designation) .Select(d => d.Value).FirstOrDefault(); if (pickerDestination != null) { UsedDestinations.Add(pickerDestination); } } } else { foreach (var pickerDestination in AllDestinations .Where(destination => !"Picker".Equals(destination.Metadata.Designation)) .Where(destination => destination.Value.IsActive) .OrderBy(destination => destination.Metadata.Priority) .ThenBy(destination => destination.Value.Description) .Select(d => d.Value)) { UsedDestinations.Add(pickerDestination); } } AvailableDestinations.Clear(); foreach (var destination in AllDestinations .Where(destination => !"Picker".Equals(destination.Metadata.Designation)) .Where(destination => destination.Value.IsActive) .Where(destination => UsedDestinations.All(pickerDestination => pickerDestination.Designation != destination.Value.Designation)) .OrderBy(destination => destination.Metadata.Priority).ThenBy(destination => destination.Value.Description) .Select(d => d.Value)) { AvailableDestinations.Add(destination); } base.Initialize(config); }
public DestinationsConfigNodeViewModel(IGreenshotLanguage greenshotLanguage) { GreenshotLanguage = greenshotLanguage; // automatically update the DisplayName GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsDestination)); // automatically update the DisplayName CanActivate = false; Id = nameof(ConfigIds.Destinations); }
public CaptureConfigNode(IGreenshotLanguage greenshotLanguage) { GreenshotLanguage = greenshotLanguage; // automatically update the DisplayName GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsCapture)); // automatically update the DisplayName CanActivate = false; Id = nameof(ConfigIds.Capture); }
public override void Initialize(IConfig config) { // Prepare disposables _disposables?.Dispose(); // Place this under the Ui parent ParentId = nameof(ConfigIds.InternalDestinations); // Make sure Commit/Rollback is called on the IUiConfiguration config.Register(CoreConfiguration); // automatically update the DisplayName _disposables = new CompositeDisposable { GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsDestinationPicker)) }; UsedDestinations.Clear(); if (CoreConfiguration.PickerDestinations.Any()) { foreach (var outputDestination in CoreConfiguration.PickerDestinations) { var pickerDestination = _destinationHolder.SortedActiveDestinations .Where(destination => !"Picker".Equals(destination.Designation)) .FirstOrDefault(destination => outputDestination == destination.Designation); if (pickerDestination != null) { UsedDestinations.Add(pickerDestination); } } } else { foreach (var pickerDestination in _destinationHolder.SortedActiveDestinations .Where(destination => !"Picker".Equals(destination.Designation))) { UsedDestinations.Add(pickerDestination); } } AvailableDestinations.Clear(); foreach (var destination in _destinationHolder.SortedActiveDestinations .Where(destination => !"Picker".Equals(destination.Designation)) .Where(destination => UsedDestinations.All(pickerDestination => pickerDestination.Designation != destination.Designation))) { AvailableDestinations.Add(destination); } base.Initialize(config); }
public ConfigViewModel( [ImportMany] IEnumerable <Lazy <IConfigScreen> > configScreens, IGreenshotLanguage greenshotLanguage, IConfigTranslations configTranslations) { ConfigScreens = configScreens; GreenshotLanguage = greenshotLanguage; ConfigTranslations = configTranslations; // automatically update the DisplayName GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsTitle)); // TODO: Check if we need to set the current language (this should update all registered OnPropertyChanged anyway, so it can run in the background //var lang = demoConfiguration.Language; //Task.Run(async () => await LanguageLoader.Current.ChangeLanguageAsync(lang).ConfigureAwait(false)); }
public override void Initialize(IConfig config) { // Prepare disposables _disposables?.Dispose(); // Place this under the Ui parent ParentId = nameof(ConfigIds.Capture); // Make sure Commit/Rollback is called on the IUiConfiguration config.Register(CoreConfiguration); // automatically update the DisplayName _disposables = new CompositeDisposable { GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsCapture)) }; base.Initialize(config); }