상속: INotifyPropertyChanging, INotifyPropertyChanged
예제 #1
0
 public async void AddBug(Bug aBug)
 {
     await _bugCollection.InsertOneAsync(aBug);
 }
		private void attach_Bugs(Bug entity)
		{
			this.SendPropertyChanging();
			entity.Tester = this;
		}
		private void detach_Bugs(Bug entity)
		{
			this.SendPropertyChanging();
			entity.Tester = null;
		}
 partial void UpdateBug(Bug instance);
 partial void DeleteBug(Bug instance);
예제 #6
0
        public static void Update(Bug bug)
        {
            DataClassesBugTrackingSystemDataContext db = new DataClassesBugTrackingSystemDataContext();

            Bug bugToUpdate = db.Bugs.Single(t => t.BugId == bug.BugId);

            bugToUpdate.Description = bug.Description;
            bugToUpdate.Priority = bug.Priority;
            bugToUpdate.Status = bug.Status;
            db.SubmitChanges();
        }
 partial void InsertBug(Bug instance);
예제 #8
0
 private void detach_Bugs(Bug entity)
 {
     this.SendPropertyChanging();
     entity.Tester = null;
 }
예제 #9
0
        public static int Insert(Bug bug)
        {
            DataClassesBugTrackingSystemDataContext db = new DataClassesBugTrackingSystemDataContext();

            db.Bugs.InsertOnSubmit(bug);
            db.SubmitChanges();

            return bug.BugId;
        }
예제 #10
0
 private void attach_Bugs(Bug entity)
 {
     this.SendPropertyChanging();
     entity.Tester = this;
 }
예제 #11
0
 partial void DeleteBug(Bug instance);
예제 #12
0
 partial void UpdateBug(Bug instance);
예제 #13
0
 partial void InsertBug(Bug instance);
예제 #14
0
        /// <summary>
        /// Создание детей в случае гибели всех жуков
        /// </summary>
        public static void CreateChildsBugs()
        {
            KillBugs();
            SortBugs();
            if (Bug.Generation % 50 == 0)
            {
                PrintInFile();
            }
            Bug[] child = new Bug[MaxNumberBugs];
            CurrentNumberBugs = 0;
            int cellRndX = 0;
            int cellRndY = 0;

            for (int indexParent = 0; indexParent < 8; indexParent++)
            {
                for (int childIndex = 0; childIndex < 8; childIndex++)
                {
                    int[] childGenom = new int [Bug.PublicLengthGenom];
                    for (int indexGenom = 0; indexGenom < Bug.PublicLengthGenom; indexGenom++)
                    {
                        childGenom[indexGenom] = Bugs[MaxNumberBugs - indexParent - 1].Genom[indexGenom];
                    }
                    if (childIndex > 4)
                    {
                        int rndParent = Rnd.Next(0, 8);
                        for (int indexGenom = 0; indexGenom < Bug.PublicLengthGenom; indexGenom++)
                        {
                            if (Bugs[MaxNumberBugs - indexParent - 1].Genom[indexGenom] ==
                                Bugs[MaxNumberBugs - rndParent - 1].Genom[indexGenom])
                            {
                                childGenom[indexGenom] = Bugs[MaxNumberBugs - indexParent - 1].Genom[indexGenom];
                            }
                            else
                            {
                                if (Rnd.Next(0, 2) == 0)
                                {
                                    childGenom[indexGenom] = Bugs[MaxNumberBugs - rndParent - 1].Genom[indexGenom];
                                }
                                else
                                {
                                    childGenom[indexGenom] = Bugs[MaxNumberBugs - indexParent - 1].Genom[indexGenom];
                                }
                            }
                        }
                        int rndKol = Rnd.Next(0, 3);
                        for (int i = 0; i < rndKol; i++)
                        {
                            childGenom[Rnd.Next(0, Bug.PublicLengthGenom)] = Rnd.Next(0, Bug.PublicLengthGenom);
                        }
                    }
                    while (Field[cellRndY, cellRndX].PublicContent != 0)
                    {
                        cellRndY = Rnd.Next(0, SizeMapY);
                        cellRndX = Rnd.Next(0, SizeMapX);
                    }
                    child[CurrentNumberBugs] = new Bug(cellRndX, cellRndY, childGenom, Rnd.Next(0, 8));
                    Field[cellRndY, cellRndX].PublicContent = Bug.PublicTypeCell;
                    CurrentNumberBugs++;
                }
            }
            Bugs = child;
            Bug.Generation++;
            FileStream      bugsFile = new FileStream("SaveGeneration\\Bugs.bin", FileMode.OpenOrCreate);
            BinaryFormatter binForm  = new BinaryFormatter();

            binForm.Serialize(bugsFile, child);
            bugsFile.Close();
        }