コード例 #1
0
        private void RestoreState(GraffitiCacheData cacheData)
        {
            List <GraffitiCacheDataCurve> graffitiCacheDataCurveList = cacheData != null?cacheData.Curves.ToList <GraffitiCacheDataCurve>() : (List <GraffitiCacheDataCurve>)null;

            if (graffitiCacheDataCurveList == null)
            {
                return;
            }
            foreach (GraffitiCacheDataCurve graffitiCacheDataCurve in graffitiCacheDataCurveList)
            {
                List <Point> points          = graffitiCacheDataCurve.GetPoints();
                string       colorHex        = graffitiCacheDataCurve.ColorHex;
                int          strokeThickness = graffitiCacheDataCurve.StrokeThickness;
                this._graffitiDrawService.StrokeBrush     = new SolidColorBrush(colorHex.ToColor());
                this._graffitiDrawService.StrokeThickness = strokeThickness;
                for (int index = 0; index < points.Count; ++index)
                {
                    this.HandleTouchPoint(points[index], index == points.Count - 1);
                }
            }
            string selectedColorHex        = cacheData.SelectedColorHex;
            int    selectedStrokeThickness = cacheData.SelectedStrokeThickness;

            this.ucGraffitiPallete.SetColor(selectedColorHex);
            this.ucBrushThickness.SetThickness(selectedStrokeThickness);
            this.ucBrushThickness.SetFillColor(selectedColorHex.ToColor());
            this.UpdateUndoOpacity();
        }
コード例 #2
0
 protected override void HandleOnNavigatedFrom(NavigationEventArgs e)
 {
     base.HandleOnNavigatedFrom(e);
     this.UnsubscribeFromFrameReported();
     AccelerometerHelper.Instance.IsActive = false;
     DeviceOrientationHelper.Instance.OrientationChanged -= new EventHandler <DeviceOrientationChangedEventArgs>(this.OnOrientationChanged);
     if (e.NavigationMode == NavigationMode.Back)
     {
         this.ResetState();
     }
     else
     {
         GraffitiCacheData graffitiCacheData = this._graffitiDrawService.GraffitiCacheData;
         string            str = this.ucGraffitiPallete.CurrentColor.ToString();
         graffitiCacheData.SelectedColorHex = str;
         int currentThickness = this.ucBrushThickness.CurrentThickness;
         graffitiCacheData.SelectedStrokeThickness = currentThickness;
         this.SaveState(this._graffitiDrawService.GraffitiCacheData);
     }
 }
コード例 #3
0
        private void RestoreState(GraffitiCacheData cacheData)
        {
            List <GraffitiCacheDataCurve> graffitiCacheDataCurveList = cacheData != null?Enumerable.ToList <GraffitiCacheDataCurve>(cacheData.Curves) : null;

            if (graffitiCacheDataCurveList == null)
            {
                return;
            }
            List <GraffitiCacheDataCurve> .Enumerator enumerator = graffitiCacheDataCurveList.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    GraffitiCacheDataCurve current = enumerator.Current;
                    List <Point>           points  = current.GetPoints();
                    string colorHex        = current.ColorHex;
                    int    strokeThickness = current.StrokeThickness;
                    this._graffitiDrawService.StrokeBrush     = new SolidColorBrush(colorHex.ToColor());
                    this._graffitiDrawService.StrokeThickness = strokeThickness;
                    for (int index = 0; index < points.Count; ++index)
                    {
                        this.HandleTouchPoint(points[index], index == points.Count - 1);
                    }
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            string selectedColorHex        = cacheData.SelectedColorHex;
            int    selectedStrokeThickness = cacheData.SelectedStrokeThickness;

            this.ucGraffitiPallete.SetColor(selectedColorHex);
            this.ucBrushThickness.SetThickness(selectedStrokeThickness);
            this.ucBrushThickness.SetFillColor(selectedColorHex.ToColor());
            this.UpdateUndoOpacity();
        }
コード例 #4
0
 private void SaveState(GraffitiCacheData cacheData)
 {
     base.State["GraffitiPageState"] = cacheData;
 }
コード例 #5
0
 private void SaveState(GraffitiCacheData cacheData)
 {
     this.State["GraffitiPageState"] = (object)cacheData;
 }