private void OnCreateItemValue(CreateLookupItemEventArgs <TKey1, TKey2, TValue> e) { if (this.CreateItemValue != null) { this.CreateItemValue(this, e); } }
/// <summary> /// Raised the <see cref="CreateItemValue"/> event. /// </summary> /// <param name="e"></param> protected virtual void OnCreateItemValue(CreateLookupItemEventArgs e) { if (this.CreateItemValue != null) { this.CreateItemValue(this, e); } }
// private string SharedSettingsCacheFilePath // { // get // { // // get... // return Path.Combine(Runtime.Current.AllUsersApplicationDataFolderPath, SharedSettingsCacheFileName); // } // } private void _caches_CreateItemValue(object sender, CreateLookupItemEventArgs e) { // create a new lookup... Lookup items = new Lookup(); items.CreateItemValue += new CreateLookupItemEventHandler(PerDatabaseCreateItemValue); // set... e.NewValue = items; }
void InnerLookup_CreateItemValue(object sender, CreateLookupItemEventArgs e) { var newE = new CreateLookupItemEventArgs <TKey, TValue>((TKey)e.Key); if (this.CreateItemValue != null) { this.CreateItemValue(this, newE); } e.NewValue = newE.NewValue; }
private void InnerLookup_CreateItemValue(object sender, CreateLookupItemEventArgs <TKey1, BfxLookup <TKey2, TValue> > e) { e.NewValue = new BfxLookup <TKey2, TValue>(); e.NewValue.CreateItemValue += (theSender, theE) => { var newE = new CreateLookupItemEventArgs <TKey1, TKey2, TValue>(e.Key, theE.Key); this.OnCreateItemValue(newE); // pass... theE.NewValue = newE.NewValue; }; }
private void PerDatabaseCreateItemValue(object sender, CreateLookupItemEventArgs e) { string name = (string)e.Key; // do we have it? if (!(_ensureCalled)) { try { ConfigItem.EnsureConfigTableExists(); } finally { _ensureCalled = true; } } // mbr - 10-03-2006 - check... if (CompanyName == null) { throw new InvalidOperationException("'CompanyName' is null."); } if (CompanyName.Length == 0) { throw new InvalidOperationException("'CompanyName' is zero-length."); } if (ProductName == null) { throw new InvalidOperationException("'ProductName' is null."); } if (ProductName.Length == 0) { throw new InvalidOperationException("'ProductName' is zero-length."); } // get... ConfigItem item = ConfigItem.GetByCompanyProductAndName(this.CompanyName, this.ProductName, name); // mbr - 02-04-2006 - don't create the item - just won't work if we do. // if(item == null) // { // item = new ConfigItem(); // item.CompanyName = this.CompanyName; // item.ProductName = this.ProductName; // item.Name = name; // item.Version = 0; // } // return... e.NewValue = item; }
/// <summary> /// Demand loads the item. /// </summary> /// <param name="key"></param> // mbr - 2010-01-20 - broken into separate method... private void LoadItem(object key, bool forceReload) { Lock.UpgradeToWriterLock(-1); // try again... if (forceReload || !(InnerValues.Contains(key))) { // create it... CreateLookupItemEventArgs e = new CreateLookupItemEventArgs(key); this.OnCreateItemValue(e); // add... // mbr - 2010-01-20 - added wrap... //InnerValues[key] = e.NewValue; InnerValues[key] = Wrap(e.NewValue); } }