Beispiel #1
0
        private void Save(object sender, ExecutedRoutedEventArgs e)
        {
            /*if (File.Directory != null)
             *  File.CopyTo(Path.Combine(File.Directory.FullName, Path.GetFileNameWithoutExtension(File.Name)) + ".backup", true);*/

            SaveDifficulty();

            EndGnomeEdit();
            Gnomes.ToList().ForEach(x => x.Save());
            Enemies.ForEach(x => x.Save());
            //GnomanEmpire.Instance.Camera.Update(1.0f);

            ProgressBar.Visibility = Visibility.Visible;
            var worker = new BackgroundWorker();

            worker.DoWork             += SaverSave;
            worker.RunWorkerCompleted += SaverComplete;
            worker.RunWorkerAsync();

            /*if(worker.IsBusy == false)
             *          {
             *                  SaveDifficulty();
             *
             *                  EndGnomeEdit();
             *                  Gnomes.ToList().ForEach(x => x.Save());
             *                  Enemies.ForEach(x => x.Save());
             *
             *                  ProgressBar.Visibility = Visibility.Visible;
             *                  var worker1 = new BackgroundWorker();
             *                  worker1.DoWork += SaverSave;
             *                  worker1.RunWorkerCompleted += SaverComplete1;
             *                  worker1.RunWorkerAsync();
             *          }*/
        }
Beispiel #2
0
        private void LoadGnomes()
        {
            var chars = GnomanEmpire.Instance.EntityManager.Entities
                        .Where(x => x.Value.TypeID() == (int)GameEntityType.Character)
                        .Select(x => x.Value)
                        .Cast <Character>();

            chars.Where(x => x.RaceID == RaceID.Gnome.ToString())
            .Select(x => new GnomeRow(x))
            .ToList()
            .ForEach(gnome =>
            {
                if (Gnomes.All(x => x.Id != gnome.Id))
                {
                    Gnomes.Add(gnome);
                }
            });
        }