Ejemplo n.º 1
0
        /// <summary>
        /// Method starts game process.
        /// </summary>
        public void Start()
        {
            _fileWorker = new FileWriterJSON(_path);
            int typeOfPlaygroundCreation = _userUI.StartMenuItem();
            int howMuchCanSelect         = CreatePlaygroundArrayForSelectedMenuItem(typeOfPlaygroundCreation);

            _arrayWithSelectedPlaygrounds = _userUI.SelectPlaygroundsID(_gamePlaygroundArray.NumberOfArrays, howMuchCanSelect);

            TimerCallback tm    = new TimerCallback(GameLifeCycle);
            Timer         timer = new Timer(tm, null, 0, 1000);

            _userUI.KeyLogerToExit(ConsoleKey.Escape);
            timer.Dispose();

            int selectedOption = _userUI.ShowSaveMenu();

            SaveGameOrNo(selectedOption);
        }
Ejemplo n.º 2
0
        void ProcessFile(object sender, EventArgs e)
        {
            GoPGP GoPgp = new GoPGP();

            IWorkWithFile WorkFile = DependencyService.Get <IWorkWithFile>();
            string        WayHome  = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            int    index      = FilePath.LastIndexOf('\\');
            string PathFolder = FilePath.Substring(0, index);

            Task.Run(() => WorkFile.MoveToAsync(FilePath, WayHome));
            Thread.Sleep(1500);
            WayHome = Option ? GoPgp.DecodeFile(WayHome + "\\" + FileName) : GoPgp.EncodeFile(WayHome + "\\" + FileName);
            Task.Run(() => WorkFile.MoveToAsync(WayHome, PathFolder));
            Thread.Sleep(1500);

            ICloseApplication closer = DependencyService.Get <ICloseApplication>();

            closer?.closeApplication();
        }