private void RegisterStartup() { if (AppStartup.IsRegistered) { AppStartup.Unregister(); } else { AppStartup.Register(); } RegStartupButtonContent = AppStartup.IsRegistered ? Resources.UnregFromStartup : Resources.RegToStartup; }
public ConfigurationContentViewModel(IConfigurationService configurationService) { var configuration = configurationService.Configuration; _product = Product.Find(configurationService.Configuration.ModelNumber, configurationService.Configuration.Windows); Interval = ReactiveProperty.FromObject(configuration, w => w.Interval, w => (int)w, IntervalExt.ToInterval); IsRegistered = new ReactiveProperty <bool>(AppStartup.IsRegistered); IsRegistered.Subscribe(w => { if (AppStartup.IsRegistered == IsRegistered.Value) { return; } if (AppStartup.IsRegistered) { AppStartup.Unregister(); } else { AppStartup.Register(); } }).AddTo(this); }