コード例 #1
0
        private async void join_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var picker = new FileOpenPicker();
                picker.ViewMode = PickerViewMode.Thumbnail;
                picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                picker.FileTypeFilter.Add(".png");
                picker.FileTypeFilter.Add(".jpg");
                picker.FileTypeFilter.Add(".jpeg"); var filePickerResult = await picker.PickSingleFileAsync();

                if (filePickerResult != null)
                {
                    var bytes = (await FileIO.ReadBufferAsync(filePickerResult)).ToArray();
                    var proxy = new GameServiceProxy(new Uri("http://localhost:5000"));
                    var game  = await proxy.CreateGame("Mats");

                    game = await proxy.GetGame(game.Id);

                    game = (await proxy.SubmitAnswer(game.Id, bytes)).Item2;
                }
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        private async void Start()
        {
            var context = SimpleIoc.Default.GetInstance <SnapFeudContext>();
            var game    = await _gameProxy.CreateGame(UserName);

            if (game == null)
            {
                return;
            }
            context.UserName    = UserName;
            context.CurrentGame = game;
            _navigationService.Navigate(typeof(GamePage));
        }