Ejemplo n.º 1
0
            /// <summary>
            /// Updates formatting based on input from the toolbar controls
            /// </summary>
            private void UpdateFormat(object sender, EventArgs args)
            {
                if (sizeList.Selection != null && fontList.Selection != null)
                {
                    float      textSize = sizeList.Selection.AssocMember;
                    IFontMin   font     = fontList.Selection.AssocMember;
                    FontStyles style    = FontStyles.Regular;

                    // Bolding requires a separate set of texture atlases, and as such, isn't always
                    // available
                    boldToggle.Enabled = font.IsStyleDefined(FontStyles.Bold);

                    if (boldToggle.Selected)
                    {
                        style |= FontStyles.Bold;
                    }

                    // Underlining and italics are render as effects and are available
                    // for every font
                    if (underlineToggle.Selected)
                    {
                        style |= FontStyles.Underline;
                    }

                    if (italicToggle.Selected)
                    {
                        style |= FontStyles.Italic;
                    }

                    _format = new GlyphFormat(_format.Color, _format.Alignment, textSize, font.GetStyleIndex(style));
                    FormatChanged?.Invoke();
                }
            }
Ejemplo n.º 2
0
        public void Handle(FormatChanged e)
        {
            using (var session = _store.OpenSession())
            {
                var get = session.Load <Responses.Get>(e.CurrencyId);
                get.Format = e.Format;

                session.SaveChanges();

                _manager.Publish(get);
            }
        }
Ejemplo n.º 3
0
        public void Handle(FormatChanged e)
        {
            _elastic.Update <Responses.Index, Object>(x => x
                                                      .Id(e.CurrencyId)
                                                      .Doc(new { Format = e.Format })
                                                      .RetryOnConflict(3)
                                                      .Refresh()
                                                      );

            var index = _elastic.Get <Responses.Index>(e.CurrencyId);

            _manager.Publish(index.Source);
        }
Ejemplo n.º 4
0
 protected virtual void OnFormatChanged(EventArgs e)
 {
     FormatChanged?.Invoke(this, e);
 }
Ejemplo n.º 5
0
 private void FormatCtrl_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     FormatChanged.SafeInvoke();
 }
Ejemplo n.º 6
0
 public void RaiseFormatChangedEvent(FormatStorage.Formats newFormat) => FormatChanged?.Invoke(newFormat);