Exemplo n.º 1
0
        private async Task focus(object sender, Point position)
        {
            var memStream = new InMemoryRandomAccessStream();
            var encoder   = await BitmapEncoder.CreateForTranscodingAsync(memStream, decoder);

            // flush content in bounds into memStream
            await encoder.FlushAsync();

            Frame root = Window.Current.Content as Frame;

            RecognizingPopup popUp = new RecognizingPopup();

            try
            {
                var realX = (position.X / imgView.RenderSize.Width) * decoder.PixelWidth;
                var realY = (position.Y / imgView.RenderSize.Height) * decoder.PixelHeight;

                Debug.WriteLine("holding: " + realX + ", " + realY);

                // animation
                outmostGridView.Opacity = backgroundOpacity;
                popUp.Show();
                var memo = await NetHelper.ResolveImage(memStream, realX, realY);

                // finish animation
                popUp.Dispose();

                root.Navigate(typeof(MemoModifyPage), memo);
            }
            catch (COMException ex)
            {
                popUp.Dispose();
                await handleNetException(root);
            }
        }
Exemplo n.º 2
0
        private async void OnOK(object sender, RoutedEventArgs e)
        {
            if (recognizing)
            {
                return;
            }
            else
            {
                recognizing = true;
            }

            var memStream = await Capture();

            Frame root = Window.Current.Content as Frame;

            RecognizingPopup popUp = new RecognizingPopup();

            try
            {
                // animation
                outmostGridView.Opacity = backgroundOpacity;
                popUp.Show();

                var memo = await NetHelper.ResolveImage(memStream);

                // finish animation
                popUp.Dispose();

                root.Navigate(typeof(MemoModifyPage), memo);
            }
            catch (COMException)
            {
                popUp.Dispose();
                await handleNetException(root);
            }
        }