public SkinManager(Storage storage, DatabaseContextFactory contextFactory, GameHost host, IResourceStore <byte[]> resources, AudioManager audio) { this.audio = audio; this.host = host; this.resources = resources; skinStore = new SkinStore(contextFactory, storage); userFiles = new FileStore(contextFactory, storage).Store; skinModelManager = new SkinModelManager(storage, contextFactory, skinStore, host, this); DefaultLegacySkin = new DefaultLegacySkin(this); DefaultSkin = new DefaultSkin(this); CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue); CurrentSkin.Value = DefaultSkin; CurrentSkin.ValueChanged += skin => { if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; }
/// <summary> /// /// </summary> /// <param name="oldSource"></param> /// <param name="newSource"></param> /// <returns></returns> protected virtual async Task OnSourceChanged(TSource oldSource, TSource newSource) { if (!isNesting) { nest.Clear(); } IgnoreSource(oldSource); if (newSource != null) { Properties.Reset(newSource); IsLoading = true; await LoadPropertiesAsync(newSource); IsLoading = false; FollowSource(newSource); } else if (AcceptsNullObjects) { Properties.Reset(null); } SourceChanged?.Invoke(this, new EventArgs <TSource>(newSource)); }
public void SetSource(ImageSource source) { var oldImageSource = image.Source; image.Source = source; SourceChanged?.Invoke(this, new ImageSourceChangedEventArgs(oldImageSource, source)); }
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, GameHost host, IResourceStore <byte[]> resources, AudioManager audio) : base(storage, contextFactory, new SkinStore(contextFactory, storage), host) { this.audio = audio; this.host = host; this.resources = resources; DefaultLegacySkin = new DefaultLegacySkin(this); DefaultSkin = new DefaultSkin(this); CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue); CurrentSkin.Value = DefaultSkin; CurrentSkin.ValueChanged += skin => { if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; // can be removed 20220420. populateMissingHashes(); }
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio) : base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost) { this.audio = audio; CurrentSkinInfo.ValueChanged += info => CurrentSkin.Value = GetSkin(info); CurrentSkin.ValueChanged += skin => { if (skin.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; // migrate older imports which didn't have access to skin.ini using (ContextFactory.GetForWrite()) { foreach (var skinInfo in ModelStore.ConsumableItems.Where(s => s.Name.EndsWith(".osk"))) { populate(skinInfo); Update(skinInfo); } } }
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio, IResourceStore <byte[]> legacyDefaultResources) : base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost) { this.audio = audio; this.legacyDefaultResources = legacyDefaultResources; ItemRemoved += removedInfo => { // check the removed skin is not the current user choice. if it is, switch back to default. if (removedInfo.ID == CurrentSkinInfo.Value.ID) { CurrentSkinInfo.Value = SkinInfo.Default; } }; CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue); CurrentSkin.ValueChanged += skin => { if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; }
/// <summary> /// Show the dialogue displaying the scan progress and start the scan /// </summary> /// <param name="manager"></param> public static void ShowFragment(FragmentManager manager, Source sourceToEdit, SourceChanged callback) { // Save the parameters so that they are available after a configuration change SourceEditDialogFragment.sourceToEdit = sourceToEdit; reporter = callback; new SourceEditDialogFragment().Show(manager, "fragment_edit_source"); }
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); fallbackSource = dependencies.Get <ISkinSource>(); if (fallbackSource != null) { fallbackSource.SourceChanged += () => SourceChanged?.Invoke(); } dependencies.CacheAs <ISkinSource>(this); return(dependencies); }
protected virtual void OnSourceChanged(MyObservableCollection <T> oldSource) { if (oldSource != null) { oldSource.ItemAttached -= Source_ItemAttached; oldSource.ItemDetached -= Source_ItemDetached; } this.Synced.Clear(); this.Source.ItemAttached += Source_ItemAttached; this.Source.ItemDetached += Source_ItemDetached; this.Source.ForEach(item => this.Synced.Add(item)); SourceChanged?.Invoke(this, oldSource); }
public SkinManager(Storage storage, RealmAccess realm, GameHost host, IResourceStore <byte[]> resources, AudioManager audio, Scheduler scheduler) : base(storage, realm) { this.audio = audio; this.scheduler = scheduler; this.host = host; this.resources = resources; userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files")); skinImporter = new SkinImporter(storage, realm, this) { PostNotification = obj => PostNotification?.Invoke(obj), }; var defaultSkins = new[] { DefaultLegacySkin = new DefaultLegacySkin(this), DefaultSkin = new DefaultSkin(this), }; // Ensure the default entries are present. realm.Write(r => { foreach (var skin in defaultSkins) { if (r.Find <SkinInfo>(skin.SkinInfo.ID) == null) { r.Add(skin.SkinInfo.Value); } } }); CurrentSkinInfo.ValueChanged += skin => { CurrentSkin.Value = skin.NewValue.PerformRead(GetSkin); }; CurrentSkin.Value = DefaultSkin; CurrentSkin.ValueChanged += skin => { if (!skin.NewValue.SkinInfo.Equals(CurrentSkinInfo.Value)) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; }
/// <summary> /// Fetch Data /// </summary> public void Refresh(Guid employGuid) { if (employGuid == Guid.Empty) { _SALARY_LIST.ItemsSource = null; return; } _employGuid = employGuid; new Task(() => Dispatcher.BeginInvoke(new Action(() => { _SALARY_LIST.ItemsSource = App.Store.Economat.PayRoll.GetSalaries(employGuid); SourceChanged?.Invoke(_SALARY_LIST?.SelectedValue, new EventArgs()); }))).Start(); }
public SkinManager(Storage storage, DatabaseContextFactory contextFactory, IIpcHost importHost, AudioManager audio, IResourceStore <byte[]> legacyDefaultResources) : base(storage, contextFactory, new SkinStore(contextFactory, storage), importHost) { this.audio = audio; this.legacyDefaultResources = legacyDefaultResources; CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = GetSkin(skin.NewValue); CurrentSkin.ValueChanged += skin => { if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; }
public SkinManager(Storage storage, RealmContextFactory contextFactory, GameHost host, IResourceStore <byte[]> resources, AudioManager audio, Scheduler scheduler) { this.contextFactory = contextFactory; this.audio = audio; this.scheduler = scheduler; this.host = host; this.resources = resources; userFiles = new StorageBackedResourceStore(storage.GetStorageForDirectory("files")); skinModelManager = new SkinModelManager(storage, contextFactory, host, this); var defaultSkins = new[] { DefaultLegacySkin = new DefaultLegacySkin(this), DefaultSkin = new DefaultSkin(this), }; // Ensure the default entries are present. using (var context = contextFactory.CreateContext()) using (var transaction = context.BeginWrite()) { foreach (var skin in defaultSkins) { if (context.Find <SkinInfo>(skin.SkinInfo.ID) == null) { context.Add(skin.SkinInfo.Value); } } transaction.Commit(); } CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = skin.NewValue.PerformRead(GetSkin); CurrentSkin.Value = DefaultSkin; CurrentSkin.ValueChanged += skin => { if (!skin.NewValue.SkinInfo.Equals(CurrentSkinInfo.Value)) { throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); } SourceChanged?.Invoke(); }; }
protected virtual void OnSourceChanged(MyObservableCollection <T> oldSource) { oldSource.ItemAttached -= Source_ItemAttached; oldSource.ItemDetached -= Source_ItemDetached; oldSource.ItemMoved -= Source_ItemMoved; this.Synced.Clear(); var internalFilter = this.InternalFilter; this.sourceFilterResults = this.Source.Select(item => internalFilter(item)).ToList(); this.Source.ItemAttached += Source_ItemAttached; this.Source.ItemDetached += Source_ItemDetached; this.Source.ItemMoved += Source_ItemMoved; this.Source.Where(item => InternalFilter(item)) .ForEach(item => this.Synced.Add(item)); SourceChanged?.Invoke(this, oldSource); }
/// <summary> /// Load a new language source from a language data scriptable object /// </summary> /// <param name="data">The language data to load</param> public static void LoadSource(LanguageData data) { // Make sure the language data inputted actually exists if (data == null) { Debug.LogError("Null language input to localizer!"); return; } // Transform the strings into the localizer dictionary strings = new Dictionary <string, string>(data.strings.Length); foreach (var s in data.strings) { strings.Add(s.tag, s.text); } // Raise the event for changing the language source SourceChanged?.Invoke(); }
public ThemeManager(Scheduler scheduler, UserResources resources, VignetteConfigManager config) { this.scheduler = scheduler; UseableThemes.Add(Theme.Light); UseableThemes.Add(Theme.Dark); store = resources.Themes; store.FileCreated += onFileCreated; store.FileDeleted += onFileDeleted; store.FileUpdated += onFileUpdated; store.FileRenamed += onFileRenamed; loadExistingThemes(); themeConfig = config.GetBindable <string>(VignetteSetting.Theme); themeConfig.BindValueChanged(e => { if (e.NewValue == Current.Value.Name) { return; } Current.Value = UseableThemes.FirstOrDefault(t => t.Name == e.NewValue) ?? Theme.Light; SourceChanged?.Invoke(); }, true); Current.BindValueChanged(e => { if (themeConfig.Value == e.NewValue.Name) { return; } themeConfig.Value = e.NewValue.Name; SourceChanged?.Invoke(); }, true); }
internal void NotifySourceChanged(string sender, bool isChanged) { SourceChanged?.Invoke(new Status(sender, isChanged)); }
protected void OnSourceChanged() { SourceChanged?.Invoke(this, EventArgs.Empty); }
protected virtual void TriggerSourceChanged() => SourceChanged?.Invoke();
/// <summary> /// Called when the source bitmap has been changed. /// </summary> protected virtual void OnSourceChanged() { SourceChanged?.Invoke(this, Source); }
private void onSourceChanged() => SourceChanged?.Invoke();
/// <summary> /// Called by inheritors to indicate that the source changed. /// </summary> protected void OnSourceChanged() { SourceChanged.RaiseEvent(this); }
internal void OnSourceChanged(string str, FlowSourceManager flowSourceManager) { SourceChanged?.Invoke(str, flowSourceManager); }
private void OnSourceChanged(string serializedText, string fileName) { SourceChanged?.Invoke(serializedText, fileName); }
public TestThemeSource() { Current.BindValueChanged(_ => SourceChanged?.Invoke(), true); }
public void TriggerSourceChanged() { SourceChanged?.Invoke(); }
private void RaiseSourceChanged() { SourceChanged?.Invoke(this, EventArgs.Empty); }
protected void OnSourceChanged(AssemblyAndType asm) { SourceChanged?.Invoke(this, new ChangeSourceEventArgs(asm)); }
protected virtual void OnSourceChanged() => SourceChanged?.Invoke();
private void OnConfigurationChanged(object sender, ChoConfigurationChangedEventArgs e) { SourceChanged.Raise(this, new ChoSourceCompositeChangedEventArgs(e)); }