Пример #1
0
        // ----------------------------------------------------------------------------------------------------------------- //
        //private void AppSave_Click(object sender, EventArgs e)
        //{
        //    if (AppHelper.IsTrial) MessageBox.Show("Данная функция доступна в полной версии программы", "Сохранить совет в виде изображения", MessageBoxButton.OK);
        //    else
        //    {


        //        var streamResourceInfo = Application.GetResourceStream(new Uri("Background.png", UriKind.Relative));
        //        var image = new BitmapImage();
        //        image.SetSource(streamResourceInfo.Stream);
        //        var writeableBitmap = new WriteableBitmap(image);
        //        var bitmap = new BitmapImage(_bitmapImage.UriSource);
        //        var im = new Image() { Width = 480, Height = 350, Source = bitmap, Stretch = Stretch.Fill };

        //        var textBlockTitle = new TextBlock
        //        {
        //            FontSize = 28,
        //            Width = 200,
        //            Height = 60,
        //            FontWeight = FontWeights.Bold,
        //            TextAlignment = TextAlignment.Right,
        //            TextWrapping = TextWrapping.Wrap,
        //            Foreground = new SolidColorBrush(Color.FromArgb(210, 210, 210, 210)),
        //            Text = "СОВЕТ #" + AppHelper.PageIndex,
        //        };

        //        var textBlockText = new TextBlock
        //        {
        //            FontSize = 26,
        //            Width = 470,
        //            Height = 450,
        //            TextAlignment = TextAlignment.Center,
        //            TextWrapping = TextWrapping.Wrap,
        //            FontWeight = FontWeights.Bold,
        //            Foreground = new SolidColorBrush(Color.FromArgb(210, 210, 210, 210)),
        //            Text = BaseLineDB.ResourceManager.GetString("String" + AppHelper.PageIndex),
        //        };

        //        writeableBitmap.Render(textBlockTitle, new TranslateTransform { X = 270, Y = 8, });
        //        writeableBitmap.Render(textBlockText, new TranslateTransform { X = 5, Y = 400, });

        //        MessageBox.Show("Совет сохранен в библиотеку фотографий.", "Выполнено", MessageBoxButton.OK);

        //        writeableBitmap.Render(im, new TranslateTransform { X = 0, Y = 40, });
        //        writeableBitmap.Invalidate();

        //        using (var mediaLibrary = new MediaLibrary())
        //        {
        //            using (var stream = new MemoryStream())
        //            {
        //                writeableBitmap.SaveJpeg(stream, writeableBitmap.PixelWidth, writeableBitmap.PixelHeight, 0, 100);
        //                stream.Seek(0, SeekOrigin.Begin);
        //                mediaLibrary.SavePicture("Cовет_" + AppHelper.PageIndex + ".jpg", stream);
        //            }
        //        }
        //    }
        //}
        private void MainPivot_LoadingPivotItem(object sender, PivotItemEventArgs e)
        {
            if (MainPivot.SelectedIndex == 0 && _lastIndexItem == 1)
            {
                AppHelper.PageIndex--;
            }
            else if (MainPivot.SelectedIndex == 0 && _lastIndexItem == 2)
            {
                AppHelper.PageIndex++;
            }
            else if (MainPivot.SelectedIndex == 1 && _lastIndexItem == 0)
            {
                AppHelper.PageIndex++;
            }
            else if (MainPivot.SelectedIndex == 1 && _lastIndexItem == 2)
            {
                AppHelper.PageIndex--;
            }
            else if (MainPivot.SelectedIndex == 2 && _lastIndexItem == 0)
            {
                AppHelper.PageIndex--;
            }
            else if (MainPivot.SelectedIndex == 2 && _lastIndexItem == 1)
            {
                AppHelper.PageIndex++;
            }
            _lastIndexItem = MainPivot.SelectedIndex;
            SVFirst.ScrollToVerticalOffset(0.0d);
            SVSecond.ScrollToVerticalOffset(0.0d);
            SVThird.ScrollToVerticalOffset(0.0d);
            this.SelectedIndexLogic();
        }
        private void MainPivot_LoadingPivotItem(object sender, PivotItemEventArgs e)
        {
            if (MainPivot.SelectedIndex == 0 && _lastIndexItem == 1)
            {
                this.IndexPage--;
            }
            else if (MainPivot.SelectedIndex == 0 && _lastIndexItem == 2)
            {
                this.IndexPage++;
            }
            else if (MainPivot.SelectedIndex == 1 && _lastIndexItem == 0)
            {
                this.IndexPage++;
            }
            else if (MainPivot.SelectedIndex == 1 && _lastIndexItem == 2)
            {
                this.IndexPage--;
            }
            else if (MainPivot.SelectedIndex == 2 && _lastIndexItem == 0)
            {
                this.IndexPage--;
            }
            else if (MainPivot.SelectedIndex == 2 && _lastIndexItem == 1)
            {
                this.IndexPage++;
            }

            _lastIndexItem = MainPivot.SelectedIndex;

            SwipeAnimation.Begin();

            SVFirst.ScrollToVerticalOffset(0.0d);
            SVSecond.ScrollToVerticalOffset(0.0d);
            SVThird.ScrollToVerticalOffset(0.0d);

            if (AppHelper.Storage.Count > 0)
            {
                this.SelectedIndexLogic(true);
            }
            else
            {
                this.EmptyList();
            }
        }