Пример #1
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     using (var db = new SaveGameContext())
     {
         db.Levels.Add(levels);
         db.SaveChanges();
     }
 }
Пример #2
0
        public Form1()
        {
            InitializeComponent();
            menuStrip1.Visible = false;

            using (var data = new SaveGameContext())
            {
                var query = (from b in data.Levels select b);
                foreach (var item in query)
                {
                    levels = item;
                    data.Levels.Remove(item);
                }
                data.SaveChanges();
                if (levels == null)
                {
                    levels = new Levels(true);
                }
            }
            this.BackgroundImage = Resources.finkiman;
            levels                   = new Levels(true);
            windowType               = WindowTypeSize.big;
            DoubleBuffered           = true;
            animationFinish          = new Timer();
            animationFinish.Interval = 5;
            animationFinish.Tick    += new EventHandler(animationFinish_Tick);
            levelTimer               = new Timer();
            levelTimer.Interval      = 1000;
            levelTimer.Tick         += new EventHandler(levelTimer_Tick);
            timeRect                 = new Rectangle(6 * Game.squareDimension + 2 * Figura.paddingX, menuStrip1.Height, 2 * Game.squareDimension, Game.squareDimension);
            FontSize                 = 14;
            this.FormBorderStyle     = FormBorderStyle.FixedSingle;
            initializePoints();
            paused     = false;
            pauseMoves = pauseTime = 0;
            mainWindow = true;
        }