public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { StrokeCollection strokeColletion = value as StrokeCollection; ViewModels.StrokePattern strokePattern = new ViewModels.StrokePattern(); foreach (Stroke stroke in strokeColletion) { strokePattern.Items.Add(new StrokeCollection { stroke }); } strokePattern.PatternName = parameter as string; return strokePattern; }
static void CreatingPage_GetResault(PhoneApplicationPage sender, string obj) { foreach (ApplicationBarIconButton appBarBtn in (sender as CreatingPage).ApplicationBar.Buttons) { appBarBtn.IsEnabled = true; } if (obj != null) { StrokePattern newPattern = new StrokePattern(); newPattern.PatternName = obj; foreach (Stroke stroke in (sender as CreatingPage).inkPresenter.Strokes) { Stroke modifiedStroke = new Stroke(); modifiedStroke.DrawingAttributes.Color = Colors.White; modifiedStroke.DrawingAttributes.Width = 3; modifiedStroke.DrawingAttributes.Height = 3; foreach (StylusPoint point in stroke.StylusPoints) { modifiedStroke.StylusPoints.Add(new StylusPoint(point.X / 3, point.Y / 3)); } newPattern.Items.Add(new StrokeCollection { modifiedStroke }); } App.PatternViewModel.UserPatterns.Add(newPattern); sender.NavigationService.GoBack(); } }