示例#1
0
 public static async Task<TextBlockLogger> Create(TextBlock tb, ScrollViewer sv)
 {
     var logger = new TextBlockLogger(tb, sv);
     var local = ApplicationData.Current.LocalFolder;
     var filename = string.Format("game_{0}.log", DateTime.Now.ToFileTime());
     logger._file = await local.CreateFileAsync(filename, CreationCollisionOption.GenerateUniqueName);
     logger._block.Text = "log location: " + logger._file.Path;
     return logger;
 }
示例#2
0
        public static async Task <TextBlockLogger> Create(TextBlock tb, ScrollViewer sv)
        {
            var logger   = new TextBlockLogger(tb, sv);
            var local    = ApplicationData.Current.LocalFolder;
            var filename = string.Format("game_{0}.log", DateTime.Now.ToFileTime());

            logger._file = await local.CreateFileAsync(filename, CreationCollisionOption.GenerateUniqueName);

            logger._block.Text = "log location: " + logger._file.Path;
            return(logger);
        }
示例#3
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        async protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            Global.Logger = await TextBlockLogger.Create(Log, ScrollLog);

            Game.NewGame(asciipaint => Table.Text = asciipaint);

            Table.Focus(Windows.UI.Xaml.FocusState.Programmatic);
            while (true)
            {
                var  game   = Game.Instance();
                bool killed = await game.Play();

                if (!killed)
                {
                    //should await a keypress instead of 10 seconds
                    await Task.Delay(10000);

                    Game.NewGame(asciipaint => Table.Text = asciipaint);
                }
            }
        }