public bool AddWebResource(FilePath path, out Guid guid) { if (webResources.TryGetFirst(path, out guid)) { return(false); } webResources = webResources.Add(guid = Guid.NewGuid(), path); Log.Debug(TAG, $"{path} as {guid}"); return(true); }
protected void AddCheckButtonPreference(Preference <bool> preference, NSButton checkButton) { checkButton.Activated += (sender, e) => { Preference <bool> pref; if (checkButtonPrefs.TryGetFirst(checkButton, out pref)) { pref.SetValue(checkButton.State == NSCellStateValue.On); } }; checkButtonPrefs = checkButtonPrefs.Add(preference, checkButton); HandlePreferenceChange(preference, checkButton); }