public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (ui == null) { ui = new System.Windows.Forms.TGIBlockListEditorForm.MainForm(); //ui.Icon = ((System.Drawing.Icon)(new ComponentResourceManager(typeof(MainForm)).GetObject("$this.Icon"))); ui.Icon = Settings.Default.FormIcon; } TGIBlockListCTD ctd = value as TGIBlockListCTD; DependentList <TGIBlock> list = ctd.owner[ctd.field].Value as DependentList <TGIBlock>; ui.Items = list; DialogResult dr = edSvc.ShowDialog(ui); if (dr != DialogResult.OK) { return(value); } list.Clear(); list.AddRange(ui.Items); return(value); }
public TGIBlockListIndexCTD(AApiVersionedFields owner, string field, DependentList <TGIBlock> tgiBlocks, object component) { this.owner = owner; this.field = field; this.tgiBlocks = tgiBlocks; this.component = component; }
public Entry(EventHandler handler, AgeGenderFlags ageGender, float amount, int index, DependentList <TGIBlock> ParentTGIBlocks = null) : base(handler) { this.ParentTGIBlocks = ParentTGIBlocks; this.ageGender = new AgeGenderFlags(handler, ageGender); this.amount = amount; this.index = index; }
public CASEntry(int APIversion, EventHandler handler, FacialRegionFlags facialRegion, EntryList geomEntries, EntryList boneEntries, DependentList <TGIBlock> ParentTGIBlocks = null) : base(APIversion, handler) { this._ParentTGIBlocks = ParentTGIBlocks; this.facialRegion = facialRegion; this.geomEntries = new EntryList(handler, geomEntries, _ParentTGIBlocks); this.boneEntries = new EntryList(handler, boneEntries, _ParentTGIBlocks); }
public CASEntryList(EventHandler handler, IEnumerable <CASEntry> le, DependentList <TGIBlock> ParentTGIBlocks = null) : this(null, ParentTGIBlocks) { elementHandler = handler; foreach (var t in le) { this.Add((CASEntry)t.Clone(null)); } this.handler = handler; }
public void SetField(AApiVersionedFields owner, string field, DependentList <TGIBlock> tgiBlocks) { this.owner = owner; this.field = field; this.tgiBlocks = tgiBlocks; tgiBlockCombo1.TGIBlocks = this.tgiBlocks; tgiBlockCombo1.SelectedIndex = Convert.ToInt32(this.owner[this.field].Value); }
public ShaderDataList(EventHandler handler, Stream s, long start, Nullable <int> expectedDataLen, DependentList <TGIBlock> ParentTGIBlocks = null, string RCOLTag = "MATD") : base(null) { elementHandler = handler; this._ParentTGIBlocks = ParentTGIBlocks; this._RCOLTag = RCOLTag; Parse(s, start, expectedDataLen); this.handler = handler; }
public void SetField(AApiVersionedFields owner, string field, DependentList<TGIBlock> tgiBlocks) { this.owner = owner; this.field = field; this.tgiBlocks = tgiBlocks; tgiBlockCombo1.TGIBlocks = this.tgiBlocks; tgiBlockCombo1.SelectedIndex = Convert.ToInt32(this.owner[this.field].Value); }
public void Initialize() { _model = new ContactList(); _model.AddContact(new Contact() { FirstName = "Charles", LastName = "Babbage" }); _model.AddContact(new Contact() { FirstName = "Alan", LastName = "Turing" }); _contactViewModels = new DependentList<ContactViewModel>(() => from c in _model.Contacts select new ContactViewModel(c) ); }
public TracksViewModel(Attendee attendee, ImageCache imageCache, SearchModel searchModel) { _attendee = attendee; _imageCache = imageCache; _searchModel = searchModel; _tracks = new DependentList<Track>(() => from track in _attendee.Conference.Tracks orderby track.Name select track); }
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) { TGIBlockListCTD ctd = value as TGIBlockListCTD; DependentList <TGIBlock> list = ctd.owner[ctd.field].Value as DependentList <TGIBlock>; if (typeof(string).Equals(destinationType)) { return(list == null ? "(null)" : "(TGI Blocks: 0x" + list.Count.ToString("X") + ")"); } return(base.ConvertTo(context, culture, value, destinationType)); }
public TracksViewModel(Attendee attendee, ImageCache imageCache, SearchModel searchModel) { _attendee = attendee; _imageCache = imageCache; _searchModel = searchModel; _tracks = new DependentList <Track>(() => from track in _attendee.Conference.Tracks orderby track.Name select track); }
public BookViewModel(Book book, NewEntryModel newEntry) { _book = book; _newEntry = newEntry; _otherAccountOptions = new DependentList<AccountHeaderViewModel>(() => from account in _book.Account.Company.Accounts orderby account.Name.Value select new AccountHeaderViewModel(account) ); }
public SpeakerDayViewModel(Attendee attendee, Speaker speaker, Day day, ImageCache imageCache) { _attendee = attendee; _speaker = speaker; _day = day; _imageCache = imageCache; _matchingSessionPlaces = new DependentList <SessionPlace>(() => from sessionPlace in _speaker.AvailableSessions where sessionPlace.Place.PlaceTime.Day == _day select sessionPlace); }
public ElementTextureRef(int APIversion, EventHandler handler, DependentList <TGIBlock> ParentTGIBlocks = null, string RCOLTag = "MATD") : this(APIversion, handler, (FieldType)0, ParentTGIBlocks, RCOLTag) { if (_RCOLTag == "GEOM") { index = 0; } else { data = new GenericRCOLResource.ChunkReference(0, handler); } }
public ShaderDataList(EventHandler handler, IEnumerable <ShaderData> ilt, DependentList <TGIBlock> ParentTGIBlocks = null, string RCOLTag = "MATD") : base(handler) { elementHandler = handler; this._ParentTGIBlocks = ParentTGIBlocks; this._RCOLTag = RCOLTag; foreach (ShaderData t in ilt) { this.Add(t); } this.handler = handler; }
public ElementTextureRef(EventHandler handler, ElementTextureRef basis, DependentList <TGIBlock> ParentTGIBlocks = null, string RCOLTag = null) : this(handler, basis.field, ParentTGIBlocks ?? basis._ParentTGIBlocks, RCOLTag ?? basis._RCOLTag) { if (_RCOLTag == "GEOM") { index = basis.index; } else { data = new GenericRCOLResource.GenericRCOLResource.ChunkReference(handler, basis.data); } }
public static ShaderData CreateEntry(EventHandler handler, Stream s, long start, DependentList <TGIBlock> _ParentTGIBlocks = null, string _RCOLTag = "MATD") { BinaryReader r = new BinaryReader(s); FieldType field = (FieldType)r.ReadUInt32(); DataType sdType = (DataType)r.ReadUInt32(); int count = r.ReadInt32(); uint offset = r.ReadUInt32(); long pos = s.Position; s.Position = start + offset; try { #region Determine entry type switch (sdType) { case DataType.dtFloat: switch (count) { case 1: return(new ElementFloat(handler, field, s)); case 2: return(new ElementFloat2(handler, field, s)); case 3: return(new ElementFloat3(handler, field, s)); case 4: return(new ElementFloat4(handler, field, s)); } throw new InvalidDataException(String.Format("Invalid count #{0}' for DataType 0x{1:X8} at 0x{2:X8}", count, sdType, s.Position)); case DataType.dtInt: switch (count) { case 1: return(new ElementInt(handler, field, s)); } throw new InvalidDataException(String.Format("Invalid count #{0}' for DataType 0x{1:X8} at 0x{2:X8}", count, sdType, s.Position)); case DataType.dtTexture: switch (count) { case 4: return(new ElementTextureRef(handler, field, s, _ParentTGIBlocks, _RCOLTag)); case 5: return(new ElementTextureKey(handler, field, s)); } throw new InvalidDataException(String.Format("Invalid count #{0}' for DataType 0x{1:X8} at 0x{2:X8}", count, sdType, s.Position)); } throw new InvalidDataException(String.Format("Unknown DataType 0x{0:X8} at 0x{1:X8}", sdType, s.Position)); #endregion } finally { s.Position = pos; } }
public SearchDayViewModel(Attendee attendee, Day day, ImageCache imageCache, SearchModel searchModel) { _attendee = attendee; _day = day; _imageCache = imageCache; _searchModel = searchModel; _matchingSessionPlaces = new DependentList <SessionPlace>(() => _searchModel.SearchTerm == null || _searchModel.SearchTerm.Length < 3 ? Enumerable.Empty <SessionPlace>() : from time in _day.Times from sessionPlace in time.AvailableSessions where sessionPlace.Session.Matches(_searchModel.SearchTerm.ToLower()) select sessionPlace); }
public SearchDayViewModel(Attendee attendee, Day day, ImageCache imageCache, SearchModel searchModel) { _attendee = attendee; _day = day; _imageCache = imageCache; _searchModel = searchModel; _matchingSessionPlaces = new DependentList<SessionPlace>(() => _searchModel.SearchTerm == null || _searchModel.SearchTerm.Length < 3 ? Enumerable.Empty<SessionPlace>() : from time in _day.Times from sessionPlace in time.AvailableSessions where sessionPlace.Session.Matches(_searchModel.SearchTerm.ToLower()) select sessionPlace); }
public static Entry CreateEntry(EventHandler handler, Stream s, DependentList <TGIBlock> ParentTGIBlocks) { BinaryReader r = new BinaryReader(s); byte entryType = r.ReadByte(); if (entryType == 0x00) { return(new Entry00(handler, 0, r.ReadByte(), s, ParentTGIBlocks)); } if (entryType == 0x01) { return(new Entry01(handler, 1, r.ReadInt32(), ParentTGIBlocks)); } throw new InvalidDataException(String.Format("Unknown EntryType 0x{0:X2} at 0x{1:X8}", entryType, s.Position)); }
public void Initialize() { _model = new ContactList(); _model.AddContact(new Contact() { FirstName = "Charles", LastName = "Babbage" }); _model.AddContact(new Contact() { FirstName = "Alan", LastName = "Turing" }); _contactViewModels = new DependentList <ContactViewModel>(() => from c in _model.Contacts select new ContactViewModel(c) ); }
public void TestDependentList() { var obj = new DependentList(); var dependentCounter = 0; var sourcesCounter = 0; var dependentExpectation = 0; var sourcesExpectation = 0; ObservableUtility.FromProperty(() => obj.DependentCount).Subscribe(_ => dependentCounter++); ObservableUtility.FromProperty(() => obj.Sources).Subscribe(_ => sourcesCounter++); Assert.AreEqual(++sourcesExpectation, sourcesCounter); Assert.AreEqual(++dependentExpectation, dependentCounter); Assert.AreEqual(0, obj.DependentCount); Assert.AreEqual(0, obj.SourcesCount); obj.Sources = new ObservableCollection <Source>(); Assert.AreEqual(++sourcesExpectation, sourcesCounter); Assert.AreEqual(++dependentExpectation, dependentCounter); Assert.AreEqual(0, obj.DependentCount); Assert.AreEqual(0, obj.SourcesCount); obj.Sources.Add(new Source()); Assert.AreEqual(1, obj.DependentCount); Assert.AreEqual(1, obj.SourcesCount); Assert.AreEqual(++sourcesExpectation, sourcesCounter); Assert.AreEqual(++dependentExpectation, dependentCounter); obj.Dependent.Add(new Source()); Assert.AreEqual(++dependentExpectation, dependentCounter); Assert.AreEqual(2, obj.DependentCount); Assert.AreEqual(2, obj.SourcesCount); var newList = new ObservableCollection <Source>(); obj.Sources = newList; Assert.AreEqual(0, obj.DependentCount); Assert.AreEqual(0, obj.SourcesCount); Assert.AreEqual(++dependentExpectation, dependentCounter); obj.Sources.Add(new Source()); Assert.AreEqual(++dependentExpectation, dependentCounter); Assert.AreEqual(1, obj.DependentCount); Assert.AreEqual(1, obj.SourcesCount); obj.Sources.RemoveAt(0); Assert.AreEqual(++dependentExpectation, dependentCounter); }
/// <summary> /// Displays a modal form allowing a list of TGIBlocks to be edited (created, updated, deleted). /// </summary> /// <param name="owner">Any object that implements System.Windows.Forms.IWin32Window /// and represents the top-level window that will own this form.</param> /// <param name="ltgi">an AResource.DependentList<AResource.TGIBlock> object.</param> /// <returns>the DialogResult</returns> public static DialogResult Show(IWin32Window owner, DependentList <TGIBlock> ltgi) { TGIBlockListEditorForm.MainForm theForm = new System.Windows.Forms.TGIBlockListEditorForm.MainForm(); theForm.Items = ltgi; if (owner as Form != null) { theForm.Icon = (owner as Form).Icon; } DialogResult dr = theForm.ShowDialog(); if (dr != DialogResult.OK) { return(dr); } ltgi.Clear(); ltgi.AddRange(theForm.Items); return(dr); }
public void DependentListMultiThreadingTrap() { var list = new DependentList(); var counter = 0; var victimWaiter = new Waiter(); var attackerWaiter = new Waiter(); var observableExpression = new DebugReactiveExpression <int>(() => list.DependentCount, "DependentCountObserver"); observableExpression.Evaluate(); var victim = new Thread(() => { observableExpression.Skip(1).Subscribe(s => { s(); counter++; attackerWaiter.Release(); victimWaiter.Wait(); }); list.Sources.Add(new Source()); Assert.AreEqual(1, counter); }); var attackerList = new DependentList(); var attacker = new Thread(() => { attackerWaiter.Wait(); attackerList.Sources.Add(new Source()); victimWaiter.Release(); }); Assert.AreEqual(0, attackerList.DependentCount); victim.Start(); attacker.Start(); victim.Join(); attacker.Join(); Assert.AreEqual(1, counter); }
public void Undo_UpdateDepthFudge(float fFudge, bool bNewFudge = false) { #if UNITY_EDITOR DependentList.ForEach(r => { var Iso2D = r.GetComponent <Iso2DObject>(); if (Iso2D != null) { if (bNewFudge) { Iso2D.Undo_NewDepthFudge(fFudge); } else { Iso2D.Undo_AddDepthFudge(fFudge); } } }); #endif }
//DisplaySettingsVM _settings; public RowVM(RowModel model, ProjectVM tree, RowVM parent) : base(model) { Tree = tree; Parent = parent; //_settings = settings; //settings.PropertyChanged += new PropertyChangedEventHandler(Settings_PropertyChanged); _children = new DependentList <RowVM>(() => Tree.Filter.ApplyTo(model.Children).Select(m => new RowVM(m, Tree, this))); _children.DependentSentry.Invalidated += () => Tree.FireChildrenInvalidated(this); _depChangeDetector = Dependent.New("RowVM._depChangeDetector", () => { // Watch for changes in any of the model's properties, // to trigger a screen refresh when using TreeViewAdv var a = Model.Type; var b = Model.Name; var c = Model.Status; var d = Model.Priority; var e = Model.RunTime; var f = Model.Summary; }); _depChangeDetector.Invalidated += () => Tree.FireRowInvalidated(this); }
public TypedValuePropertyDescriptor(AApiVersionedFields owner, string field, Attribute[] attrs) : base(field, attrs) { try { this.owner = owner; if (typeof(ArrayOwner).Equals(owner.GetType())) { fieldType = ((ArrayOwner)owner).ElementType; } else if (typeof(AsKVP).Equals(owner.GetType())) { fieldType = ((AsKVP)owner).GetType(Name); } else { string name = GetFieldName(field); fieldType = GetFieldType(owner, field); priority = ElementPriorityAttribute.GetPriority(owner.GetType(), name); tgiBlocks = owner.GetTGIBlocks(name); } } catch (Exception ex) { throw ex; } }
public CDTAssetResourceName(int APIversion, EventHandler handler, string key, byte controlCode, int data, DependentList <TGIBlock> ParentTGIBlocks = null) : base(APIversion, handler, key, controlCode, data, ParentTGIBlocks) { }
public CDTAssetResourceName(int APIversion, EventHandler handler, DependentList <TGIBlock> ParentTGIBlocks = null) : base(APIversion, handler, "CDTAssetResourceName-Key", (byte)0x02, (Int32)0, ParentTGIBlocks) { }
internal ComponentDataList(EventHandler handler, Stream s, DependentList <TGIBlock> ParentTGIBlocks = null) : this(null, ParentTGIBlocks) { elementHandler = handler; Parse(s); this.handler = handler; }
public TGIBlockCombo(DependentList<TGIBlock> tgiBlocks, int index, bool showEdit) : this() { TGIBlocks = tgiBlocks; SelectedIndex = index; ShowEdit = showEdit; }
public TGIBlockCombo(DependentList<TGIBlock> tgiBlocks, int index) : this(tgiBlocks, index, true) { }
public CDTResourceKey(int APIversion, EventHandler handler, string key, byte controlCode, int data, DependentList <TGIBlock> ParentTGIBlocks = null) : base(APIversion, handler, key, controlCode) { this.ParentTGIBlocks = ParentTGIBlocks; this.data = data; }
/// <summary> /// Displays a modal form allowing a list of TGIBlocks to be edited (created, updated, deleted). /// </summary> /// <param name="ltgi">an AResource.DependentList<AResource.TGIBlock> object.</param> /// <returns>the DialogResult</returns> public static DialogResult Show(DependentList<TGIBlock> ltgi) { return Show(OwningForm, ltgi); }
public CDTAssetResourceName(int APIversion, EventHandler handler, CDTAssetResourceName basis, DependentList <TGIBlock> ParentTGIBlocks = null) : base(APIversion, handler, basis, ParentTGIBlocks ?? basis.ParentTGIBlocks) { }
/// <summary> /// Displays a modal form allowing a list of TGIBlocks to be edited (created, updated, deleted). /// </summary> /// <param name="owner">Any object that implements System.Windows.Forms.IWin32Window /// and represents the top-level window that will own this form.</param> /// <param name="ltgi">an AResource.DependentList<AResource.TGIBlock> object.</param> /// <returns>the DialogResult</returns> public static DialogResult Show(IWin32Window owner, DependentList<TGIBlock> ltgi) { TGIBlockListEditorForm.MainForm theForm = new System.Windows.Forms.TGIBlockListEditorForm.MainForm(); theForm.Items = ltgi; if (owner as Form != null) theForm.Icon = (owner as Form).Icon; DialogResult dr = theForm.ShowDialog(); if (dr != DialogResult.OK) return dr; ltgi.Clear(); ltgi.AddRange(theForm.Items); return dr; }
public ComponentDataList(EventHandler handler, DependentList <TGIBlock> ParentTGIBlocks = null) : base(handler, Byte.MaxValue) { _ParentTGIBlocks = ParentTGIBlocks; }
internal static void UpdateSourceDependentLists(DependencyObject d, DependencyProperty dp, DependencySource[] sources, Expression expr, bool add) { // Sources already validated to be on the same thread as Dependent (d) if (sources != null) { // don't hold a reference on the dependent if the expression is doing // the invalidations. This helps avoid memory leaks (bug 871139) if (expr.ForwardsInvalidations) { d = null; dp = null; } for (int i = 0; i < sources.Length; i++) { DependencySource source = sources[i]; // A Sealed DependencyObject does not have a Dependents list // so don't bother updating it (or attempt to add one). Debug.Assert((!source.DependencyObject.IsSealed) || (DependentListMapField.GetValue(source.DependencyObject) == default(object))); if (!source.DependencyObject.IsSealed) { // Retrieve the DependentListMap for this source // The list of dependents to invalidate is stored using a special negative key FrugalMap dependentListMap; object value = DependentListMapField.GetValue(source.DependencyObject); if (value != null) { dependentListMap = (FrugalMap)value; } else { dependentListMap = new FrugalMap(); } // Get list of DependentList off of ID map of Source object dependentListObj = dependentListMap[source.DependencyProperty.GlobalIndex]; Debug.Assert(dependentListObj != null, "dependentList should either be unset or non-null"); // Add/Remove new Dependent (this) to Source's list if (add) { DependentList dependentList; if (dependentListObj == DependencyProperty.UnsetValue) { dependentListMap[source.DependencyProperty.GlobalIndex] = dependentList = new DependentList(); } else { dependentList = (DependentList)dependentListObj; } dependentList.Add(d, dp, expr); } else { if (dependentListObj != DependencyProperty.UnsetValue) { DependentList dependentList = (DependentList)dependentListObj; dependentList.Remove(d, dp, expr); if (dependentList.IsEmpty) { // No more dependencies for this property; reclaim the space if we can. dependentListMap[source.DependencyProperty.GlobalIndex] = DependencyProperty.UnsetValue; } } } // Set the updated struct back into the source's _localStore. DependentListMapField.SetValue(source.DependencyObject, dependentListMap); } } } }
public ComponentDataList(EventHandler handler, IEnumerable <ComponentDataType> lcdt, DependentList <TGIBlock> ParentTGIBlocks = null) : this(null, ParentTGIBlocks) { elementHandler = handler; foreach (var t in lcdt) { this.Add((ComponentDataType)t.Clone(null)); } this.handler = handler; }
public TGIBlockCombo(DependentList<TGIBlock> tgiBlocks) : this(tgiBlocks, -1, true) { }