/// <summary>
        /// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush.
        /// </summary>
        /// <param name="icon">The FontAwesome icon to be drawn.</param>
        /// <param name="foregroundBrush">The System.Windows.Media.Brush to be used as the foreground.</param>
        /// <returns>A new System.Windows.Media.ImageSource</returns>
        public static ImageSource CreateImageSource(FontAwesomeIcon icon, Brush foregroundBrush, double emSize = 100)
        {
            var charIcon = char.ConvertFromUtf32(icon.GetUnicode());

            var visual = new DrawingVisual();

            using (var drawingContext = visual.RenderOpen())
            {
                Typeface temp   = FontAwesomeTypefaceSolid;
                string   iconID = icon.GetIconID();
                if (iconID.StartsWith("far"))
                {
                    temp = FontAwesomeTypefaceRegular;
                }
                else if (iconID.StartsWith("fab"))
                {
                    temp = FontAwesomeTypefaceBrand;
                }

#if NETCOREAPP3_1_OR_GREATER
                drawingContext.DrawText(new FormattedText(charIcon, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, temp, emSize, foregroundBrush, 125)
                {
                    TextAlignment = TextAlignment.Center
                }, new Point(0, 0));
#elif NETFRAMEWORK
                drawingContext.DrawText(new FormattedText(charIcon, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, temp, emSize, foregroundBrush)
                {
                    TextAlignment = TextAlignment.Center
                }, new Point(0, 0));
#endif
            }
            return(new DrawingImage(visual.Drawing));
        }
        /// <summary>
        /// Egy kocka dobása és új kártya húzása a dobás alapján
        /// </summary>
        private void UjKartyaHuzasa()
        {
            huzasokSzama++;

            if (huzasokSzama == 2)
            {
                //PartiallyButton.IsEnabled = true;   később ezt visszatesszük
                YesButton.IsEnabled         = true;
                NoButton.IsEnabled          = true;
                ShowNewCardButton.IsEnabled = false;
            }

            // Kell egy 6 lapos kártya csomag

            var kartyak = new FontAwesome.WPF.FontAwesomeIcon[6];

            kartyak[0] = FontAwesome.WPF.FontAwesomeIcon.Car;
            kartyak[1] = FontAwesome.WPF.FontAwesomeIcon.SnowflakeOutline;
            kartyak[2] = FontAwesome.WPF.FontAwesomeIcon.Briefcase;
            kartyak[3] = FontAwesome.WPF.FontAwesomeIcon.Book;
            kartyak[4] = FontAwesome.WPF.FontAwesomeIcon.Male;
            kartyak[5] = FontAwesome.WPF.FontAwesomeIcon.Female;

            // Dobunk egy dobókockával

            var dobokocka = new Random();
            var dobas     = dobokocka.Next(0, 5);


            // amelyik kártyát kijelöli a kocka, megjelenítjük a jobboldali kártyahelyen

            elozoKartya = CardPlaceRight.Icon;

            CardPlaceRight.Icon = kartyak[dobas];
        }
Beispiel #3
0
 public CommandViewModel(FontAwesomeIcon icon, string text, ICommand command)
 {
     Ensure.NotNull(command, "command");
     Icon    = icon;
     Text    = text;
     Command = command;
 }
Beispiel #4
0
        ///// <summary>
        ///// The dependencyproperty for the icon rotation on a ContentControl
        ///// </summary>
        //public static readonly DependencyProperty IconRotationProperty =
        //    DependencyProperty.RegisterAttached(
        //        "IconRotation",
        //        typeof(double),
        //        typeof(ContentControl),
        //        new PropertyMetadata(default(double), RotationChanged));

        ///// <summary>
        ///// Gets the icon rotation of the ContentControl
        ///// </summary>
        ///// <param name="target">The target ContentControl</param>
        ///// <returns>Returns the current icon rotation</returns>
        //public static double GetIconRotation(DependencyObject target)
        //{
        //    return (double)target.GetValue(IconRotationProperty);
        //}

        ///// <summary>
        ///// Sets the icon rotation on the ContentControl
        ///// </summary>
        ///// <param name="target">The target ContentControl</param>
        ///// <param name="value">The new icon rotation value</param>
        //public static void SetIconRotation(DependencyObject target, double value)
        //{
        //    target.SetValue(IconRotationProperty, value);
        //}
        #endregion

        private static void IconChanged(DependencyObject sender, DependencyPropertyChangedEventArgs evt)
        {
            if (!(sender is ContentControl))
            {
                return;
            }

            ContentControl target = (ContentControl)sender;

            if (!(evt.NewValue is FontAwesomeIcon))
            {
                return;
            }

            FontAwesomeIcon symbolIcon = (FontAwesomeIcon)evt.NewValue;
            int             symbolCode = (int)symbolIcon;
            char            symbolChar = symbolIcon.GetUnicode();

            string iconID = symbolIcon.GetIconID();

            if (iconID.StartsWith("far"))
            {
                target.FontFamily = Management.FontAwesomeRegular;
            }
            else if (iconID.StartsWith("fab"))
            {
                target.FontFamily = Management.FontAwesomeBrand;
            }
            else
            {
                target.FontFamily = Management.FontAwesomeSolid;
            }

            target.Content = symbolChar;
        }
Beispiel #5
0
 public MainWindow()
 {
     InitializeComponent();
     DataContext = this;
     TestIcon    = FontAwesomeIcon.BrandsGg;
     //lblIcon.SetRotation(90);
 }
        private IEnumerable <IconDescription> ToIconDescription(FontAwesomeIcon icon, string filter)
        {
            var memberInfo = typeof(FontAwesomeIcon).GetTypeInfo().GetDeclaredField(icon.ToString());

            if (memberInfo == null)
            {
                yield break;
            }

            foreach (var cat in memberInfo.GetCustomAttributes(typeof(IconCategoryAttribute), false).Cast <IconCategoryAttribute>())
            {
                var desc = memberInfo.GetCustomAttributes(typeof(DescriptionAttribute), false).Cast <DescriptionAttribute>().First();
                var id   = memberInfo.GetCustomAttributes(typeof(IconIdAttribute), false).Cast <IconIdAttribute>().FirstOrDefault();

                if (!string.IsNullOrEmpty(filter) &&
                    !(
                        desc.Description.IndexOf(filter, StringComparison.CurrentCultureIgnoreCase) > -1 ||
                        icon.ToString().IndexOf(filter, StringComparison.CurrentCultureIgnoreCase) > -1)
                    )
                {
                    continue;
                }

                yield return(new IconDescription {
                    Category = cat.Category, Description = desc.Description, Icon = icon, Id = id?.Id
                });
            }
        }
Beispiel #7
0
        /// <summary>
        /// Ebbe a függvénybe szerveztük ki a kártyahúzással kapcsolatos feladatokat.
        /// Előnye, hogy több helyről is meghívható.
        /// </summary>
        private void UjKartyaHuzasa()
        {
            //dobunk egyet 0 és 5 között
            var dobas = dobokocka.Next(0, 5);

            //ez egy értékadás szabályai
            //az egyenlőségjel két részre osztja a sort
            //az egyenlóségjel bal oldalán szereplő változó KAPJA az értéket és tárolja
            //az egyenlőségjel jobb oldalán lévő kifejezés ADJA az értékét

            //+ feladat: olyan változót kell létrehozni,
            //ami itt is látszódik ebben a kódblokkban,
            //és ami a gombok
            //eseményvezérlőiben is látszik, így nem lehet lokális változó
            elozoKartya = CardRight.Icon;

            //eltüntetni az előző kártyát: átköltözik az XAML-be
            //var animationOut = new DoubleAnimation(1, 0, TimeSpan.FromMilliseconds(100));
            //CardRight.BeginAnimation(OpacityProperty, animationOut);

            //veszem a kártyapakli dobásnak megfelelő elemét és megjelenítem.
            CardRight.Icon = kartyapakli[dobas];

            //megjeleníteni az új kártyát: átköltözik az XAML-be
            //var animationIn = new DoubleAnimation(0, 1, TimeSpan.FromMilliseconds(100));
            //CardRight.BeginAnimation(OpacityProperty, animationIn);

            //stopperórát elindítani
            stopwatch.Restart();
        }
Beispiel #8
0
        private void SetupNotebookIcon(FontAwesomeIcon icon, string text, System.Windows.Media.Brush brush,
                                       double x, double y)
        {
            var container = SetupIcon(icon, text, brush, x, y);

            HandleNotebookIconAction(container);
        }
Beispiel #9
0
        /// <summary>
        /// Picking up a new card
        /// </summary>
        private void ShowNewCard()
        {
            CardBefore = MainWindow.CardPlaceRight.Icon;
            Random random = new Random();
            var    number = random.Next(0, 2);

            TurnDownCard();

            //50% chance to pick old Card (number=0), 50% to pick a new Card (number=1)
            if (number <= 0 & CardBefore != FontAwesomeIcon.None)
            {//will pick the OLD Card
                MainWindow.CardPlaceRight.Icon = CardBefore;
            }
            else
            {//will pick a NEW Card
                bool isOldCard = true;
                while (isOldCard)
                {//Check if the picked new card is the old card, when yes then will pick a new one
                    //number will pick a Card from the Deck from 0 to 4, 4 is exclusive
                    number = random.Next(0, CardDeck.NrOfCardsInPlay);
                    if (MainWindow.CardPlaceRight.Icon == CardDeck.Cards[number])
                    {//the new Card is the Old ard
                        isOldCard = true;
                    }
                    else
                    {//the New card is different from the Old card
                        isOldCard = false;
                        MainWindow.CardPlaceRight.Icon = CardDeck.Cards[number];
                    }
                }
            }
        }
Beispiel #10
0
        private void ShowStatusInternal(string message       = null, int milliSeconds = 0,
                                        FontAwesomeIcon icon = FontAwesomeIcon.None,
                                        Color color          = default(Color),
                                        bool spin            = false, bool noDispatcher = false)
        {
            if (color == default(Color))
            {
                color = Colors.Green;
            }

            if (icon != FontAwesomeIcon.None)
            {
                SetStatusIcon(icon, color, spin);
            }

            if (message == null)
            {
                message = "Ready";
                SetStatusIcon();
            }

            StatusText.Text = message;

            if (milliSeconds > 0)
            {
                // debounce rather than delay so if something else displays
                // a message the delay timer is 'reset'
                debounce.Debounce(milliSeconds, (p) => ShowStatus(null, 0), null);
            }
        }
Beispiel #11
0
        private static void OnIconPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            FontAwesomeIcon symbolIcon = (FontAwesomeIcon)e.NewValue;

            d.SetValue(TextOptions.TextRenderingModeProperty, TextRenderingMode.ClearType);

            string iconID = symbolIcon.GetIconID();

            if (iconID.StartsWith("far"))
            {
                d.SetValue(FontFamilyProperty, FontAwesomeRegular);
                d.SetValue(FontWeightProperty, FontWeights.Regular);
            }
            else if (iconID.StartsWith("fab"))
            {
                d.SetValue(FontFamilyProperty, FontAwesomeBrand);
                d.SetValue(FontWeightProperty, FontWeights.Regular);
            }
            else
            {
                d.SetValue(FontFamilyProperty, FontAwesomeSolid);
                d.SetValue(FontWeightProperty, FontWeights.Normal);
            }

            d.SetValue(TextAlignmentProperty, TextAlignment.Center);
            d.SetValue(TextProperty, char.ConvertFromUtf32((int)e.NewValue));
        }
 /// <summary>
 /// Displays a status message on the main application's status bar
 /// </summary>
 /// <param name="message"></param>
 /// <param name="timeoutMs"></param>
 /// <param name="icon"></param>
 /// <param name="color"></param>
 /// <param name="spin"></param>
 public void ShowStatus(string message       = null, int timeoutMs = 0,
                        FontAwesomeIcon icon = FontAwesomeIcon.None,
                        Color color          = default(Color),
                        bool spin            = false)
 {
     Model.Window.ShowStatus(message, timeoutMs, icon, color, spin);
 }
Beispiel #13
0
        /// <summary>
        /// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush.
        /// </summary>
        /// <param name="icon">The FontAwesome icon to be drawn.</param>
        /// <param name="foregroundBrush">The System.Windows.Media.Brush to be used as the foreground.</param>
        /// <returns>A new System.Windows.Media.ImageSource</returns>
        public static ImageSource CreateImageSource(FontAwesomeIcon icon, Brush foregroundBrush, double emSize = 100)
        {
            var visual = new DrawingVisual();

            using (var drawingContext = visual.RenderOpen())
            {
#if NETCORE
                drawingContext.DrawText(
                    new FormattedText(icon.GetUnicode(), CultureInfo.InvariantCulture, FlowDirection.LeftToRight,
                                      icon.GetTypeFace(), emSize, foregroundBrush, 1.0)
                {
                    TextAlignment = TextAlignment.Center
                }, new Point(0, 0));
#else
                var charIcon = char.ConvertFromUtf32((int)icon);

                drawingContext.DrawText(
                    new FormattedText(charIcon, CultureInfo.InvariantCulture, FlowDirection.LeftToRight,
                                      FontAwesomeTypeface, emSize, foregroundBrush, 1.0)
                {
                    TextAlignment = TextAlignment.Center
                }, new Point(0, 0));
#endif
            }
            return(new DrawingImage(visual.Drawing));
        }
Beispiel #14
0
 public void TestInitialize()
 {
     _message = "someMessage";
     _title   = "someTitle";
     _buttons = MessageBoxButton.YesNoCancel;
     _icon    = FontAwesomeIcon.Navicon;
     _isDependenciesButtonVisible = true;
     _isError    = false;
     _isInfo     = true;
     _isQuestion = false;
     _duplicates = new List <string>();
     _isDeleteAnywayButtonVisible = false;
     _applyToAll        = false;
     _changedProperties = new List <string>();
     _target            = new MessageBoxViewModel(
         _message,
         _title,
         _buttons,
         _icon,
         _isDependenciesButtonVisible,
         _isError,
         _isInfo,
         _isQuestion,
         _duplicates,
         _isDeleteAnywayButtonVisible,
         _applyToAll);
     _target.PropertyChanged += (sender, args) => { _changedProperties.Add(args.PropertyName); };
 }
Beispiel #15
0
 public PopupWindow(UserControl content, string title, FontAwesomeIcon icon, bool closeable, object parameter)
 {
     InitializeComponent();
     Title         = title;
     DataContext   = new PopupWindowsViewModel(this, content, icon, closeable, parameter);
     this.Closing += PopupWindow_Closing;
 }
        public void ShowStatus(string message       = null, int milliSeconds = 0,
                               FontAwesomeIcon icon = FontAwesomeIcon.None,
                               Color color          = default(Color),
                               bool spin            = false)
        {
            if (icon != FontAwesomeIcon.None)
            {
                SetStatusIcon(icon, color, spin);
            }

            if (message == null)
            {
                message = "Ready";
                SetStatusIcon();
            }

            StatusText.Text = message;

            if (milliSeconds > 0)
            {
                // debounce rather than delay so if something else displays
                // a message the delay timer is 'reset'
                debounce.Debounce(milliSeconds, (win) =>
                {
                    var window = win as GitCommitDialog;
                    window.ShowStatus(null, 0);
                }, this);
            }

            WindowUtilities.DoEvents();
        }
 public ThirdPartyCopyrightListing(FontAwesomeIcon icon, string content, string licenseUrl)
 {
     Icon       = icon;
     Content    = content;
     LicenseUrl = licenseUrl;
     InitializeComponent();
 }
 public UCItem(string textName, FontAwesomeIcon icon, string textBadges)
 {
     InitializeComponent();
     this.IsSelect       = false;
     this.txtName.Text   = textName;
     this.txtBadges.Text = textBadges;
     this.icon.Icon      = icon;
 }
Beispiel #19
0
        /// <summary>
        ///     Gets a FontAwesome icon texture.
        /// </summary>
        /// <param name="icon"></param>
        /// <returns></returns>
        public static Texture2D Get(FontAwesomeIcon icon)
        {
            var name = icon.ToString().Replace("_", "-");

            name += ".png";

            return(TextureManager.Load($"Quaver.Resources/Textures/FontAwesome/{name}"));
        }
Beispiel #20
0
        private bool IsAlias(FontAwesomeIcon icon)
        {
            var type    = typeof(FontAwesomeIcon);
            var memInfo = type.GetMember(icon.ToString());
            var attr    = memInfo[0].GetCustomAttribute <IconAliasAttribute>();

            return(attr != null);
        }
 private void SetStatusBarIcon(FontAwesomeIcon newIcon, bool shouldSpin)
 {
     this.Dispatcher.Invoke(() =>
     {
         ServerStateIcon.Icon = newIcon;
         ServerStateIcon.Spin = shouldSpin;
     });
 }
Beispiel #22
0
        private void DisplayCommunityGroup(bool display, FontAwesomeIcon icon)
        {
            (FreeCompanyShowButton.Content as ImageAwesome).Icon = icon;
            (NoviceShowButton.Content as ImageAwesome).Icon      = icon;

            ironworksSettings.Chat.FreeCompany.Show = display;
            ironworksSettings.Chat.Novice.Show      = display;
        }
 public ForumBoardEntryViewModel(string name, string description, FontAwesomeIcon icon, ForumBoards board)
 {
     Entry = new ForumBoardEntry {
         Name = name, Description = description
     };
     Icon  = icon;
     Board = board;
 }
Beispiel #24
0
 /// <summary>
 /// Create a new instance of this class
 /// </summary>
 /// <param name="parentWindow">The parent window</param>
 /// <param name="fontAwesomeIcon">The icon to use for the title bar</param>
 /// <param name="title">The title to use</param>
 /// <param name="controlToOpen">The control to open</param>
 public OpenCustomPopupWindowCommand(
     Window parentWindow,
     FontAwesomeIcon fontAwesomeIcon,
     string title,
     UserControl controlToOpen
     ) : this(parentWindow, fontAwesomeIcon, title, controlToOpen, null)
 {
 }
Beispiel #25
0
 /// <summary>
 /// Status the statusbar icon on the left bottom to some indicator
 /// </summary>
 /// <param name="icon"></param>
 /// <param name="color"></param>
 /// <param name="spin"></param>
 public void SetStatusIcon(FontAwesomeIcon icon, Color color, bool spin = false)
 {
     StatusIcon.Icon = icon;
     StatusIcon.Foreground = new SolidColorBrush(color);
     if (spin)
         StatusIcon.SpinDuration = 30;
     StatusIcon.Spin = spin;
 }
        private void AddProIcons()
        {
            ProIcons.Children.Clear();
            if (FontAwesomeIcon.ProBrandsFontFamily != null)
            {
                var control = new FontAwesomeIcon()
                {
                    BrandIcon = FontAwesomeBrandsIcon.Icon500px,
                    FontSize  = 60,
                };

                ProIcons.Children.Add(control);
            }

            if (FontAwesomeIcon.ProDuotoneFontFamily != null)
            {
                var control = new FontAwesomeIcon()
                {
                    DuotoneIcon = FontAwesomeDuotoneIcon.Abacus,
                    FontSize    = 60,
                };

                ProIcons.Children.Add(control);
            }

            if (FontAwesomeIcon.ProLightFontFamily != null)
            {
                var control = new FontAwesomeIcon()
                {
                    LightIcon = FontAwesomeLightIcon.Abacus,
                    FontSize  = 60,
                };

                ProIcons.Children.Add(control);
            }

            if (FontAwesomeIcon.ProRegularFontFamily != null)
            {
                var control = new FontAwesomeIcon()
                {
                    RegularIcon = FontAwesomeRegularIcon.Abacus,
                    FontSize    = 60,
                };

                ProIcons.Children.Add(control);
            }

            if (FontAwesomeIcon.ProSolidFontFamily != null)
            {
                var control = new FontAwesomeIcon()
                {
                    SolidIcon = FontAwesomeSolidIcon.Abacus,
                    FontSize  = 60,
                };

                ProIcons.Children.Add(control);
            }
        }
        /// <summary>
        /// Font Awesome图标
        /// </summary>
        /// <typeparam name="TComponent">组件类型</typeparam>
        /// <param name="component">组件实例</param>
        /// <param name="icon">图标</param>
        public static TComponent FontAwesome <TComponent>(this TComponent component, FontAwesomeIcon icon) where TComponent : IIcon
        {
            var option = component as IOptionConfig;

            option?.Config <Config>(config => {
                config.SetAttribute(UiConst.FontAwesomeIcon, icon.ToString());
            });
            return(component);
        }
Beispiel #28
0
 /// <summary>
 /// Create a new instance of this class
 /// </summary>
 /// <param name="parentWindow">The parent window</param>
 /// <param name="fontAwesomeIcon">The icon to use for the title bar</param>
 /// <param name="title">The title to use</param>
 /// <param name="controlToOpen">The control to open</param>
 /// <param name="parameter">The parameter to send to the popup window</param>
 public OpenCustomPopupWindowCommand(
     Window parentWindow,
     FontAwesomeIcon fontAwesomeIcon,
     string title,
     UserControl controlToOpen,
     object parameter
     ) : this(parentWindow, fontAwesomeIcon, title, controlToOpen, true, parameter)
 {
 }
        private void addItem(string name, FontAwesomeIcon ico, string badges)
        {
            UCItem item = new UCItem(name, ico, badges);

            item.MouseDown += item_MouseDown;
            item.Tag        = ucItems.Count + 1;
            ucItems.Add(item);
            this.menu.Children.Add(item);
        }
Beispiel #30
0
        private WebControl getIconButton()
        {
            var icon  = new FontAwesomeIcon("fa-calendar", "datepickerIcon");
            var style = new CustomActionControlStyle(control => control.AddControlsReturnThis(icon));

            return(new CustomButton(() => "$( '#{0}' ).datepicker( 'show' )".FormatWith(textBox.TextBoxClientId))
            {
                ActionControlStyle = style, CssClass = "icon"
            });
        }
 private WebControl getIconButton()
 {
     var icon = new FontAwesomeIcon( "fa-clock-o", "timepickerIcon" );
     var style = new CustomActionControlStyle( control => control.AddControlsReturnThis( icon ) );
     return new CustomButton( () => "$( '#{0}' ).timepicker( 'show' )".FormatWith( textBox.TextBoxClientId ) ) { ActionControlStyle = style, CssClass = "icon" };
 }
 /// <summary>
 /// Sets the content of a ContentControl expressed as a FontAwesome icon. This will cause the content to be redrawn.
 /// </summary>
 /// <param name="target">The ContentControl where to set the content</param>
 /// <param name="value">FontAwesome icon to set as content</param>
 public static void SetContent(DependencyObject target, FontAwesomeIcon value)
 {
     target.SetValue(ContentProperty, value);
 }
 public ForumBoardEntryViewModel(string name, string description, FontAwesomeIcon icon,ForumBoards board)
 {
     Entry = new ForumBoardEntry {Name = name, Description = description};
     Icon = icon;
     Board = board;
 }
        /// <summary>
        /// Creates a new System.Windows.Media.ImageSource of a specified FontAwesomeIcon and foreground System.Windows.Media.Brush.
        /// </summary>
        /// <param name="icon">The FontAwesome icon to be drawn.</param>
        /// <param name="foregroundBrush">The System.Windows.Media.Brush to be used as the foreground.</param>
        /// <returns>A new System.Windows.Media.ImageSource</returns>
        public static ImageSource CreateImageSource(FontAwesomeIcon icon, Brush foregroundBrush)
        {
            var charIcon = char.ConvertFromUtf32((int)icon);

            var visual = new DrawingVisual();
            using (var drawingContext = visual.RenderOpen())
            {
                drawingContext.DrawText(
                    new FormattedText(charIcon, CultureInfo.InvariantCulture, FlowDirection.LeftToRight,
                        FontAwesomeTypeface, 100, foregroundBrush) { TextAlignment = TextAlignment.Center }, new Point(0, 0));
            }
            return new DrawingImage(visual.Drawing);
        }