Пример #1
0
 private void refreshMenu()
 {
     NavView.MenuItems.Clear();
     foreach (var item in MenuItem.GetMainItems())
     {
         IconElement icon;
         if (item.Icon.ToLowerInvariant().EndsWith(".png"))
         {
             icon = new BitmapIcon()
             {
                 UriSource = new Uri(item.Icon, UriKind.RelativeOrAbsolute)
             };
         }
         else
         {
             icon = new FontIcon()
             {
                 FontFamily = new FontFamily("Segoe MDL2 Assets"),
                 Glyph      = item.Icon
             };
         }
         NavView.MenuItems.Add(new NavigationViewItem()
         {
             Icon = icon, Content = item.Name, DataContext = item
         });
     }
 }
 private void AppbarFlashAuto_Click(object sender, RoutedEventArgs e)
 {
     if (this.mediaCapture != null && this.mediaCapture.VideoDeviceController.FlashControl.Supported)
     {
         FlashControl flashControl = this.mediaCapture.VideoDeviceController.FlashControl;
         if (flashControl.Auto)
         {
             flashControl.Auto    = false;
             flashControl.Enabled = true;
             var icon = new BitmapIcon();
             icon.UriSource            = new Uri("ms-appx:///Assets/appbar.camera.flash.png");
             this.AppbarFlashAuto.Icon = icon;
         }
         else if (flashControl.Enabled)
         {
             flashControl.Enabled = false;
             var icon = new BitmapIcon();
             icon.UriSource            = new Uri("ms-appx:///Assets/appbar.camera.flash.off.png");
             this.AppbarFlashAuto.Icon = icon;
         }
         else
         {
             flashControl.Auto    = true;
             flashControl.Enabled = true;
             var icon = new BitmapIcon();
             icon.UriSource            = new Uri("ms-appx:///Assets/appbar.camera.flash.auto.png");
             this.AppbarFlashAuto.Icon = icon;
         }
     }
 }
Пример #3
0
        private void SetOverlay(Color color)
        {
            var formsImage = (Xamarin.Forms.Image)Element;

            if (formsImage?.Source == null)
            {
                return;
            }

            var image = (Windows.UI.Xaml.Controls.Image)Control;
            //image.Color

            var icon = new BitmapIcon();

            icon.UriSource  = ((BitmapImage)image.Source).UriSource;
            icon.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);

            //WriteableBitmap bitmap = new WriteableBitmap(100, 100);
            //bitmap.

            //BitmapImage img = ((BitmapImage)image.Source);
            //for (int x = 0; x < img.PixelWidth; x++)
            //{
            //    for (int y = 0; y < img.PixelHeight; y++)
            //    {
            //        Color bitColor = img.GetPixel(x, y);
            //        //Sets all the pixels to white but with the original alpha value
            //        bitmap.SetPixel(x, y, Color.FromArgb(bitColor.A, 255, 255, 255));
            //    }
            //}
        }
Пример #4
0
        private void BitmapIcon_Tapped(object sender, TappedRoutedEventArgs e)
        {
            BitmapIcon bitmapIcon = sender as BitmapIcon;

            bitmapIcon.Foreground = new SolidColorBrush(Colors.LightYellow);

            int temperatureToSet = Convert.ToInt32(ClimateEntity.Attributes["temperature"]);

            if (string.Equals(bitmapIcon.Name, "ArrowUp"))
            {
                temperatureToSet++;
            }
            else
            {
                temperatureToSet--;
            }

            // Save the new temperate value
            ClimateEntity.Attributes["temperature"] = temperatureToSet;

            WebRequests.SendAction("climate", "set_temperature", new Dictionary <string, string>()
            {
                { "entity_id", ClimateEntity.EntityId },
                { "temperature", temperatureToSet.ToString() },
            });

            // Update the UI
            TextBlock targetTemperature = this.FindName("TargetTemperature") as TextBlock;

            targetTemperature.Text = $"{ClimateEntity.Attributes["temperature"]}";
        }
Пример #5
0
        private void StackPanel_RightTapped(object sender, Windows.UI.Xaml.Input.RightTappedRoutedEventArgs e)
        {
            var songMenuFlyoutSubItem = new MenuFlyoutSubItem()
            {
                Text = "AddToPlayList"
            };

            var icon = new BitmapIcon()
            {
                UriSource = new Uri("ms-appx:///Assets/Images/songGeneral.png")
            };

            var playLists = PlayListManager.GetAllPlayLists();

            foreach (var playlist in playLists)
            {
                var playListMenuFlyoutItem = new MenuFlyoutItem()
                {
                    Text = playlist.Title
                };
                playListMenuFlyoutItem.Click += AddToPlaylistMenu_ItemClick;
                songMenuFlyoutSubItem.Items.Add(playListMenuFlyoutItem);
            }

            var addToPlaylistFlyout = new MenuFlyout();

            addToPlaylistFlyout.Items.Add(songMenuFlyoutSubItem);
            FrameworkElement senderElement = sender as FrameworkElement;

            addToPlaylistFlyout.ShowAt(sender as UIElement, e.GetPosition(sender as UIElement));
        }
Пример #6
0
        public static void SetIconOverlay(this UIElement view, BitmapIcon icon)
        {
            var overlay = s_iconOverlays.GetOrCreateValue(view);

            overlay.Icon   = icon;
            view.GotFocus += View_GotFocus; // hrm weak event?
        }
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            ChronometerType chronometerType = (ChronometerType)value;
            BitmapIcon result = null;
            switch (chronometerType)
            {
                case ChronometerType.Inicial:
                    result = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/Icons/Alarm.png", UriKind.RelativeOrAbsolute)
                    };
                    break;
                case ChronometerType.Stop:

                    result = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/Icons/Stop.png", UriKind.RelativeOrAbsolute)
                    };
                    break;
                case ChronometerType.Refresh:
                    result = new BitmapIcon()
                    {
                        UriSource = new Uri("ms-appx:///Assets/Icons/Refresh.png", UriKind.RelativeOrAbsolute)
                    };
                    break;
            }
            return result;
        }
Пример #8
0
        private void BitmapIcon_Tapped(object sender, TappedRoutedEventArgs e)
        {
            BitmapIcon bitmapIcon = sender as BitmapIcon;

            bitmapIcon.Foreground = this.Foreground;

            // Adjust the ellipse for the Play button as well
            if (bitmapIcon.Name == "ButtonPlay")
            {
                Ellipse ellipsePlay = FindName("EllipsePlay") as Ellipse;
                ellipsePlay.Stroke = bitmapIcon.Foreground;
            }

            switch (bitmapIcon.Tag.ToString())
            {
            case "volume_down":
                SendVolumeLevel(PanelEntity.Attributes["volume_level"] - 0.1);
                break;

            case "volume_up":
                SendVolumeLevel(PanelEntity.Attributes["volume_level"] + 0.1);
                break;

            // power (toggle)
            // play (media_play_pause)
            // pause (media_play_pause)
            // shuffle (media_shuffle_set)
            default:
                WebRequests.SendAction(PanelEntity.EntityId, bitmapIcon.Tag.ToString());
                break;
            }
        }
Пример #9
0
        void UpdateIconColor()
        {
            BitmapIcon image = Control.Content as BitmapIcon;

            if (image == null)
            {
                StackPanel container = Control.Content as StackPanel;
                if (container == null)
                {
                    return;
                }
                foreach (var c in container.Children)
                {
                    image = c as BitmapIcon;
                    if (image != null)
                    {
                        break;
                    }
                }
            }
            if (image != null)
            {
                var element = Element as Ao3TrackReader.Controls.Button;
                if (element.IsActive)
                {
                    image.Foreground = Ao3TrackReader.Resources.Colors.Highlight.High.ToWindowsBrush();
                }
                else
                {
                    image.Foreground = Ao3TrackReader.Resources.Colors.Base.High.ToWindowsBrush();
                }
            }
        }
Пример #10
0
 private void BitmapIcon_PointerReleased(object sender, PointerRoutedEventArgs e)
 {
     if (e.Pointer.IsInContact)
     {
         BitmapIcon bitmapIcon = sender as BitmapIcon;
         bitmapIcon.Foreground = new SolidColorBrush(Colors.LightYellow);
     }
 }
Пример #11
0
        private void BitmapIcon_Tapped(object sender, TappedRoutedEventArgs e)
        {
            BitmapIcon bitmapIcon = sender as BitmapIcon;

            WebRequests.SendAction(Entity.EntityId, bitmapIcon.Tag.ToString());

            SetButtonEnabledolor();
        }
Пример #12
0
        private void EllipsePlay_PointerExited(object sender, PointerRoutedEventArgs e)
        {
            BitmapIcon bitmapIconPlay = FindName("ButtonPlay") as BitmapIcon;
            Ellipse    ellipse        = sender as Ellipse;

            bitmapIconPlay.Foreground = this.Foreground;
            ellipse.Stroke            = bitmapIconPlay.Foreground;
        }
Пример #13
0
        public static IconElement MakeIconElementFrom(Microsoft.UI.Xaml.Controls.IconSource iconSource)
        {
            if (iconSource is Microsoft.UI.Xaml.Controls.FontIconSource fontIconSource)
            {
                FontIcon fontIcon = new FontIcon();

                fontIcon.Glyph    = fontIconSource.Glyph;
                fontIcon.FontSize = fontIconSource.FontSize;

                if (fontIconSource.FontFamily != null)
                {
                    fontIcon.FontFamily = fontIconSource.FontFamily;
                }

                fontIcon.FontWeight = fontIconSource.FontWeight;
                fontIcon.FontStyle  = fontIconSource.FontStyle;
                fontIcon.IsTextScaleFactorEnabled = fontIconSource.IsTextScaleFactorEnabled;
                fontIcon.MirroredWhenRightToLeft  = fontIconSource.MirroredWhenRightToLeft;

                return(fontIcon);
            }
            else if (iconSource is Microsoft.UI.Xaml.Controls.SymbolIconSource symbolIconSource)
            {
                SymbolIcon symbolIcon = new SymbolIcon();
                symbolIcon.Symbol = symbolIconSource.Symbol;

                return(symbolIcon);
            }
            else if (iconSource is Microsoft.UI.Xaml.Controls.BitmapIconSource bitmapIconSource)
            {
                BitmapIcon bitmapIcon = new BitmapIcon();

                if (bitmapIconSource.UriSource != null)
                {
                    bitmapIcon.UriSource = bitmapIconSource.UriSource;
                }

                if (IsSystemDll() || ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.BitmapIcon", "ShowAsMonochrome"))
                {
                    bitmapIcon.ShowAsMonochrome = bitmapIconSource.ShowAsMonochrome;
                }

                return(bitmapIcon);
            }
            else if (iconSource is Microsoft.UI.Xaml.Controls.PathIconSource pathIconSource)
            {
                PathIcon pathIcon = new PathIcon();

                if (pathIconSource.Data != null)
                {
                    pathIcon.Data = pathIconSource.Data;
                }

                return(pathIcon);
            }

            return(null);
        }
Пример #14
0
        private void Border_Tapped(object sender, TappedRoutedEventArgs e)
        {
            BitmapIcon border = sender as BitmapIcon;
            TrainStop  stop   = border.DataContext as TrainStop;

            if (!Frame.Navigate(typeof(SectionPage), stop.Id))
            {
            }
        }
Пример #15
0
 public ItemHambuguer(Uri uri, string descricao)
 {
     Icone = new BitmapIcon()
     {
         UriSource = uri
     };
     Descricao = descricao;
     InitializeComponent();
 }
Пример #16
0
        public void SwitchIconClick(object sender, RoutedEventArgs e)
        {
            var bitmapIcon = new BitmapIcon()
            {
                UriSource = new System.Uri("ms-appx:///Assets/RedSquare.png"), ShowAsMonochrome = false
            };

            BitmapIconBox.QueryIcon = bitmapIcon;
        }
Пример #17
0
        public AppBarEllipsis() : base()
        {
            var i = new SymbolIcon(Symbol.More);

            Icon = new BitmapIcon
            {
                UriSource = new Uri("ms-appx:///" + Ao3TrackReader.Resources.Icons.More)
            };
        }
Пример #18
0
        private void OnUriSourceChanged(Uri newValue, Uri oldValue)
        {
            if (oldValue == null || newValue == null)
            {
                return;
            }

            if (Equals(newValue, oldValue))
            {
                return;
            }

            if (_visual == null || _label == null)
            {
                return;
            }

            var visualShow = _visual == _visual1 ? _visual2 : _visual1;
            var visualHide = _visual == _visual1 ? _visual1 : _visual2;

            var labelShow = _visual == _visual1 ? _label2 : _label1;
            var labelHide = _visual == _visual1 ? _label1 : _label2;

            var hide1 = _visual.Compositor.CreateVector3KeyFrameAnimation();

            hide1.InsertKeyFrame(0, new Vector3(1));
            hide1.InsertKeyFrame(1, new Vector3(0));

            var hide2 = _visual.Compositor.CreateScalarKeyFrameAnimation();

            hide2.InsertKeyFrame(0, 1);
            hide2.InsertKeyFrame(1, 0);

            visualHide.StartAnimation("Scale", hide1);
            visualHide.StartAnimation("Opacity", hide2);

            labelShow.UriSource = newValue;

            var show1 = _visual.Compositor.CreateVector3KeyFrameAnimation();

            show1.InsertKeyFrame(1, new Vector3(1));
            show1.InsertKeyFrame(0, new Vector3(0));

            var show2 = _visual.Compositor.CreateScalarKeyFrameAnimation();

            show2.InsertKeyFrame(1, 1);
            show2.InsertKeyFrame(0, 0);

            visualShow.StartAnimation("Scale", show1);
            visualShow.StartAnimation("Opacity", show2);

            _visual = visualShow;
            _label  = labelShow;
        }
Пример #19
0
 private void SetIcon(BitmapIcon icon)
 {
     if (icon != null)
     {
         ccBox.Icon = new BitmapIcon {
             UriSource = icon.UriSource
         }
     }
     ;
     tbDate.Visibility = Visibility.Visible;
 }
Пример #20
0
        public static BitmapIcon CreateCloudIcon(double size, Brush brush)
        {
            var cloudIcon = new BitmapIcon()
            {
                UriSource  = new Uri("ms-appx:///Assets/Icons/cloudy.png"),
                Height     = size,
                Width      = size,
                Foreground = brush
            };

            return(cloudIcon);
        }
Пример #21
0
        public static void Register(BitmapIcon icon, string name, UserControl control)
        {
            var t = ToolBarButtonList.FirstOrDefault(v => v.Name == name);

            if (t == null)
            {
                ToolBarButtonList.Add(new DesignButton()
                {
                    Icon = icon, Name = name, DesignControl = control
                });
            }
        }
Пример #22
0
        private void BitmapIcon_PointerExited(object sender, PointerRoutedEventArgs e)
        {
            BitmapIcon bitmapIcon = sender as BitmapIcon;

            bitmapIcon.Foreground = this.Foreground;

            // Adjust the ellipse for the Play button as well
            if (bitmapIcon.Name == "ButtonPlay")
            {
                Ellipse ellipsePlay = FindName("EllipsePlay") as Ellipse;
                ellipsePlay.Stroke = bitmapIcon.Foreground;
            }
        }
Пример #23
0
        private void BitmapIcon_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            BitmapIcon bitmapIcon = sender as BitmapIcon;

            bitmapIcon.Foreground = new SolidColorBrush(Colors.Gray);

            // Adjust the ellipse for the Play button as well
            if (bitmapIcon.Name == "ButtonPlay")
            {
                Ellipse ellipsePlay = FindName("EllipsePlay") as Ellipse;
                ellipsePlay.Stroke = bitmapIcon.Foreground;
            }
        }
Пример #24
0
        private static Canvas CreateSnowIcon()
        {
            var container = new Canvas()
            {
                Margin = new Thickness(-35, 0, 0, 0)
            };
            var compositor      = ElementCompositionPreview.GetElementVisual(container).Compositor;
            var containerVisual = compositor.CreateContainerVisual();

            var iconSnow = new BitmapIcon()
            {
                Height    = 70,
                Width     = 70,
                UriSource = new Uri("ms-appx:///Assets/Icons/snowflake.png")
            };

            var iconSnowVisual = ElementCompositionPreview.GetElementVisual(iconSnow);


            // ANIMATIONS
            var animationRotate = compositor.CreateScalarKeyFrameAnimation();

            animationRotate.InsertKeyFrame(0f, 0f);
            animationRotate.InsertKeyFrame(1f, -5f);
            animationRotate.Duration          = TimeSpan.FromSeconds(5);
            animationRotate.IterationBehavior = AnimationIterationBehavior.Forever;
            animationRotate.Direction         = AnimationDirection.Alternate;

            var animationFade = compositor.CreateScalarKeyFrameAnimation();

            animationFade.InsertKeyFrame(0f, 1f);
            animationFade.InsertKeyFrame(1f, 0.2f);
            animationFade.Duration          = TimeSpan.FromSeconds(3);
            animationFade.IterationBehavior = AnimationIterationBehavior.Forever;
            animationFade.Direction         = AnimationDirection.Alternate;

            var animationScale = Animations.CreateScaleAnimation(compositor, new Vector2(1.3f, 1.3f), 5);

            iconSnowVisual.RotationAxis = new Vector3(0, 0, 1);
            iconSnowVisual.CenterPoint  = new Vector3((float)iconSnow.Height / 2, (float)iconSnow.Width / 2, 0);

            iconSnowVisual.StartAnimation("RotationAngle", animationRotate);
            iconSnowVisual.StartAnimation("Opacity", animationFade);
            iconSnowVisual.StartAnimation("Scale.xy", animationScale);

            container.Children.Add(iconSnow);
            containerVisual.Children.InsertAtTop(iconSnowVisual);

            ElementCompositionPreview.SetElementChildVisual(container, containerVisual);
            return(container);
        }
Пример #25
0
        public Task <IconElement> LoadIconElementAsync(ImageSource imagesource, CancellationToken cancellationToken = default(CancellationToken))
        {
            IconElement image = null;

            if (imagesource is FileImageSource filesource)
            {
                string file = filesource.File;
                image = new BitmapIcon {
                    UriSource = new Uri("ms-appx:///" + file)
                };
            }

            return(Task.FromResult(image));
        }
Пример #26
0
        public Task <IconElement> LoadIconElementAsync(ImageSource imagesource, CancellationToken cancellationToken = default)
        {
            var imageLoader = imagesource as UriImageSource;

            if (imageLoader?.Uri == null)
            {
                return(null);
            }

            IconElement image = new BitmapIcon {
                UriSource = imageLoader?.Uri
            };

            return(Task.FromResult(image));
        }
Пример #27
0
        protected override void OnApplyTemplate()
        {
            Texture    = GetTemplateChild(nameof(Texture)) as ImageView;
            VenueGlyph = GetTemplateChild(nameof(VenueGlyph)) as BitmapIcon;
            VenueDot   = GetTemplateChild(nameof(VenueDot)) as Path;

            Texture.Click += Button_Click;

            _templateApplied = true;

            if (_message != null)
            {
                UpdateMessage(_message);
            }
        }
Пример #28
0
        /// <summary>
        /// 设置 播放按钮状态
        /// </summary>
        /// <param name="flag">true 表示当前是播放状态 按钮显示暂停图标</param>
        private void SetPlayButtonState(bool flag)
        {
            BitmapIcon bIcon = new BitmapIcon();

            if (flag)
            {
                bIcon.UriSource       = new Uri("ms-appx:///Assets/VideoSample/Play/pause.png", UriKind.Absolute);
                AppBarButtonPlay.Icon = bIcon;
            }
            else
            {
                bIcon.UriSource       = new Uri("ms-appx:///Assets/VideoSample/Play/play.png", UriKind.Absolute);
                AppBarButtonPlay.Icon = bIcon;
            }
        }
Пример #29
0
        public void BitmapIconSourceTest()
        {
            BitmapIconSource iconSource = null;
            BitmapIcon       bitmapIcon = null;
            var uri = new Uri("ms-appx:///Assets/ingredient1.png");

            RunOnUIThread.Execute(() =>
            {
                iconSource = new BitmapIconSource();
                bitmapIcon = iconSource.CreateIconElement() as BitmapIcon;

                // IconSource.Foreground should be null to allow foreground inheritance from
                // the parent to work.
                Verify.AreEqual(iconSource.Foreground, null);
                //Verify.AreEqual(bitmapIcon.Foreground, null);

                Log.Comment("Validate the defaults match BitmapIcon.");

                var icon = new BitmapIcon();
                Verify.AreEqual(icon.UriSource, iconSource.UriSource);
                Verify.AreEqual(bitmapIcon.UriSource, iconSource.UriSource);

                if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.Controls.BitmapIcon", "ShowAsMonochrome"))
                {
                    Verify.AreEqual(icon.ShowAsMonochrome, iconSource.ShowAsMonochrome);
                    Verify.AreEqual(bitmapIcon.ShowAsMonochrome, iconSource.ShowAsMonochrome);
                }

                Log.Comment("Validate that you can change the properties.");

                iconSource.Foreground       = new SolidColorBrush(Windows.UI.Colors.Red);
                iconSource.UriSource        = uri;
                iconSource.ShowAsMonochrome = false;
            });
            IdleSynchronizer.Wait();

            RunOnUIThread.Execute(() =>
            {
                Verify.IsTrue(iconSource.Foreground is SolidColorBrush);
                Verify.IsTrue(bitmapIcon.Foreground is SolidColorBrush);
                Verify.AreEqual(Windows.UI.Colors.Red, (iconSource.Foreground as SolidColorBrush).Color);
                Verify.AreEqual(Windows.UI.Colors.Red, (bitmapIcon.Foreground as SolidColorBrush).Color);
                Verify.AreEqual(uri, iconSource.UriSource);
                Verify.AreEqual(uri, bitmapIcon.UriSource);
                Verify.AreEqual(false, iconSource.ShowAsMonochrome);
                Verify.AreEqual(false, bitmapIcon.ShowAsMonochrome);
            });
        }
        public FaceTrackingControl()
        {
            InitializeComponent();

            _isPreviewing = false;

            _smiley = new BitmapIcon
            {
                UriSource  = new Uri(_smileyAssetPath),
                Foreground = _smileyColor
            };

            _smileyNeutral = new BitmapIcon {
                Foreground = _smileyColor
            };
        }
Пример #31
0
 public void DisplayOrderButton_Click(object sender, RoutedEventArgs e)
 {
     if ((string)DisplayOrderButton.Tag == "Circle")
     {
         BitmapIcon randomIcon = new BitmapIcon();
         randomIcon.UriSource    = new Uri("ms-appx:///Assets/random.png");
         DisplayOrderButton.Icon = randomIcon;
         DisplayOrderButton.Tag  = "Random";
     }
     else
     {
         BitmapIcon circleIcon = new BitmapIcon();
         circleIcon.UriSource    = new Uri("ms-appx:///Assets/circle.png");
         DisplayOrderButton.Icon = circleIcon;
         DisplayOrderButton.Tag  = "Circle";
     }
 }
Пример #32
0
        /// <summary>
        /// Updates menu and app bar icons
        /// </summary>
        private void UpdateMenuAndAppBarIcons()
        {
            // Show unpin or pin button
            if (!SecondaryTile.Exists(TILE_ID))
            {
                var icon = new BitmapIcon();
                icon.UriSource = new Uri("ms-appx:///Assets/Images/pin-48px.png", UriKind.Absolute);
                pinButton.Icon = icon;
                pinButton.Label = _resourceLoader.GetString("PinButton/Label");
            }
            else
            {
                var icon = new BitmapIcon();
                icon.UriSource = new Uri("ms-appx:///Assets/Images/unpin-48px.png", UriKind.Absolute);
                pinButton.Icon = icon;
                pinButton.Label = _resourceLoader.GetString("UnpinLabel");
            }

            backButton.IsEnabled = _model.DayOffset != 6;
            nextButton.IsEnabled = _model.DayOffset != 0;
        }
Пример #33
0
 public static void SetIconOverlay(this UIElement view, BitmapIcon icon)
 {
     var overlay = s_iconOverlays.GetOrCreateValue(view);
     overlay.Icon = icon;
     view.GotFocus += View_GotFocus; // hrm weak event?
 }
 public MenuItem(string header, string subHeader, string iconUri)
 {
     Header = header;
     SubHeader = subHeader;
     BitmapIcon icon = new BitmapIcon();
     icon.UriSource = new Uri(iconUri);
     Icon = icon;
 }
        private void AlignButton_Click(object sender, RoutedEventArgs e)
        {
            bool isAligned = _onScreenImageProviders == _alignedImageProviders;

            if (!isAligned)
            {
                _onScreenImageProviders = _alignedImageProviders;
                BitmapIcon icon = new BitmapIcon();
                icon.UriSource = new Uri("ms-appx:/Assets/appbar.align.enabled.png");
                alignButton.Icon = icon;
            }
            else
            {
                _onScreenImageProviders = _unalignedImageProviders;
                BitmapIcon icon = new BitmapIcon();
                icon.UriSource = new Uri("ms-appx:/Assets/appbar.align.disabled.png");
                alignButton.Icon = icon;
            }

            Render(_onScreenImageProviders, _animationIndex, true);
            AdjustPreviewImageSizeAccordingToLayout();

            saveButton.IsEnabled = true;
        }
        private void FrameButton_Click(object sender, RoutedEventArgs e)
        {
            _frameEnabled = !_frameEnabled;
            AnimatedAreaIndicator.Visibility = _frameEnabled ? Visibility.Visible : Visibility.Collapsed;

            if (!_frameEnabled)
            {
                ImageElement.Clip = null;
                BitmapIcon icon = new BitmapIcon();
                icon.UriSource = new Uri("ms-appx:/Assets/appbar.frame.disabled.png");
                frameButton.Icon = icon;
            }
            else
            {
                ImageElement.Clip = _animatedArea;
                BitmapIcon icon = new BitmapIcon();
                icon.UriSource = new Uri("ms-appx:/Assets/appbar.frame.enabled.png");
                frameButton.Icon = icon;
            }

            Render(_onScreenImageProviders, _animationIndex, true);

            saveButton.IsEnabled = true;
        }
Пример #37
0
        private void PlayPauseButton_Click(object sender, RoutedEventArgs e)
        {
            var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
            ((Window.Current.Content as Frame).Content as MainPage).PlayPauseButtonOnLeft_Click(null, null);
            if (NowState == MediaPlayerState.Playing)
            {
                NowState = MediaPlayerState.Paused;
                ToolTipService.SetToolTip(PlayPauseButton, loader.GetString("PauseTip.Text"));
                var icon = new BitmapIcon();
                icon.UriSource = new Uri("ms-appx:///Assets/ButtonIcon/playsolid.png");
                PlayPauseButton.Content = icon;
                return;
            }

            if (NowState == MediaPlayerState.Paused || NowState == MediaPlayerState.Stopped)
            {
                NowState = MediaPlayerState.Playing;
                ToolTipService.SetToolTip(PlayPauseButton, loader.GetString("PlayTip.Text"));
                var icon = new BitmapIcon();
                icon.UriSource = new Uri("ms-appx:///Assets/ButtonIcon/pausesolid.png");
                PlayPauseButton.Content = icon;
                return;
            }

        }
Пример #38
0
 private void StopButton_Click(object sender, RoutedEventArgs e)
 {
     ((Window.Current.Content as Frame).Content as MainPage).StopButton_Click(null, null);
     NowState = MediaPlayerState.Stopped;
     var icon = new BitmapIcon();
     icon.UriSource = new Uri("ms-appx:///Assets/ButtonIcon/playsolid.png");
     PlayPauseButton.Content = icon;
 }
Пример #39
0
 private void PlayPauseButton_Loaded(object sender, RoutedEventArgs e)
 {
     var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
     var t = (TextBlock)ToolTipService.GetToolTip(PlayPauseButton);
     NowState = BackgroundMediaPlayer.Current.CurrentState;
     switch (NowState)
     {
         case MediaPlayerState.Closed:
             break;
         case MediaPlayerState.Opening:
             break;
         case MediaPlayerState.Buffering:
             break;
         case MediaPlayerState.Playing:
             t.Text = loader.GetString("PlayTip.Text");
             var icon = new BitmapIcon();
             icon.UriSource = new Uri("ms-appx:///Assets/ButtonIcon/pausesolid.png");
             PlayPauseButton.Content = icon;
             break;
         case MediaPlayerState.Paused:
             t.Text = loader.GetString("PauseTip.Text");
             var noci = new BitmapIcon();
             noci.UriSource = new Uri("ms-appx:///Assets/ButtonIcon/playsolid.png");
             PlayPauseButton.Content = noci;
             break;
         case MediaPlayerState.Stopped:
             break;
         default:
             break;
     }
 }