Exemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();

            vM = new ViewModel(Game.CreateNew());
            this.DataContext = vM;
        }
Exemplo n.º 2
0
 private void Restart_Button_Click(object sender, RoutedEventArgs e)
 {
     vM = new ViewModel(Game.CreateNew());
     this.DataContext = vM;
 }
Exemplo n.º 3
0
        private void Load_Button_Click(object sender, RoutedEventArgs e)
        {
            String Path = "../../_Resources/Save.txt";
            Player Playr=null;

            ArrayList Lines = new ArrayList();

            using (StreamReader sr = File.OpenText(Path))
            {
                String str = "";

                while ((str = sr.ReadLine()) != null)
                {
                    Lines.Add(str);
                }
            }

            String[] Lns = new String[Lines.Count-1];

            int i = 0;

            foreach(object L in Lines){
                String Line = (String) L;
                if (i < Lns.Length)
                {
                    Lns[i] = Line;
                }
                else
                {
                    if (Line.Equals("1"))
                    {
                        Playr = Player.ONE;
                    }
                    else if (Line.Equals("2"))
                    {
                        Playr = Player.TWO;
                    }
                }

                i++;
            }

            var Board=vM.ConvertSavedData(Lns);

            vM = new ViewModel(Game.CreateInProgress(Board, Playr));
            this.DataContext = vM;
        }