Ejemplo n.º 1
0
        private static BitmapImage NextImg(NextImage e)
        {
            if (ImageList.Children.Count <= 0)
            {
                return(UcImageViewer.ImageList.DefImage);
            }
            switch (e)
            {
            case NextImage.Right:
                if (ImageList.Children.Count - 1 > UcImageViewer.ImageList.IndexOfCurImg)
                {
                    UcImageViewer.ImageList.IndexOfCurImg++;
                }
                else
                {
                    UcImageViewer.ImageList.IndexOfCurImg = 0;
                }
                break;

            case NextImage.Left:
                if (0 < UcImageViewer.ImageList.IndexOfCurImg)
                {
                    UcImageViewer.ImageList.IndexOfCurImg--;
                }
                else
                {
                    UcImageViewer.ImageList.IndexOfCurImg = ImageList.Children.Count - 1;
                }
                break;
            }
            var str = ((Image)ImageList.Children[UcImageViewer.ImageList.IndexOfCurImg]).Tag.ToString();

            return(new BitmapImage(new Uri(str, UriKind.RelativeOrAbsolute)));
        }
Ejemplo n.º 2
0
        private void YesSaveFile_Click(object sender, RoutedEventArgs e)
        {
            //isPreviousFileSave = true;
            FileSavePopup.IsOpen = false;
            SaveFile.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));

            //MessageBox.Show("File is saved.");
            NextImage.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Ação chamada após a finalização da validação de determinado movimento
        /// </summary>
        public void OnValidationFinish(object sender, ValidacaoEnum validationType)
        {
            Resultado.AdicionarTotal(validationType, m_currentMovement);
            FeedbackImage = validationType == ValidacaoEnum.VALIDO ? "/Images/Sequencia/Feedback/Acerto.png" : "/Images/Sequencia/Feedback/Falha.png";

            if (!NextImage.Equals(""))
            {
                m_currentMovement = ActivityManager.Instance.GetMovement(NextImage);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Update the toolbar button
        /// </summary>
        private void UpdateToolBarButton()
        {
            if (_report != null)
            {
                TBBRefresh.EnableButton();
                TBBPrint.EnableButton();
                ExportDefault.EnableButton();
                ExportMenu.IsEnabled = true;
                ExportMenu.Opacity   = 1;
                TBBPrintWithProperties.EnableButton();
                ZoomInfoStackPanel.Visibility = Visibility.Visible;
                ZoomPopupButton.Visibility    = Visibility.Visible;
                ZoomPopupButton.IsEnabled     = true;
                ZoomPopupButton.Opacity       = 1;
            }
            else
            {
                TBBRefresh.DisableButton();
                TBBPrint.DisableButton();
                ExportDefault.DisableButton();
                ExportMenu.IsEnabled = true;
                ExportMenu.Opacity   = 1;
                TBBPrintWithProperties.DisableButton();
                ZoomInfoStackPanel.Visibility = Visibility.Collapsed;
                ZoomPopupButton.Visibility    = Visibility.Collapsed;
                ZoomPopupButton.IsEnabled     = false;
                ZoomPopupButton.Opacity       = 0.5;
            }


            if (_pos == 0)
            {
                PagerSeparator.Visibility = Visibility.Visible;
                PreviousImage.DisableButton();
                FirstImage.DisableButton();
                NextImage.EnableButton();
                LastImage.EnableButton();
            }
            else
            {
                if (_pos + 1 == this._report.PagesCount)
                {
                    NextImage.DisableButton();
                    LastImage.DisableButton();
                    PreviousImage.EnableButton();
                    FirstImage.EnableButton();
                }
                else
                {
                    PreviousImage.EnableButton();
                    NextImage.EnableButton();
                    FirstImage.EnableButton();
                    LastImage.EnableButton();
                }
            }

            if (this._report.PagesCount > 1)
            {
                PagerSeparator.Visibility = Visibility.Visible;
                PreviousImage.Visibility  = Visibility.Visible;
                NextImage.Visibility      = Visibility.Visible;
                FirstImage.Visibility     = Visibility.Visible;
                LastImage.Visibility      = Visibility.Visible;
                PageSpinner.Visibility    = Visibility.Visible;
            }
            else
            {
                PagerSeparator.Visibility = Visibility.Collapsed;
                PreviousImage.Visibility  = Visibility.Collapsed;
                NextImage.Visibility      = Visibility.Collapsed;
                FirstImage.Visibility     = Visibility.Collapsed;
                LastImage.Visibility      = Visibility.Collapsed;
                PageSpinner.Visibility    = Visibility.Collapsed;
            }
        }
Ejemplo n.º 5
0
        protected override async Task InitializeAsync(System.Threading.CancellationToken cancellationToken,
                                                      IProgress <ServiceProgressData> progress)
        {
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            Application.Current.MainWindow.Loaded += (s, e) =>
            {
                _mainWindow = (System.Windows.Window)s;
                _settings   = Setting.Initialize(this);
                _settings.OnChanged.AddEventHandler(ReloadSettings);
                if (ProvidersHolder.Instance.Providers == null)
                {
                    ProvidersHolder.Initialize(_settings, new List <IImageProvider>
                    {
                        new SingleImageEachProvider(_settings),
                        new SlideShowImageProvider(_settings),
                        new SingleImageProvider(_settings)
                    });
                }

                _imageProviders = ProvidersHolder.Instance.Providers;
                _imageProvider  = _imageProviders.FirstOrDefault(x => x.ProviderType == _settings.ImageBackgroundType);
                _imageProviders.ForEach(x => x.NewImageAvaliable += InvokeChangeImage);

                NextImage.InitializeAsync(this, _settings)
                .FileAndForget("claudiaide/nextimage/initializeasync");
                PauseSlideshow.InitializeAsync(this, _settings).FileAndForget("claudiaide/pauseslideshow/initializeasync");
                ReloadSettings(null, null);
            };
            Application.Current.MainWindow.Closing += (s, e) =>
            {
                _imageProviders.ForEach(x => x.NewImageAvaliable -= InvokeChangeImage);
                if (_settings != null)
                {
                    _settings.OnChanged.RemoveEventHandler(ReloadSettings);
                }
            };
            Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                try
                {
                    await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
                    _settings = await Setting.InitializeAsync(this);
                    if (_settings == null)
                    {
                        return;
                    }
                    _mainWindow = (System.Windows.Window)Application.Current.MainWindow;
                    _settings.OnChanged.AddEventHandler(ReloadSettings);
                    if (ProvidersHolder.Instance.Providers == null)
                    {
                        ProvidersHolder.Initialize(_settings, new List <IImageProvider>
                        {
                            new SingleImageEachProvider(_settings),
                            new SlideShowImageProvider(_settings),
                            new SingleImageProvider(_settings)
                        });
                    }

                    _imageProviders = ProvidersHolder.Instance.Providers;
                    _imageProvider  =
                        _imageProviders.FirstOrDefault(x => x.ProviderType == _settings.ImageBackgroundType);
                    _imageProviders.ForEach(x => x.NewImageAvaliable += InvokeChangeImage);

                    await NextImage.InitializeAsync(this, _settings);
                    await PauseSlideshow.InitializeAsync(this, _settings);
                    ReloadSettings(null, null);
                }
                catch { }
            }).FileAndForget("claudiaide/initializeasync");
        }
 private static BitmapImage NextImg(NextImage e)
 {
     if (ImageList.Children.Count <= 0) return UcImageViewer.ImageList.DefImage;
     switch (e)
     {
         case NextImage.Right:
             if (ImageList.Children.Count - 1 > UcImageViewer.ImageList.IndexOfCurImg)
                 UcImageViewer.ImageList.IndexOfCurImg++;
             else
                 UcImageViewer.ImageList.IndexOfCurImg = 0;
             break;
         case NextImage.Left:
             if (0 < UcImageViewer.ImageList.IndexOfCurImg)
                 UcImageViewer.ImageList.IndexOfCurImg--;
             else
                 UcImageViewer.ImageList.IndexOfCurImg = ImageList.Children.Count - 1;
             break;
     }
     var str = ((Image)ImageList.Children[UcImageViewer.ImageList.IndexOfCurImg]).Tag.ToString();
     return new BitmapImage(new Uri(str, UriKind.RelativeOrAbsolute));
 }
Ejemplo n.º 7
0
 private void NoSaveFile_Click(object sender, RoutedEventArgs e)
 {
     FileSavePopup.IsOpen = false;
     isPreviousFileSave   = true;
     NextImage.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
 }
Ejemplo n.º 8
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken,
                                                      IProgress <ServiceProgressData> progress)
        {
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            Application.Current.MainWindow.Loaded += (s, e) =>
            {
                ThreadHelper.ThrowIfNotOnUIThread();
                _mainWindow = (Window)s;
                _settings   = Setting.Initialize((DTE)GetService(typeof(DTE)));
                _settings.OnChanged.AddEventHandler(ReloadSettings);
                if (ProvidersHolder.Instance.Providers == null)
                {
                    ProvidersHolder.Initialize(_settings, new List <ImageProvider>
                    {
                        new SingleImageEachProvider(_settings),
                        new SlideShowImageProvider(_settings),
                        new SingleImageProvider(_settings),
                        new SingleImageWebProvider(_settings),
                        new WebApiImageProvider(_settings)
                    });
                }

                _imageProviders         = ProvidersHolder.Instance.Providers;
                _imageProvider          = _imageProviders.FirstOrDefault(x => x.ProviderType == _settings.ImageBackgroundType);
                _imageProvider.IsActive = true;
                _imageProviders.ForEach(x => x.NewImageAvailable += InvokeChangeImage);

                NextImage.InitializeAsync(this)
                .FileAndForget("claudiaide/nextimage/initializeasync");
                PauseSlideshow.InitializeAsync(this).FileAndForget("claudiaide/pauseslideshow/initializeasync");
                SaveSolutionSettings.InitializeAsync(this, _settings)
                .FileAndForget("claudiaide/saveSolutionSettings/initializeasync");
                ;
                ReloadSettings(null, null);
            };
            Application.Current.MainWindow.Closing += (s, e) =>
            {
                _imageProviders.ForEach(x => x.NewImageAvailable -= InvokeChangeImage);
                if (_settings != null)
                {
                    _settings.OnChanged.RemoveEventHandler(ReloadSettings);
                }
            };
            ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                try
                {
                    await JoinableTaskFactory.SwitchToMainThreadAsync(true, cancellationToken);
                    _settings = Setting.Initialize((DTE)await GetServiceAsync(typeof(DTE)));
                    if (_settings == null)
                    {
                        return;
                    }
                    _mainWindow = Application.Current.MainWindow;
                    _settings.OnChanged.AddEventHandler(ReloadSettings);
                    if (ProvidersHolder.Instance.Providers == null)
                    {
                        ProvidersHolder.Initialize(_settings, new List <ImageProvider>
                        {
                            new SingleImageEachProvider(_settings),
                            new SlideShowImageProvider(_settings),
                            new SingleImageProvider(_settings),
                            new SingleImageWebProvider(_settings),
                            new WebApiImageProvider(_settings)
                        });
                    }

                    _imageProviders = ProvidersHolder.Instance.Providers;
                    _imageProvider  =
                        _imageProviders.FirstOrDefault(x => x.ProviderType == _settings.ImageBackgroundType);
                    _imageProvider.IsActive = true;
                    _imageProviders.ForEach(x => x.NewImageAvailable += InvokeChangeImage);

                    await NextImage.InitializeAsync(this);
                    await PauseSlideshow.InitializeAsync(this);
                    await SaveSolutionSettings.InitializeAsync(this, _settings);
                    ReloadSettings(null, null);
                }
                catch
                {
                }
            }).FileAndForget("claudiaide/initializeasync");
        }