Пример #1
0
        private void nextButton_Click(object sender, RoutedEventArgs e)
        {
            if (!_allowTransition)
            {
                return;
            }

            prevButton.IsEnabled = true;

            if (_slideLocation < slideContainer.Children.Count - 2)
            {
                _allowTransition = false;

                screenshot.Source = ImageProc.GetImage(slideContainer.Children[_slideLocation]);
                slideContainer.Children[_slideLocation].Visibility = Visibility.Collapsed;
                AnimationHelpers.SlideDisplay slide = new AnimationHelpers.SlideDisplay((Grid)slideContainer.Children[_slideLocation + 1], screenshot);
                slide.OnAnimationCompletedEvent += slide_OnAnimationCompletedEvent;
                slide.SwitchViews(AnimationHelpers.SlideDirection.Right);
                _slideLocation++;

                if (_slideLocation == slideContainer.Children.Count - 2)
                {
                    nextButton.IsEnabled = false;
                }
            }
        }
Пример #2
0
        private async void changeLocation_Close(object sender, RoutedEventArgs e)
        {
            changeLocation.IsHitTestVisible = false;
            grid.IsHitTestVisible           = true;

            if (changeLocation.Location != null)
            {
                string loc = changeLocation.Location;

                if (!loc.Equals(Location, StringComparison.InvariantCultureIgnoreCase))
                {
                    Location = loc;
                    string[] split = Location.Split(',');
                    locationTextBox.Text = split[0] + "," + split[1];

                    Reset();
                    await Load();
                }
            }

            Panel.SetZIndex(changeLocation, 0);
            Panel.SetZIndex(grid, 1);

            if (Settings.AnimationsEnabled)
            {
                screenshot.Source         = ImageProc.GetImage(changeLocation);
                changeLocation.Visibility = Visibility.Collapsed;
                new AnimationHelpers.SlideDisplay(grid, screenshot).SwitchViews(AnimationHelpers.SlideDirection.Right);
            }
            else
            {
                changeLocation.Visibility = Visibility.Collapsed;
                grid.Visibility           = Visibility.Visible;
            }
        }
Пример #3
0
        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            if (_imageChanged)
            {
                //double scale = image.Source.Width / image.ActualWidth;
                //int left = -(int)(image.Margin.Left / scale);
                //int top = -(int)(image.Margin.Top / scale);
                //int size = (int)(96 / scale);

                //BitmapImage img = new BitmapImage(_imageSource);
                //CroppedBitmap cropped = new CroppedBitmap(img, new Int32Rect(left, top, size, size));
                //TransformedBitmap scaled = new TransformedBitmap(cropped, new ScaleTransform(1 / scale, 1 / scale));
                //ImageSource = scaled;

                if (_isDefault)
                {
                    ImageSource = null;
                }
                else
                {
                    ImageSource = ImageProc.GetImage(border);
                }

                DialogResult = true;
            }
            else
            {
                DialogResult = false;
            }
        }
Пример #4
0
        private void _optionsControl_OnThemeChangedEvent(object sender, ThemeChangedEventArgs e)
        {
            if (Settings.AnimationsEnabled)
            {
                copyWindowImg.Source     = ImageProc.GetImage(mainGrid);
                copyWindowImg.Visibility = Visibility.Visible;
            }

            BackstageEvents.StaticUpdater.InvokeThemeChanged(sender, e);

            if (Settings.AnimationsEnabled)
            {
                DoubleAnimation fadeThemeOut = new DoubleAnimation(1, 0, new Duration(TimeSpan.FromMilliseconds(750)), FillBehavior.Stop);

                fadeThemeOut.Completed += (anim, args) =>
                {
                    copyWindowImg.Source     = null;
                    copyWindowImg.Visibility = Visibility.Collapsed;

                    mainGrid.IsHitTestVisible = true;
                };

                mainGrid.IsHitTestVisible = false;
                copyWindowImg.BeginAnimation(OpacityProperty, fadeThemeOut);
            }
        }
Пример #5
0
        private void PreviousSlide()
        {
            counter -= 2;
            object prev = Slides[counter++];

            image.Source    = ImageProc.GetImage(content);
            content.Content = prev;
            content.SlideDisplay(image, Extensions.SlideDirection.Left);

            if (counter > 1)
            {
                prevButton.FadeIn();
                prevButton.IsEnabled = true;
            }
            else
            {
                prevButton.FadeOut();
                floatingLogo.FadeOut();
            }
        }
Пример #6
0
        private void PreviousSlide()
        {
            CurrentSlidePosition -= 2;
            object prev = Slides[CurrentSlidePosition++];

            image.Source    = ImageProc.GetImage(content);
            content.Content = prev;
            content.SlideDisplay(image, Setup.Extensions.SlideDirection.Left);

            if (CurrentSlidePosition > 1)
            {
                prevButton.FadeIn();
                prevButton.IsEnabled = true;
            }
            else
            {
                prevButton.FadeOut();
                floatingLogo.FadeOut();
            }
        }
Пример #7
0
        private void NextSlide()
        {
            if (CurrentSlidePosition < Slides.Length)
            {
                object next = Slides[CurrentSlidePosition++];

                image.Source = ImageProc.GetImage(content);

                if (next is CEIP)
                {
                    nextButton.IsEnabled = true;
                    floatingLogo.FadeIn();
                }
                else if (next is Personalize)
                {
                    Settings.JoinedCEIP  = (content.Content as CEIP).joinCEIP.IsChecked == true;
                    nextButton.IsEnabled = true;
                }
                else if (next is Complete)
                {
                    Complete             = true;
                    nextButton.IsEnabled = true;
                    nextButton.Content   = "_All Done!";
                    nextButton.IsDefault = true;

                    prevButton.FadeOut();
                    floatingLogo.FadeOut();
                }

                content.Content = next;
                content.UpdateLayout();
                content.SlideDisplay(image, Setup.Extensions.SlideDirection.Right);
            }
            else
            {
                Close();
            }
        }
Пример #8
0
        public void ChangeLocation()
        {
            if (!changeLocation.IsHitTestVisible)
            {
                changeLocation.Load();
                changeLocation.IsHitTestVisible = true;
                grid.IsHitTestVisible           = false;

                Panel.SetZIndex(grid, 0);
                Panel.SetZIndex(changeLocation, 1);

                if (Settings.AnimationsEnabled)
                {
                    screenshot.Source = ImageProc.GetImage(grid);
                    grid.Visibility   = Visibility.Collapsed;
                    new AnimationHelpers.SlideDisplay(changeLocation, screenshot).SwitchViews(AnimationHelpers.SlideDirection.Left);
                }
                else
                {
                    grid.Visibility           = Visibility.Collapsed;
                    changeLocation.Visibility = Visibility.Visible;
                }
            }
        }
Пример #9
0
        private static void SaveScreenshot(Window owner, StatusStrip statusStrip, UIElement source, string filename)
        {
            try
            {
                RenderTargetBitmap img   = ImageProc.GetImage(source, Brushes.White);
                BitmapFrame        frame = BitmapFrame.Create(img);

                FileStream fStream = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.Write);

                switch (Path.GetExtension(filename).ToLower())
                {
                case ".jpg":
                case ".jpeg":
                case ".jpe":
                case ".jfif":
                    JpegBitmapEncoder jpgEncoder = new JpegBitmapEncoder();
                    jpgEncoder.QualityLevel = 100;
                    jpgEncoder.Frames.Add(frame);
                    jpgEncoder.Save(fStream);
                    break;

                case ".png":
                    PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
                    pngEncoder.Interlace = PngInterlaceOption.On;
                    pngEncoder.Frames.Add(frame);
                    pngEncoder.Save(fStream);
                    break;

                case ".bmp":
                    BmpBitmapEncoder bmpEncoder = new BmpBitmapEncoder();
                    bmpEncoder.Frames.Add(frame);
                    bmpEncoder.Save(fStream);
                    break;

                case ".gif":
                    GifBitmapEncoder gifEncoder = new GifBitmapEncoder();
                    gifEncoder.Frames.Add(frame);
                    gifEncoder.Save(fStream);
                    break;

                default:
                    TaskDialog dialog = new TaskDialog(owner, "Error Saving File",
                                                       "The requested file type is not available.",
                                                       MessageType.Error);
                    dialog.ShowDialog();
                    break;
                }

                fStream.Close();

                statusStrip.UpdateMainStatus("EXPORT SUCCESSFUL");
            }
            catch (Exception exc)
            {
                statusStrip.UpdateMainStatus("ERROR: " + exc.Message.ToUpper());

                TaskDialog dialog = new TaskDialog(owner, "Error Saving File", exc.Message, MessageType.Error);
                dialog.ShowDialog();

                ExportScreenshot(owner, statusStrip, source, filename, Path.GetDirectoryName(saveDialog.SelectedFile));
            }
        }
Пример #10
0
        private void NextSlide()
        {
            if (counter > 0)
            {
                floatingLogo.FadeIn();
            }

            if (counter < Slides.Length)
            {
                object next = Slides[counter++];

                image.Source = ImageProc.GetImage(content);

                //
                // Install
                //
                if (next is CEIP)
                {
                    nextButton.IsEnabled = true;
                }
                else if (next is ProductKey)
                {
                    InstallerData.JoinedCEIP = (content.Content as CEIP).joinCEIP.IsChecked == true;

                    ProductKey _next = next as ProductKey;

                    _next.OptionSelected   -= ProductKey_OptionSelected;
                    _next.OptionDeselected -= ProductKey_OptionDeselected;
                    _next.OptionSelected   += ProductKey_OptionSelected;
                    _next.OptionDeselected += ProductKey_OptionDeselected;

                    if (_next.freeTrial.IsChecked == true || InstallerData.ProductKey != null)
                    {
                        nextButton.IsEnabled = true;
                    }
                }
                else if (next is License)
                {
                    // In case of upgrade, the product key slide will never be shown.
                    if (content.Content is CEIP)
                    {
                        InstallerData.JoinedCEIP = (content.Content as CEIP).joinCEIP.IsChecked == true;
                    }

                    License _next = next as License;

                    _next.Agreed    -= License_Agreed;
                    _next.Disagreed -= License_Disagreed;
                    _next.Agreed    += License_Agreed;
                    _next.Disagreed += License_Disagreed;

                    if (InstallerData.AcceptedAgreement)
                    {
                        nextButton.IsEnabled = true;
                    }

                    //	nextButton.Content = "_Install";
                }
                else if (next is Personalize)
                {
                    nextButton.IsEnabled = true;
                    nextButton.Content   = "_Install";
                }
                //else if (next is InstallLocation)
                //{
                //	nextButton.IsEnabled = true;
                //	nextButton.Content = "_Install";
                //}
                else if (next is InstallProgress)
                {
                    prevButton.FadeOut();
                    prevButton.IsEnabled = false;

                    nextButton.Content = "_Working...";

                    //InstallerData.InstallLocation = (content.Content as InstallLocation).installLocation.Text;

                    if (!InstallerData.InstallLocation.EndsWith("\\" + InstallerData.DisplayName))
                    {
                        InstallerData.InstallLocation += "\\" + InstallerData.DisplayName;
                    }

                    (next as InstallProgress).Error     += Install_Error;
                    (next as InstallProgress).Completed += Install_Completed;
                }

                //
                // Uninstall
                //
                if (next is Uninstall.UninstallOptions)
                {
                    nextButton.IsEnabled = true;
                    nextButton.Content   = "_Uninstall";
                }
                else if (next is Uninstall.UninstallProgress)
                {
                    prevButton.FadeOut();
                    prevButton.IsEnabled = false;

                    nextButton.Content = "_Working...";

                    Uninstall.UninstallOptions optns = content.Content as Uninstall.UninstallOptions;

                    InstallerData.DeleteDatabase   = (bool)optns.deleteDatabase.IsChecked;
                    InstallerData.DeleteAccounts   = (bool)optns.deleteAccounts.IsChecked;
                    InstallerData.DeleteSettings   = (bool)optns.deleteSettings.IsChecked;
                    InstallerData.DeleteDictionary = (bool)optns.deleteDictionary.IsChecked;

                    (next as Uninstall.UninstallProgress).Error     += Uninstall_Error;
                    (next as Uninstall.UninstallProgress).Completed += Uninstall_Completed;
                }

                content.Content = next;
                content.UpdateLayout();
                content.SlideDisplay(image, Extensions.SlideDirection.Right);
            }
            else
            {
                Close();
            }
        }
Пример #11
0
 private void PrepareScreenshot()
 {
     PART_ContentScreenshot.Source  = ImageProc.GetImage(PART_Content);
     PART_ContentScreenshot.Opacity = 1;
 }