示例#1
0
        public CheckBox(Vector2f _pos, string _name, bool _default = false)
        {
            isVisable  = true;
            isChecked  = _default;
            stringText = _name;

            texture = new Texture("Resources\\Sprites\\GUI\\CheckBox.png");
            sprite  = new Sprite(texture);

            Pos = _pos;

            text = new Text(stringText, Canvas.Instance.font);
            text.CharacterSize = 14;

            text.Position = new Vector2f(Pos.X + 24, Pos.Y);

            mousePressed = (obj, e) =>
            {
                if (sprite.GetGlobalBounds().Contains(MainWindow.Instance.RenderWindow.MapPixelToCoords(new Vector2i(e.X, e.Y)).X, MainWindow.Instance.RenderWindow.MapPixelToCoords(new Vector2i(e.X, e.Y)).Y) && e.Button == Mouse.Button.Left && isVisable)
                {
                    isChecked = !isChecked;
                    HasChanged?.Invoke(this, new HasChangedArgs(IsChecked));
                }
            };
            MainWindow.Instance.RenderWindow.MouseButtonPressed += mousePressed;
        }
示例#2
0
 public void Update(string text)
 {
     if (Text != text)
     {
         var old = new TestItem(Text);
         Text = text;
         HasChanged?.Invoke(old, this);
     }
 }
示例#3
0
 public void Update(string text, DataStore <TestItemCsv> dataStore)
 {
     if (Text != text)
     {
         var old = new TestItemCsv(Text);
         Text = text;
         dataStore.ItemHasChanged(old, this);
         HasChanged?.Invoke(old, this);
     }
 }
示例#4
0
    //public void SetDummyCubeModel()
    //{
    //    balls = BallData.GetEmptyBallDataMatrix(3, 3, 3);
    //    faces = TileData.GetEmptyTileDataMatrix(6, 3, 3);
    //    balls[0, 0, 0] = BallData.GetObjective1Ball();
    //    balls[0, 1, 1] = BallData.GetWall();
    //    balls[1, 1, 1] = BallData.GetWall();
    //    balls[2, 1, 1] = BallData.GetWall();
    //    //balls[0, 0, 2] = BallData.GetWall();
    //    //balls[2, 1, 2] = BallData.GetWall();
    //    //
    //    faces[5, 0, 2] = TileData.GetObjective1Tile();
    //    //faces[0, 2, 2] = TileData.GetObjective2Tile();
    //    //faces[1, 1, 2] = TileData.GetObjective1Tile();
    //    //faces[1, 2, 1] = TileData.GetObjective2Tile();
    //    //faces[2, 1, 0] = TileData.GetObjective1Tile();
    //    //faces[2, 2, 0] = TileData.GetObjective2Tile();
    //    //faces[3, 0, 2] = TileData.GetObjective1Tile();
    //    //faces[3, 2, 1] = TileData.GetObjective2Tile();
    //    //faces[4, 2, 0] = TileData.GetObjective2Tile();
    //    //faces[5, 0, 1] = TileData.GetObjective1Tile();
    //    //faces[5, 0, 2] = TileData.GetObjective2Tile();
    //    HasChanged.Invoke(this);
    //}

    internal void SetData(CubeData data)
    {
        objectivesFilled = new Dictionary <ObjectiveType, bool>();
        foreach (var key in data.Objectives.Keys)
        {
            objectivesFilled.Add(key, false);
        }
        balls = data.balls;
        faces = data.faces;
        HasChanged.Invoke(this);
    }
示例#5
0
        public void Update(string demoChildData, DemoParent parent)
        {
            if (Key >= 0)
            {
                if (parent.Key < 0)
                {
                    throw new Exception($"DemoChild.Update(): It is illegal to add stored DemoChild '{this}'" + Environment.NewLine +
                                        $"to Parent '{parent}', which is not stored.");
                }
            }
            var clone       = new DemoChild(this);
            var isCancelled = false;

            onUpdating(demoChildData, parent, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating DemoChild: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (DemoChildData != demoChildData)
            {
                DemoChildData    = demoChildData;
                isChangeDetected = true;
            }
            if (Parent != parent)
            {
                Parent.RemoveFromDemoChildren(this);
                Parent = parent;
                Parent.AddToDemoChildren(this);
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.DemoChildren.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(35, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated DemoChild: {ToTraceString()}");
#endif
        }
        public void Update(string text, NotMatchingChildrenListName_Parent parent)
        {
            if (Key >= 0)
            {
                if (parent.Key < 0)
                {
                    throw new Exception($"NotMatchingChildrenListName_Child.Update(): It is illegal to add stored NotMatchingChildrenListName_Child '{this}'" + Environment.NewLine +
                                        $"to Parent '{parent}', which is not stored.");
                }
            }
            var clone       = new NotMatchingChildrenListName_Child(this);
            var isCancelled = false;

            onUpdating(text, parent, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating NotMatchingChildrenListName_Child: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (Text != text)
            {
                Text             = text;
                isChangeDetected = true;
            }
            if (Parent != parent)
            {
                Parent.RemoveFromChildren(this);
                Parent = parent;
                Parent.AddToChildren(this);
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.NotMatchingChildrenListName_Childs.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(37, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated NotMatchingChildrenListName_Child: {ToTraceString()}");
#endif
        }
示例#7
0
        public void Update(string text, Sample sample)
        {
            if (Key >= 0)
            {
                if (sample.Key < 0)
                {
                    throw new Exception($"SampleDetail.Update(): It is illegal to add stored SampleDetail '{this}'" + Environment.NewLine +
                                        $"to Sample '{sample}', which is not stored.");
                }
            }
            var clone       = new SampleDetail(this);
            var isCancelled = false;

            onUpdating(text, sample, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating SampleDetail: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (Text != text)
            {
                Text             = text;
                isChangeDetected = true;
            }
            if (Sample != sample)
            {
                Sample.RemoveFromSampleDetails(this);
                Sample = sample;
                Sample.AddToSampleDetails(this);
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.SampleDetails.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(8, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated SampleDetail: {ToTraceString()}");
#endif
        }
示例#8
0
        public Slider(Vector2f _pos, string[] _variants, int _default = 0)
        {
            isVisable = true;

            variants        = _variants;
            variantCount    = variants.Length;
            selectedVariant = _default;

            texture = new Texture("Resources\\Sprites\\GUI\\Slider.png");

            sprites = new Sprite[variantCount];
            texts   = new Text[variantCount];

            for (int i = 0; i < variantCount; ++i)
            {
                sprites[i] = new Sprite(texture)
                {
                    TextureRect = new IntRect(24, 0, 24, 24),
                    Position    = new Vector2f(_pos.X + 24 * i, _pos.Y)
                };

                texts[i] = new Text(variants[i], Canvas.Instance.font)
                {
                    CharacterSize = 11,
                    Position      = new Vector2f(_pos.X + 24 * i, _pos.Y + 28)
                };
            }

            cursor = new Sprite(texture)
            {
                TextureRect = new IntRect(0, 0, 24, 24),
                Position    = new Vector2f(_pos.X + 24 * selectedVariant, _pos.Y - 4)
            };

            mousePressed = (obj, e) =>
            {
                if (e.Button == Mouse.Button.Left && isVisable)
                {
                    for (int i = 0; i < variantCount; ++i)
                    {
                        if (sprites[i].GetGlobalBounds().Contains(MainWindow.Instance.RenderWindow.MapPixelToCoords(new Vector2i(e.X, e.Y)).X, MainWindow.Instance.RenderWindow.MapPixelToCoords(new Vector2i(e.X, e.Y)).Y) && i != selectedVariant)
                        {
                            selectedVariant = i;
                            HasChanged?.Invoke(this, new HasChangedArgs(selectedVariant));
                        }
                    }
                }
            };
            MainWindow.Instance.RenderWindow.MouseButtonPressed += mousePressed;
        }
示例#9
0
        public void Update(string path, string name)
        {
            var clone       = new Location(this);
            var isCancelled = false;

            onUpdating(path, name, ref isCancelled);
            if (isCancelled)
            {
                return;
            }


            //update properties and detect if any value has changed
            var isChangeDetected = false;

            if (Path != path)
            {
                if (Key >= 0)
                {
                    DC.Data._LocationsByPathLower.Remove(PathLower);
                }
                Path      = path;
                PathLower = Path.ToLowerInvariant();
                if (Key >= 0)
                {
                    DC.Data._LocationsByPathLower.Add(PathLower, this);
                }
                isChangeDetected = true;
            }
            if (Name != name)
            {
                Name             = name;
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data._Locations.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(0, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
        }
示例#10
0
    //Get the new ball positions from the slice and place the balls to their new positions
    // It relies on the fact that any balltype/objectiveType combiantion is only present once.
    //If a level has two balls exactly similar, this function may not work anymore
    public void SetNewBallPositions(SliceBoard slice)
    {
        Dictionary <BallData, IntVector3> currentPositions = new Dictionary <BallData, IntVector3>();

        for (int x = 0; x < X_SIZE; x++)
        {
            for (int y = 0; y < Y_SIZE; y++)
            {
                for (int z = 0; z < Z_SIZE; z++)
                {
                    if (balls[x, y, z].BallType == BallType.NORMAL)
                    {
                        currentPositions.Add(balls[x, y, z], new IntVector3(x, y, z));
                    }
                }
            }
        }

        FaceModel faceModel = FaceModel.ModelsDictionary[slice.face];

        var newPositions = slice.GetBallsPositions();
        var filledTiles  = slice.GetFilledTiles();

        foreach (var pair in currentPositions)
        {
            bool wasFilled = filledTiles.Contains(pair.Key.ObjectiveType);
            if (newPositions.ContainsKey(pair.Key) || wasFilled)
            {
                balls.Set(pair.Value, BallData.GetEmptyBall());
            }
        }
        foreach (var pair in currentPositions)
        {
            IntVector3 newPosition;
            if (newPositions.TryGetValue(pair.Key, out newPosition))
            {
                IntVector3 realPosition = new IntVector3();
                realPosition[faceModel.axes[0]] = newPosition.X;
                realPosition[faceModel.axes[1]] = newPosition.Y;
                realPosition[faceModel.axes[2]] = pair.Value[faceModel.axes[2]];

                balls.Set(realPosition, pair.Key);
            }
        }
        CheckLevelCompleted();
        HasChanged.Invoke(this);
    }
示例#11
0
        public void Update(DateTime date, decimal someValue)
        {
            var clone       = new Lookup_ParentNullable(this);
            var isCancelled = false;

            onUpdating(date, someValue, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating Lookup_ParentNullable: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            var dateRounded      = date.Floor(Rounding.Days);
            if (Date != dateRounded)
            {
                Date             = dateRounded;
                isChangeDetected = true;
            }
            var someValueRounded = someValue.Round(2);
            if (SomeValue != someValueRounded)
            {
                SomeValue        = someValueRounded;
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.Lookup_ParentNullables.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(4, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated Lookup_ParentNullable: {ToTraceString()}");
#endif
        }
示例#12
0
        public void Update(string name)
        {
            var clone       = new Playlist(this);
            var isCancelled = false;

            onUpdating(name, ref isCancelled);
            if (isCancelled)
            {
                return;
            }


            //update properties and detect if any value has changed
            var isChangeDetected = false;

            if (Name != name)
            {
                if (Key >= 0)
                {
                    DC.Data._PlaylistsByNameLower.Remove(NameLower);
                }
                Name      = name;
                NameLower = Name.ToLowerInvariant();
                if (Key >= 0)
                {
                    DC.Data._PlaylistsByNameLower.Add(NameLower, this);
                }
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data._Playlists.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(2, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
        }
示例#13
0
        public void Update(string text, int numberWithDefault)
        {
            var clone       = new SampleMaster(this);
            var isCancelled = false;

            onUpdating(text, numberWithDefault, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating SampleMaster: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (Text != text)
            {
                Text             = text;
                isChangeDetected = true;
            }
            if (NumberWithDefault != numberWithDefault)
            {
                NumberWithDefault = numberWithDefault;
                isChangeDetected  = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.SampleMasters.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(6, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated SampleMaster: {ToTraceString()}");
#endif
        }
示例#14
0
        public void Update(int playlistTrackKey)
        {
            var clone       = new PlayinglistTrack(this);
            var isCancelled = false;

            onUpdating(playlistTrackKey, ref isCancelled);
            if (isCancelled)
            {
                return;
            }


            //update properties and detect if any value has changed
            var isChangeDetected = false;

            if (PlaylistTrackKey != playlistTrackKey)
            {
                if (Key >= 0)
                {
                    DC.Data._PlayinglistTracksByPlaylistTrackKey.Remove(PlaylistTrackKey);
                }
                PlaylistTrackKey = playlistTrackKey;
                if (Key >= 0)
                {
                    DC.Data._PlayinglistTracksByPlaylistTrackKey.Add(PlaylistTrackKey, this);
                }
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data._PlayinglistTracks.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(4, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
        }
        public void Update(string textUpdateable)
        {
            var clone       = new ChildrenSortedList_ParentNullable(this);
            var isCancelled = false;

            onUpdating(textUpdateable, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating ChildrenSortedList_ParentNullable: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (TextUpdateable != textUpdateable)
            {
                TextUpdateable   = textUpdateable;
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.ChildrenSortedList_ParentNullables.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(26, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated ChildrenSortedList_ParentNullable: {ToTraceString()}");
#endif
        }
示例#16
0
        public void Update(string text)
        {
            var clone       = new ParentOneChild_Parent(this);
            var isCancelled = false;

            onUpdating(text, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating ParentOneChild_Parent: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (Text != text)
            {
                Text             = text;
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.ParentOneChild_Parents.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(9, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated ParentOneChild_Parent: {ToTraceString()}");
#endif
        }
示例#17
0
        public void Update(string demoParentData)
        {
            var clone       = new DemoParent(this);
            var isCancelled = false;

            onUpdating(demoParentData, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating DemoParent: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (DemoParentData != demoParentData)
            {
                DemoParentData   = demoParentData;
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.DemoParents.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(34, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated DemoParent: {ToTraceString()}");
#endif
        }
示例#18
0
        public void Update(Playlist playlist, Track track, int trackNo)
        {
            if (Key >= 0)
            {
                if (playlist.Key < 0)
                {
                    throw new Exception($"PlaylistTrack.Update(): It is illegal to add stored PlaylistTrack '{this}'" + Environment.NewLine +
                                        $"to Playlist '{playlist}', which is not stored.");
                }
                if (track.Key < 0)
                {
                    throw new Exception($"PlaylistTrack.Update(): It is illegal to add stored PlaylistTrack '{this}'" + Environment.NewLine +
                                        $"to Track '{track}', which is not stored.");
                }
            }
            var clone       = new PlaylistTrack(this);
            var isCancelled = false;

            onUpdating(playlist, track, trackNo, ref isCancelled);
            if (isCancelled)
            {
                return;
            }


            //remove not yet updated item from parents which will be removed by update
            var hasPlaylistChanged = Playlist != playlist;

            if (hasPlaylistChanged)
            {
                Playlist.RemoveFromPlaylistTracks(this);
            }
            var hasTrackChanged = Track != track;

            if (hasTrackChanged)
            {
                Track.RemoveFromPlaylistTracks(this);
            }

            //update properties and detect if any value has changed
            var isChangeDetected = false;

            if (Playlist != playlist)
            {
                Playlist         = playlist;
                isChangeDetected = true;
            }
            if (Track != track)
            {
                Track            = track;
                isChangeDetected = true;
            }
            if (TrackNo != trackNo)
            {
                TrackNo          = trackNo;
                isChangeDetected = true;
            }

            //add updated item to parents which have been newly added during update
            if (hasPlaylistChanged)
            {
                Playlist.AddToPlaylistTracks(this);
            }
            if (hasTrackChanged)
            {
                Track.AddToPlaylistTracks(this);
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data._PlaylistTracks.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(3, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
        }
示例#19
0
        public void Update(
            string?title,
            string?album,
            int?albumTrack,
            string?artists,
            string?composers,
            string?publisher,
            int?year,
            string?genres,
            int?weight,
            int?volume,
            int?skipStart,
            int?skipEnd,
            string titleArtists)
        {
            var clone       = new Track(this);
            var isCancelled = false;

            onUpdating(
                title,
                album,
                albumTrack,
                artists,
                composers,
                publisher,
                year,
                genres,
                weight,
                volume,
                skipStart,
                skipEnd,
                titleArtists,
                ref isCancelled);
            if (isCancelled)
            {
                return;
            }


            //update properties and detect if any value has changed
            var isChangeDetected = false;

            if (Title != title)
            {
                Title            = title;
                TitleLowerCase   = Title?.ToLowerInvariant();
                isChangeDetected = true;
            }
            if (Album != album)
            {
                Album            = album;
                AlbumLowerCase   = Album?.ToLowerInvariant();
                isChangeDetected = true;
            }
            if (AlbumTrack != albumTrack)
            {
                AlbumTrack       = albumTrack;
                isChangeDetected = true;
            }
            if (Artists != artists)
            {
                Artists          = artists;
                ArtistsLowerCase = Artists?.ToLowerInvariant();
                isChangeDetected = true;
            }
            if (Composers != composers)
            {
                Composers          = composers;
                ComposersLowerCase = Composers?.ToLowerInvariant();
                isChangeDetected   = true;
            }
            if (Publisher != publisher)
            {
                Publisher          = publisher;
                PublisherLowerCase = Publisher?.ToLowerInvariant();
                isChangeDetected   = true;
            }
            if (Year != year)
            {
                Year             = year;
                isChangeDetected = true;
            }
            if (Genres != genres)
            {
                Genres           = genres;
                isChangeDetected = true;
            }
            if (Weight != weight)
            {
                Weight           = weight;
                isChangeDetected = true;
            }
            if (Volume != volume)
            {
                Volume           = volume;
                isChangeDetected = true;
            }
            if (SkipStart != skipStart)
            {
                SkipStart        = skipStart;
                isChangeDetected = true;
            }
            if (SkipEnd != skipEnd)
            {
                SkipEnd          = skipEnd;
                isChangeDetected = true;
            }
            if (TitleArtists != titleArtists)
            {
                if (Key >= 0)
                {
                    DC.Data._TracksByTitleArtists.Remove(TitleArtists);
                }
                TitleArtists = titleArtists;
                if (Key >= 0)
                {
                    DC.Data._TracksByTitleArtists.Add(TitleArtists, this);
                }
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data._Tracks.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(1, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
        }
        public void Update(DateTime dateKey, string text, ChildrenDictionary_Parent parentWithDictionary, ChildrenDictionary_ParentNullable?parentWithDictionaryNullable)
        {
            if (Key >= 0)
            {
                if (parentWithDictionary.Key < 0)
                {
                    throw new Exception($"ChildrenDictionary_Child.Update(): It is illegal to add stored ChildrenDictionary_Child '{this}'" + Environment.NewLine +
                                        $"to ParentWithDictionary '{parentWithDictionary}', which is not stored.");
                }
                if (parentWithDictionaryNullable?.Key < 0)
                {
                    throw new Exception($"ChildrenDictionary_Child.Update(): It is illegal to add stored ChildrenDictionary_Child '{this}'" + Environment.NewLine +
                                        $"to ParentWithDictionaryNullable '{parentWithDictionaryNullable}', which is not stored.");
                }
            }
            var clone       = new ChildrenDictionary_Child(this);
            var isCancelled = false;

            onUpdating(dateKey, text, parentWithDictionary, parentWithDictionaryNullable, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating ChildrenDictionary_Child: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            var dateKeyRounded   = dateKey.Floor(Rounding.Days);
            if (DateKey != dateKeyRounded)
            {
                DateKey          = dateKeyRounded;
                isChangeDetected = true;
            }
            if (Text != text)
            {
                Text             = text;
                isChangeDetected = true;
            }
            if (ParentWithDictionary != parentWithDictionary || clone.DateKey != DateKey)
            {
                ParentWithDictionary.RemoveFromChildrenDictionary_Children(clone);
                ParentWithDictionary = parentWithDictionary;
                ParentWithDictionary.AddToChildrenDictionary_Children(this);
                isChangeDetected = true;
            }
            if (ParentWithDictionaryNullable is null)
            {
                if (parentWithDictionaryNullable is null)
                {
                    //nothing to do
                }
                else
                {
                    ParentWithDictionaryNullable = parentWithDictionaryNullable;
                    ParentWithDictionaryNullable.AddToChildrenDictionary_Children(this);
                    isChangeDetected = true;
                }
            }
            else
            {
                if (parentWithDictionaryNullable is null)
                {
                    ParentWithDictionaryNullable.RemoveFromChildrenDictionary_Children(clone);
                    ParentWithDictionaryNullable = null;
                    isChangeDetected             = true;
                }
                else
                {
                    if (ParentWithDictionaryNullable != parentWithDictionaryNullable || clone.DateKey != DateKey)
                    {
                        ParentWithDictionaryNullable.RemoveFromChildrenDictionary_Children(clone);
                        ParentWithDictionaryNullable = parentWithDictionaryNullable;
                        ParentWithDictionaryNullable.AddToChildrenDictionary_Children(this);
                        isChangeDetected = true;
                    }
                }
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.ChildrenDictionary_Children.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(24, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated ChildrenDictionary_Child: {ToTraceString()}");
#endif
        }
示例#21
0
 protected virtual void OnHasChanged()
 {
     HasChanged?.Invoke(this, EventArgs.Empty);
 }
 public virtual void NotifyChange()
 {
     HasChanged?.Invoke(this);
 }
示例#23
0
        public void Update(string updatableText, CreateOnlyParentChangeableChild_Parent parent, CreateOnlyParentChangeableChild_ParentNullable?parentNullable)
        {
            if (Key >= 0)
            {
                if (parent.Key < 0)
                {
                    throw new Exception($"CreateOnlyParentChangeableChild_Child.Update(): It is illegal to add stored CreateOnlyParentChangeableChild_Child '{this}'" + Environment.NewLine +
                                        $"to Parent '{parent}', which is not stored.");
                }
                if (parentNullable?.Key < 0)
                {
                    throw new Exception($"CreateOnlyParentChangeableChild_Child.Update(): It is illegal to add stored CreateOnlyParentChangeableChild_Child '{this}'" + Environment.NewLine +
                                        $"to ParentNullable '{parentNullable}', which is not stored.");
                }
            }
            var clone       = new CreateOnlyParentChangeableChild_Child(this);
            var isCancelled = false;

            onUpdating(updatableText, parent, parentNullable, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating CreateOnlyParentChangeableChild_Child: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (UpdatableText != updatableText)
            {
                UpdatableText    = updatableText;
                isChangeDetected = true;
            }
            if (Parent != parent)
            {
                Parent.RemoveFromCreateOnlyParentChangeableChild_Children(this);
                Parent = parent;
                Parent.AddToCreateOnlyParentChangeableChild_Children(this);
                isChangeDetected = true;
            }
            if (ParentNullable is null)
            {
                if (parentNullable is null)
                {
                    //nothing to do
                }
                else
                {
                    ParentNullable = parentNullable;
                    ParentNullable.AddToCreateOnlyParentChangeableChild_Children(this);
                    isChangeDetected = true;
                }
            }
            else
            {
                if (parentNullable is null)
                {
                    ParentNullable.RemoveFromCreateOnlyParentChangeableChild_Children(this);
                    ParentNullable   = null;
                    isChangeDetected = true;
                }
                else
                {
                    if (ParentNullable != parentNullable)
                    {
                        ParentNullable.RemoveFromCreateOnlyParentChangeableChild_Children(this);
                        ParentNullable = parentNullable;
                        ParentNullable.AddToCreateOnlyParentChangeableChild_Children(this);
                        isChangeDetected = true;
                    }
                }
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.CreateOnlyParentChangeableChild_Children.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(33, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated CreateOnlyParentChangeableChild_Child: {ToTraceString()}");
#endif
        }
示例#24
0
        public void Update(
            string text,
            bool flag,
            int number,
            decimal amount,
            decimal amount4,
            decimal?amount5,
            decimal preciseDecimal,
            SampleStateEnum sampleState,
            DateTime dateOnly,
            TimeSpan timeOnly,
            DateTime dateTimeTicks,
            DateTime dateTimeMinute,
            DateTime dateTimeSecond,
            SampleMaster?oneMaster,
            SampleMaster?otherMaster,
            string?optional)
        {
            if (Key >= 0)
            {
                if (oneMaster?.Key < 0)
                {
                    throw new Exception($"Sample.Update(): It is illegal to add stored Sample '{this}'" + Environment.NewLine +
                                        $"to OneMaster '{oneMaster}', which is not stored.");
                }
                if (otherMaster?.Key < 0)
                {
                    throw new Exception($"Sample.Update(): It is illegal to add stored Sample '{this}'" + Environment.NewLine +
                                        $"to OtherMaster '{otherMaster}', which is not stored.");
                }
            }
            var clone       = new Sample(this);
            var isCancelled = false;

            onUpdating(
                text,
                flag,
                number,
                amount,
                amount4,
                amount5,
                preciseDecimal,
                sampleState,
                dateOnly,
                timeOnly,
                dateTimeTicks,
                dateTimeMinute,
                dateTimeSecond,
                oneMaster,
                otherMaster,
                optional,
                ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating Sample: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (Text != text)
            {
                Text             = text;
                isChangeDetected = true;
            }
            if (Flag != flag)
            {
                Flag             = flag;
                isChangeDetected = true;
            }
            if (Number != number)
            {
                Number           = number;
                isChangeDetected = true;
            }
            var amountRounded = amount.Round(2);
            if (Amount != amountRounded)
            {
                Amount           = amountRounded;
                isChangeDetected = true;
            }
            var amount4Rounded = amount4.Round(4);
            if (Amount4 != amount4Rounded)
            {
                Amount4          = amount4Rounded;
                isChangeDetected = true;
            }
            var amount5Rounded = amount5.Round(5);
            if (Amount5 != amount5Rounded)
            {
                Amount5          = amount5Rounded;
                isChangeDetected = true;
            }
            if (PreciseDecimal != preciseDecimal)
            {
                PreciseDecimal   = preciseDecimal;
                isChangeDetected = true;
            }
            if (SampleState != sampleState)
            {
                SampleState      = sampleState;
                isChangeDetected = true;
            }
            var dateOnlyRounded = dateOnly.Floor(Rounding.Days);
            if (DateOnly != dateOnlyRounded)
            {
                DateOnly         = dateOnlyRounded;
                isChangeDetected = true;
            }
            var timeOnlyRounded = timeOnly.Round(Rounding.Seconds);
            if (TimeOnly != timeOnlyRounded)
            {
                TimeOnly         = timeOnlyRounded;
                isChangeDetected = true;
            }
            if (DateTimeTicks != dateTimeTicks)
            {
                DateTimeTicks    = dateTimeTicks;
                isChangeDetected = true;
            }
            var dateTimeMinuteRounded = dateTimeMinute.Round(Rounding.Minutes);
            if (DateTimeMinute != dateTimeMinuteRounded)
            {
                DateTimeMinute   = dateTimeMinuteRounded;
                isChangeDetected = true;
            }
            var dateTimeSecondRounded = dateTimeSecond.Round(Rounding.Seconds);
            if (DateTimeSecond != dateTimeSecondRounded)
            {
                DateTimeSecond   = dateTimeSecondRounded;
                isChangeDetected = true;
            }
            if (OneMaster is null)
            {
                if (oneMaster is null)
                {
                    //nothing to do
                }
                else
                {
                    OneMaster = oneMaster;
                    OneMaster.AddToSampleX(this);
                    isChangeDetected = true;
                }
            }
            else
            {
                if (oneMaster is null)
                {
                    OneMaster.RemoveFromSampleX(this);
                    OneMaster        = null;
                    isChangeDetected = true;
                }
                else
                {
                    if (OneMaster != oneMaster)
                    {
                        OneMaster.RemoveFromSampleX(this);
                        OneMaster = oneMaster;
                        OneMaster.AddToSampleX(this);
                        isChangeDetected = true;
                    }
                }
            }
            if (OtherMaster is null)
            {
                if (otherMaster is null)
                {
                    //nothing to do
                }
                else
                {
                    OtherMaster = otherMaster;
                    OtherMaster.AddToSampleX(this);
                    isChangeDetected = true;
                }
            }
            else
            {
                if (otherMaster is null)
                {
                    OtherMaster.RemoveFromSampleX(this);
                    OtherMaster      = null;
                    isChangeDetected = true;
                }
                else
                {
                    if (OtherMaster != otherMaster)
                    {
                        OtherMaster.RemoveFromSampleX(this);
                        OtherMaster = otherMaster;
                        OtherMaster.AddToSampleX(this);
                        isChangeDetected = true;
                    }
                }
            }
            if (Optional != optional)
            {
                Optional         = optional;
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.SampleX.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(7, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated Sample: {ToTraceString()}");
#endif
        }
示例#25
0
        public void Update(string text, Lookup_Parent lookupParent, Lookup_ParentNullable?lookupParentNullable)
        {
            if (Key >= 0)
            {
                if (lookupParent.Key < 0)
                {
                    throw new Exception($"Lookup_Child.Update(): It is illegal to add stored Lookup_Child '{this}'" + Environment.NewLine +
                                        $"to LookupParent '{lookupParent}', which is not stored.");
                }
                if (lookupParentNullable?.Key < 0)
                {
                    throw new Exception($"Lookup_Child.Update(): It is illegal to add stored Lookup_Child '{this}'" + Environment.NewLine +
                                        $"to LookupParentNullable '{lookupParentNullable}', which is not stored.");
                }
            }
            var clone       = new Lookup_Child(this);
            var isCancelled = false;

            onUpdating(text, lookupParent, lookupParentNullable, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating Lookup_Child: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (Text != text)
            {
                Text             = text;
                isChangeDetected = true;
            }
            if (LookupParent != lookupParent)
            {
                LookupParent     = lookupParent;
                isChangeDetected = true;
            }
            if (LookupParentNullable is null)
            {
                if (lookupParentNullable is null)
                {
                    //nothing to do
                }
                else
                {
                    LookupParentNullable = lookupParentNullable;
                    isChangeDetected     = true;
                }
            }
            else
            {
                if (lookupParentNullable is null)
                {
                    LookupParentNullable = null;
                    isChangeDetected     = true;
                }
                else
                {
                    if (LookupParentNullable != lookupParentNullable)
                    {
                        LookupParentNullable = lookupParentNullable;
                        isChangeDetected     = true;
                    }
                }
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.Lookup_Children.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(5, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated Lookup_Child: {ToTraceString()}");
#endif
        }
示例#26
0
 private void Tracking_HasChanged(object sender, EventArgs e)
 {
     HasChanged?.Invoke(this, EventArgs.Empty);
 }
示例#27
0
        public void Update(
            DateTime aDate,
            DateTime?aNullableDate,
            TimeSpan aTime,
            TimeSpan?aNullableTime,
            DateTime aDateMinutes,
            DateTime?aNullableDateMinutes,
            DateTime aDateSeconds,
            DateTime?aNullableDateSeconds,
            DateTime aDateTime,
            DateTime?aNullableDateTime,
            TimeSpan aTimeSpan,
            TimeSpan?aNullableTimeSpan,
            decimal aDecimal,
            decimal?aNullableDecimal,
            decimal aDecimal2,
            decimal?aNullableDecimal2,
            decimal aDecimal4,
            decimal?aNullableDecimal4,
            decimal aDecimal5,
            decimal?aNullableDecimal5,
            bool aBool,
            bool?aNullableBool,
            int aInt,
            int?aNullableInt,
            long aLong,
            long?aNullableLong,
            char aChar,
            char?aNullableChar,
            string aString,
            string?aNullableString,
            SampleStateEnum aEnum,
            SampleStateEnum?aNullableEnum)
        {
            var clone       = new DataTypeSample(this);
            var isCancelled = false;

            onUpdating(
                aDate,
                aNullableDate,
                aTime,
                aNullableTime,
                aDateMinutes,
                aNullableDateMinutes,
                aDateSeconds,
                aNullableDateSeconds,
                aDateTime,
                aNullableDateTime,
                aTimeSpan,
                aNullableTimeSpan,
                aDecimal,
                aNullableDecimal,
                aDecimal2,
                aNullableDecimal2,
                aDecimal4,
                aNullableDecimal4,
                aDecimal5,
                aNullableDecimal5,
                aBool,
                aNullableBool,
                aInt,
                aNullableInt,
                aLong,
                aNullableLong,
                aChar,
                aNullableChar,
                aString,
                aNullableString,
                aEnum,
                aNullableEnum,
                ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating DataTypeSample: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            var aDateRounded     = aDate.Floor(Rounding.Days);
            if (ADate != aDateRounded)
            {
                ADate            = aDateRounded;
                isChangeDetected = true;
            }
            var aNullableDateRounded = aNullableDate.Floor(Rounding.Days);
            if (ANullableDate != aNullableDateRounded)
            {
                ANullableDate    = aNullableDateRounded;
                isChangeDetected = true;
            }
            var aTimeRounded = aTime.Round(Rounding.Seconds);
            if (ATime != aTimeRounded)
            {
                ATime            = aTimeRounded;
                isChangeDetected = true;
            }
            var aNullableTimeRounded = aNullableTime.Round(Rounding.Seconds);
            if (ANullableTime != aNullableTimeRounded)
            {
                ANullableTime    = aNullableTimeRounded;
                isChangeDetected = true;
            }
            var aDateMinutesRounded = aDateMinutes.Round(Rounding.Minutes);
            if (ADateMinutes != aDateMinutesRounded)
            {
                ADateMinutes     = aDateMinutesRounded;
                isChangeDetected = true;
            }
            var aNullableDateMinutesRounded = aNullableDateMinutes.Round(Rounding.Minutes);
            if (ANullableDateMinutes != aNullableDateMinutesRounded)
            {
                ANullableDateMinutes = aNullableDateMinutesRounded;
                isChangeDetected     = true;
            }
            var aDateSecondsRounded = aDateSeconds.Round(Rounding.Seconds);
            if (ADateSeconds != aDateSecondsRounded)
            {
                ADateSeconds     = aDateSecondsRounded;
                isChangeDetected = true;
            }
            var aNullableDateSecondsRounded = aNullableDateSeconds.Round(Rounding.Seconds);
            if (ANullableDateSeconds != aNullableDateSecondsRounded)
            {
                ANullableDateSeconds = aNullableDateSecondsRounded;
                isChangeDetected     = true;
            }
            if (ADateTime != aDateTime)
            {
                ADateTime        = aDateTime;
                isChangeDetected = true;
            }
            if (ANullableDateTime != aNullableDateTime)
            {
                ANullableDateTime = aNullableDateTime;
                isChangeDetected  = true;
            }
            if (ATimeSpan != aTimeSpan)
            {
                ATimeSpan        = aTimeSpan;
                isChangeDetected = true;
            }
            if (ANullableTimeSpan != aNullableTimeSpan)
            {
                ANullableTimeSpan = aNullableTimeSpan;
                isChangeDetected  = true;
            }
            if (ADecimal != aDecimal)
            {
                ADecimal         = aDecimal;
                isChangeDetected = true;
            }
            if (ANullableDecimal != aNullableDecimal)
            {
                ANullableDecimal = aNullableDecimal;
                isChangeDetected = true;
            }
            var aDecimal2Rounded = aDecimal2.Round(2);
            if (ADecimal2 != aDecimal2Rounded)
            {
                ADecimal2        = aDecimal2Rounded;
                isChangeDetected = true;
            }
            var aNullableDecimal2Rounded = aNullableDecimal2.Round(2);
            if (ANullableDecimal2 != aNullableDecimal2Rounded)
            {
                ANullableDecimal2 = aNullableDecimal2Rounded;
                isChangeDetected  = true;
            }
            var aDecimal4Rounded = aDecimal4.Round(4);
            if (ADecimal4 != aDecimal4Rounded)
            {
                ADecimal4        = aDecimal4Rounded;
                isChangeDetected = true;
            }
            var aNullableDecimal4Rounded = aNullableDecimal4.Round(4);
            if (ANullableDecimal4 != aNullableDecimal4Rounded)
            {
                ANullableDecimal4 = aNullableDecimal4Rounded;
                isChangeDetected  = true;
            }
            var aDecimal5Rounded = aDecimal5.Round(5);
            if (ADecimal5 != aDecimal5Rounded)
            {
                ADecimal5        = aDecimal5Rounded;
                isChangeDetected = true;
            }
            var aNullableDecimal5Rounded = aNullableDecimal5.Round(5);
            if (ANullableDecimal5 != aNullableDecimal5Rounded)
            {
                ANullableDecimal5 = aNullableDecimal5Rounded;
                isChangeDetected  = true;
            }
            if (ABool != aBool)
            {
                ABool            = aBool;
                isChangeDetected = true;
            }
            if (ANullableBool != aNullableBool)
            {
                ANullableBool    = aNullableBool;
                isChangeDetected = true;
            }
            if (AInt != aInt)
            {
                AInt             = aInt;
                isChangeDetected = true;
            }
            if (ANullableInt != aNullableInt)
            {
                ANullableInt     = aNullableInt;
                isChangeDetected = true;
            }
            if (ALong != aLong)
            {
                ALong            = aLong;
                isChangeDetected = true;
            }
            if (ANullableLong != aNullableLong)
            {
                ANullableLong    = aNullableLong;
                isChangeDetected = true;
            }
            if (AChar != aChar)
            {
                AChar            = aChar;
                isChangeDetected = true;
            }
            if (ANullableChar != aNullableChar)
            {
                ANullableChar    = aNullableChar;
                isChangeDetected = true;
            }
            if (AString != aString)
            {
                AString          = aString;
                isChangeDetected = true;
            }
            if (ANullableString != aNullableString)
            {
                ANullableString  = aNullableString;
                isChangeDetected = true;
            }
            if (AEnum != aEnum)
            {
                AEnum            = aEnum;
                isChangeDetected = true;
            }
            if (ANullableEnum != aNullableEnum)
            {
                ANullableEnum    = aNullableEnum;
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.DataTypeSamples.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(0, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated DataTypeSample: {ToTraceString()}");
#endif
        }
示例#28
0
        public void Update(int idInt, string?idString, string text, string?textNullable)
        {
            var clone       = new PropertyNeedsDictionaryClass(this);
            var isCancelled = false;

            onUpdating(idInt, idString, text, textNullable, ref isCancelled);
            if (isCancelled)
            {
                return;
            }

#if DEBUG
            DC.Trace?.Invoke($"Updating PropertyNeedsDictionaryClass: {ToTraceString()}");
#endif
            var isChangeDetected = false;
            if (IdInt != idInt)
            {
                if (Key >= 0)
                {
                    DC.Data._PropertyNeedsDictionaryClassesByIdInt.Remove(IdInt);
                }
                IdInt = idInt;
                if (Key >= 0)
                {
                    DC.Data._PropertyNeedsDictionaryClassesByIdInt.Add(IdInt, this);
                }
                isChangeDetected = true;
            }
            if (IdString != idString)
            {
                if (Key >= 0)
                {
                    if (IdString != null)
                    {
                        DC.Data._PropertyNeedsDictionaryClassesByIdString.Remove(IdString);
                    }
                }
                IdString = idString;
                if (Key >= 0)
                {
                    if (IdString != null)
                    {
                        DC.Data._PropertyNeedsDictionaryClassesByIdString.Add(IdString, this);
                    }
                }
                isChangeDetected = true;
            }
            if (Text != text)
            {
                if (Key >= 0)
                {
                    DC.Data._PropertyNeedsDictionaryClassesByTextLower.Remove(TextLower);
                }
                Text      = text;
                TextLower = Text.ToLowerInvariant();
                if (Key >= 0)
                {
                    DC.Data._PropertyNeedsDictionaryClassesByTextLower.Add(TextLower, this);
                }
                isChangeDetected = true;
            }
            if (TextNullable != textNullable)
            {
                if (Key >= 0)
                {
                    if (TextNullableLower != null)
                    {
                        DC.Data._PropertyNeedsDictionaryClassesByTextNullableLower.Remove(TextNullableLower);
                    }
                }
                TextNullable      = textNullable;
                TextNullableLower = TextNullable?.ToLowerInvariant();
                if (Key >= 0)
                {
                    if (TextNullableLower != null)
                    {
                        DC.Data._PropertyNeedsDictionaryClassesByTextNullableLower.Add(TextNullableLower, this);
                    }
                }
                isChangeDetected = true;
            }
            if (isChangeDetected)
            {
                onUpdated(clone);
                if (Key >= 0)
                {
                    DC.Data.PropertyNeedsDictionaryClasses.ItemHasChanged(clone, this);
                }
                else if (DC.Data.IsTransaction)
                {
                    DC.Data.AddTransaction(new TransactionItem(2, TransactionActivityEnum.Update, Key, this, oldItem: clone));
                }
                HasChanged?.Invoke(clone, this);
            }
#if DEBUG
            DC.Trace?.Invoke($"Updated PropertyNeedsDictionaryClass: {ToTraceString()}");
#endif
        }