Сохраненные баллы будут переданы на другую страницу .xaml и отображены на canvas.children. - PullRequest
0 голосов
/ 19 августа 2011
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace MobileElite
{
public partial class signature : PhoneApplicationPage
{
    private Polyline _lineBeingDrawn;
    private List <Point> _points = new List<Point>();  
    public signature()
    {
        InitializeComponent();
    }

    private void Canvas_ManipulationCompleted(object sender, System.Windows.Input.ManipulationCompletedEventArgs e)
    {
        // Here we want to simply add the points information to the list of points we  
        // are capturing in order to redraw this later if needed.  
        foreach (Point p in _points)
        {
            _points.ToList<Point>(); 
        }
        //_points.Add(_lineBeingDrawn.Points);
    }

    private void Canvas_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
    {
         // Here we are adding new points to the PolyLine we created and added as a child   
        // in the Started event above  
        _lineBeingDrawn.Points.Add(new Point(e.ManipulationOrigin.X, e.ManipulationOrigin.Y));
    }

    private void Canvas_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
    {
        // Here we want to start our new line for drawing and we want to   
        // add the polyline as a child item to the SignatureCanvas.  
        _lineBeingDrawn = new Polyline
        {
            Stroke = new SolidColorBrush(Colors.Black),
            StrokeThickness = 6.5,
            Points = new PointCollection { new Point(e.ManipulationOrigin.X, e.ManipulationOrigin.Y) }
        };


        SignatureCanvas.Children.Add(_lineBeingDrawn);
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        //Submit Button Click Handling

    }

    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        SignatureCanvas.Children.Clear();
    }
}
}

Так что мне нужно иметь возможность пропустить все точки в списке и заново нарисовать их на следующей странице на холсте, как бы я это сделал, не меняя при этом большой кодуже?

1 Ответ

0 голосов
/ 31 января 2012

Создать статический класс, общий для страниц, и поместить в него объект

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...