Example #1
0
        public override void Initial(UIElement parent, object dat = null)
        {
            base.Initial(parent, dat);
            view = LoadUI <View>("baseUI", "start");
            InitialEvent();
            InitialData();
            //view.InputBox.ReadOnly = true;
            view.InputBox.InputString = "0123456789大随风😝AA";
            CustomFont font = new CustomFont(ElementAsset.FindTexture(null, "icons"));
            var        sp   = ElementAsset.FindSprites(null, "icons", new string[] { "Badge1", "Badge2", "Badge3l", });
            string     str  = "123";

            for (int i = 0; i < 3; i++)
            {
                font.AddCharMap(str[i], sp[i], 66);
            }
            view.www.customFont         = font;
            view.www.Text               = "0123456789大随风😝AA";
            view.scrolly.ItemDockCenter = true;
            //var tb = new SerializedData.TestB();
            //tb.a = 56;
            //tb.v.x = 100;
            //tb.v.y = 66;
            //tb.h = new SerializedData.TestA();
            //tb.h.v2 = new Vector2[] { new Vector2(11, 22) };
            //tb.h.b = new string[] { "a", "b" };
            //tb.h.e = new List<string>(new string[] { "c", "d" });
            //str = tb.Save().ToString();
            //var jo = JObject.Parse(str);
            //var tc = new SerializedData.TestB();
            //tc.Load(jo);
        }
Example #2
0
        public void AddAnswer(Document _document, ResultDto result)
        {
            Paragraph paragraph = new Paragraph(result.ResultString, new Font(CustomFont.BaseFontVerdana(), Context.SIZE));

            paragraph.SpacingBefore   = Context.SPACINGBEFORE;
            paragraph.IndentationLeft = Context.SPACINGLEFT;
            _document.Add(paragraph);
        }
Example #3
0
        public void AddQuestion(string text)
        {
            Paragraph paragraph = new Paragraph(text, new Font(CustomFont.BaseFontVerdana(), 10f, Font.BOLD));

            paragraph.SpacingBefore   = 5f;
            paragraph.SpacingAfter    = -5f;
            paragraph.IndentationLeft = 10f;
            _document.Add(paragraph);
        }
Example #4
0
        private static void ShowAResult(Document _document, ResultDto result)
        {
            var       text      = result.ResultList[0].ToString();
            Paragraph paragraph = new Paragraph(text, new Font(CustomFont.BaseFontVerdana(), Context.SIZE));

            paragraph.SpacingBefore   = Context.SPACINGBEFORE;
            paragraph.IndentationLeft = Context.SPACINGLEFT;
            _document.Add(paragraph);
        }
Example #5
0
        public void AddAnswer(Document _document, ResultDto result)
        {
            var       dateTimeResult = result.ResultDateTime.HasValue ? result.ResultDateTime.Value.ToShortDateString() : "";
            Paragraph paragraph      = new Paragraph(dateTimeResult, new Font(CustomFont.BaseFontVerdana(), Context.SIZE));

            paragraph.SpacingBefore   = Context.SPACINGBEFORE;
            paragraph.IndentationLeft = Context.SPACINGLEFT;
            _document.Add(paragraph);
        }
Example #6
0
        public void AddAnswer(Document _document, ResultDto result)
        {
            var       formatInteger = result.ResultInteger.HasValue ? result.ResultInteger.Value.ToString("N0") : "";
            Paragraph paragraph     = new Paragraph(formatInteger, new Font(CustomFont.BaseFontVerdana(), Context.SIZE));

            paragraph.SpacingBefore   = Context.SPACINGBEFORE;
            paragraph.IndentationLeft = Context.SPACINGLEFT;
            _document.Add(paragraph);
        }
Example #7
0
 public Cover(string title, string subject, string description1, string description2, string description3)
 {
     header = new Phrase[] {
         new Phrase(title, new Font(CustomFont.BaseFontVerdana(), 50f, Font.BOLD)),
         new Phrase(subject, new Font(CustomFont.BaseFontVerdana(), 35f, 1, BaseColor.GRAY)),
         new Phrase(description1, new Font(CustomFont.BaseFontVerdana(), 12f)),
         new Phrase(description2, new Font(CustomFont.BaseFontVerdana(), 12f)),
         new Phrase(description3, new Font(CustomFont.BaseFontVerdana(), 12f))
     };
 }
Example #8
0
        public static Font Create(
            CustomFont family,
            float emSize,
            FontStyle style   = FontStyle.Regular,
            GraphicsUnit unit = GraphicsUnit.Pixel)
        {
            var fam = sFonts.Families[(int)family];

            return(new Font(fam, emSize, style, unit));
        }
Example #9
0
        public void AddAnswer(Document _document, ResultDto result)
        {
            var matrixInOneList = result.ResultMatrix.SelectMany(x => x).ToList();
            var cell            = matrixInOneList.Aggregate((current, next) => current + ", " + next);

            Paragraph paragraph = new Paragraph(cell, new Font(CustomFont.BaseFontVerdana(), Context.SIZE));

            paragraph.SpacingBefore   = Context.SPACINGBEFORE;
            paragraph.IndentationLeft = Context.SPACINGLEFT;
            _document.Add(paragraph);
        }
Example #10
0
        public static Font GetFont(CustomFont font, float emSize)
        {
            Font result;

            try { result = Create(font, emSize); }
            catch (Exception e)
            {
                App.Log("Failed to load custom scoreboard font: " + e.Message);
                result = new Font(FontFamily.GenericMonospace, emSize);
            }
            return(result);
        }
Example #11
0
        public void AddSection(string text)
        {
            Paragraph paragraph = new Paragraph(text, new Font(CustomFont.BaseFontVerdana(), 14f));
            Chapter   chapter   = new Chapter(paragraph, 0);

            chapter.NumberDepth       = 0;
            paragraph.IndentationLeft = 10f;
            ChapterBorder border = new ChapterBorder();

            _writer.PageEvent = border;
            border.SetActive(true);
            _document.Add(chapter);
            border.SetActive(false);
        }
Example #12
0
        private void InitializeLabel()
        {
            _floatingLabel = new UILabel
            {
                Alpha = this.Text.Length > 0 ? 1.0f : 0.0f,
                Font  = CustomFont == null?Xamarin.Forms.Font.Default.ToUIFont() : CustomFont.ToUIFont()
            };

            AddSubview(_floatingLabel);

            this.ShouldBeginEditing += EditingBegan;
            this.ShouldEndEditing   += EditingEnded;
            this.ClipsToBounds       = false;
            this.AutosizesSubviews   = false;
            this.AutoresizingMask    = UIViewAutoresizing.FlexibleBottomMargin;
        }
Example #13
0
        private static void ShowList(Document _document, ResultDto result)
        {
            //Font zapfdingbats = new Font(FontFamily.ZAPFDINGBATS, 8);
            Font font = new Font(CustomFont.BaseFontVerdana(), Context.SIZE);
            //Chunk bullet = new Chunk((char)109, zapfdingbats);

            Paragraph paragraph = new Paragraph(null, font);

            paragraph.IndentationLeft = 20f;
            paragraph.SpacingBefore   = Context.SPACINGBEFORE;
            foreach (var item in result.ResultList)
            {
                //paragraph.Add(bullet);
                paragraph.Add(new Phrase(" " + item + " \n", font));
            }

            _document.Add(paragraph);
        }
Example #14
0
        //Handles the animation, fonts and placement of the floating label and placeholder
        void UpdateLabels()
        {
            if (!_shouldFloat)
            {
                _floatingLabel.Alpha = 0.0f;
            }

            AnimateNotify(0.5, 0.0, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.CurveEaseOut, () =>
            {
                _animationInProgress = true;

                if (_shouldFloat)
                {
                    this.AttributedPlaceholder = CustomFont.BuildAttributedString(this.Placeholder);
                }
                else
                {
                    Placeholder = _placeHolderText;

                    if (CustomPlaceholderFont != null)
                    {
                        this.AttributedPlaceholder = CustomPlaceholderFont.BuildAttributedString(this.Placeholder);
                    }
                }

                // Invokes the Rect Methods
                this.LayoutIfNeeded();
            }, (finished) =>
            {
                if (finished)
                {
                    if (_shouldFloat)
                    {
                        _floatingLabel.Alpha = 1.0f;
                        Placeholder          = "";
                    }
                }

                _animationInProgress = false;
            });
        }
Example #15
0
    public override void Refresh()
    {
        base.Refresh();
        var txt = GetComponent <HText>();

        if (txt != null)
        {
            CustomFont font = null;
            for (int i = 0; i < chars.Count; i++)
            {
                if (chars[i].sprite != null)
                {
                    if (font == null)
                    {
                        font = new CustomFont(chars[i].sprite.texture);
                    }
                    font.AddCharMap(chars[i].cha, chars[i].sprite, NormalFontSize);
                }
            }
            txt.Content.customFont = font;
        }
    }
Example #16
0
 public WaterMark(string textWatermark)
 {
     _textWatermark = textWatermark;
     _watermark     = new Phrase(_textWatermark, new Font(CustomFont.BaseFontVerdana(), 60, Font.NORMAL, BaseColor.LIGHT_GRAY));
 }
Example #17
0
        /// <summary>
        /// Show the notification window if it is not already visible.
        /// If the window is currently disappearing, it is shown again.
        /// </summary>
        public void Popup()
        {
            i++;
            if (!disposed)
            {
                if (!frmPopup.Visible)
                {
                    frmPopup.Size = Size;
                    if (Scroll)
                    {
                        int tinggi = (int)Helper.getTextHeight(ContentText, 300, CustomFont.GetFont("Helve", 10, FontStyle.Regular));
                        if (tinggi > 50)
                        {
                            frmPopup.Height = (tinggi - 50) + frmPopup.Height;
                        }
                        posStart = Screen.PrimaryScreen.WorkingArea.Bottom;
                        //posStop = Screen.PrimaryScreen.WorkingArea.Bottom - (frmPopup.Height * ObjectNumber);
                        posStop = (LastPos > 0)? LastPos - frmPopup.Height : Screen.PrimaryScreen.WorkingArea.Bottom - (frmPopup.Height * ObjectNumber);
                        LastPos = posStop;
                    }
                    else
                    {
                        posStart = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height;
                        posStop  = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height;
                    }
                    opacityStart = 0;
                    opacityStop  = 1;

                    frmPopup.Opacity  = opacityStart;
                    frmPopup.Location = new Point(Screen.PrimaryScreen.WorkingArea.Right - frmPopup.Size.Width - 1, posStart);
                    //frmPopup.Location = new Point(965, -400);
                    //System.Diagnostics.Debug.WriteLine(frmPopup.Location);
                    frmPopup.Visible = true;
                    isAppearing      = true;

                    tmrWait.Interval      = Delay;
                    tmrAnimation.Interval = AnimationInterval;
                    realAnimationDuration = AnimationDuration;
                    tmrAnimation.Start();
                    sw = System.Diagnostics.Stopwatch.StartNew();
                    //System.Diagnostics.Debug.WriteLine("Animationg started.");
                }
                else
                {
                    if (!isAppearing)
                    {
                        frmPopup.Size = Size;
                        if (Scroll)
                        {
                            posStart = frmPopup.Top;
                            posStop  = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height;
                        }
                        else
                        {
                            posStart = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height;
                            posStop  = Screen.PrimaryScreen.WorkingArea.Bottom - frmPopup.Height;
                        }
                        opacityStart          = frmPopup.Opacity;
                        opacityStop           = 1;
                        isAppearing           = true;
                        realAnimationDuration = Math.Max((int)sw.ElapsedMilliseconds, 1);
                        sw.Restart();
                        //System.Diagnostics.Debug.WriteLine("Animation direction changed.");
                    }
                    frmPopup.Invalidate();
                }
            }
        }
Example #18
0
 private void OpenLcd()
 {
   if (!_isDisabled)
   {
     Log.Info("iMONLCDg.OpenLcd(): called");
     if (!_IMON.iMONVFD_IsInited())
     {
       Log.Info("iMONLCDg.OpenLcd(): opening display");
       Log.Info("iMONLCDg.OpenLcd(): opening display with iMONVFD_Init({0},{1})", _VfdType.ToString("x00"),
                _VfdReserved.ToString("x0000"));
       if (!_IMON.iMONVFD_Init(_VfdType, _VfdReserved))
       {
         Log.Info("iMONLCDg.OpenLcd(): Could not open display with Open({0},{1})", _VfdType.ToString("x00"),
                  _VfdReserved.ToString("x0000"));
         _isDisabled = true;
         _errorMessage = "Could not open iMON display device";
       }
       else
       {
         Log.Info("iMONLCDg.OpenLcd(): display opened");
         if (!_displayTest & ((_DisplayType == DisplayType.LCD) || (_DisplayType == DisplayType.LCD2)))
         {
           if (DisplayOptions.UseCustomFont)
           {
             CFont = new CustomFont();
             CFont.InitializeCustomFont();
           }
           if (DisplayOptions.UseLargeIcons)
           {
             CustomLargeIcon = new LargeIcon();
             CustomLargeIcon.InitializeLargeIcons();
           }
           _iconThread = new Thread(UpdateIcons)
                           {
                             IsBackground = true,
                             Priority = ThreadPriority.BelowNormal,
                             Name = "UpdateIconThread"
                           };
           _iconThread.Start();
           if (_iconThread.IsAlive)
           {
             Log.Info("iMONLCDg.OpenLcd(): iMONLCDg.UpdateIcons() Thread Started");
           }
           else
           {
             Log.Info("iMONLCDg.OpenLcd(): iMONLCDg.UpdateIcons() FAILED TO START");
           }
         }
         else if (!_displayTest & (_DisplayType == DisplayType.VFD))
         {
           if (EQSettings.UseEqDisplay || DisplaySettings.BlankDisplayWithVideo)
           {
             _iconThread = new Thread(VFD_EQ_Update)
                             {
                               IsBackground = true,
                               Priority = ThreadPriority.BelowNormal,
                               Name = "VFD_EQ_Update"
                             };
             _iconThread.Start();
             if (_iconThread.IsAlive)
             {
               Log.Info("iMONLCDg.OpenLcd(): iMONLCDg.VFD_EQ_Update() Thread Started");
             }
             else
             {
               Log.Info("iMONLCDg.OpenLcd(): iMONLCDg.VFD_EQ_Update() FAILED TO START");
             }
           }
         }
         else if ((!_displayTest & (_DisplayType == DisplayType.ThreeRsystems)) &&
                  (EQSettings.UseEqDisplay || DisplaySettings.BlankDisplayWithVideo))
         {
           _iconThread = new Thread(VFD_EQ_Update)
                           {
                             IsBackground = true,
                             Priority = ThreadPriority.BelowNormal,
                             Name = "VFD_EQ_Update"
                           };
           _iconThread.TrySetApartmentState(ApartmentState.MTA);
           _iconThread.Start();
           if (_iconThread.IsAlive)
           {
             Log.Info("iMONLCDg.OpenLcd(): iMONLCDg.VFD_EQ_Update() Thread Started");
           }
           else
           {
             Log.Info("iMONLCDg.OpenLcd(): iMONLCDg.VFD_EQ_Update() FAILED TO START");
           }
         }
       }
     }
     else
     {
       Log.Info("iMONLCDg.OpenLcd: Display already open");
     }
     if (_MonitorPower && !_IsHandlingPowerEvent)
     {
       Log.Info("iMONLCDg.OpenLcd(): Adding Power State Monitor callback to system event thread");
       SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
     }
     lock (DWriteMutex)
     {
       if ((_DisplayType == DisplayType.LCD) || (_DisplayType == DisplayType.LCD2))
       {
         if (_DisplayType == DisplayType.LCD2)
         {
           SendData(iMonCommand.LCD2.ClearDisplay);
           if (_Contrast)
           {
             Log.Info("iMONLCDg.OpenLcd(): Setting LCD2 contrast level to {0}", _ContrastLevel);
             SendData(iMonCommand.General.SetContrast, _ContrastLevel);
           }
           SendData(iMonCommand.General.SetIcons);
           SendData(iMonCommand.General.SetLines0);
           SendData(iMonCommand.General.SetLines1);
           SendData(iMonCommand.General.SetLines2);
           ClearDisplay();
         }
         else
         {
           SendData(iMonCommand.LCD.ClearDisplay);
           SendData(iMonCommand.LCD.ClearAlarm);
           if (_Contrast)
           {
             Log.Info("iMONLCDg.OpenLcd(): Setting LCD contrast level to {0}", _ContrastLevel);
             SendData(iMonCommand.General.SetContrast, _ContrastLevel);
           }
           SendData(iMonCommand.General.KeypadLightOn);
         }
       }
       else if (_DisplayType == DisplayType.ThreeRsystems)
       {
         SendData(0x2020202020202000L);
         SendData(0x2020202020202002L);
         SendData(0x2020202020202004L);
         SendData(0x2020202020202006L);
         SendData(0x20202020ffffff08L);
         SendData(0x021c020000000000L);
         SendData(0x0000000000000002L);
         SendData(0x0200020000000000L);
         SendData(0x0000000000000002L);
         SendData(0x021b010000000000L);
         SendData(0x0000000000000002L);
       }
     }
     AdvancedSettings.OnSettingsChanged +=
       AdvancedSettings_OnSettingsChanged;
     ForceManagerRestart();
     Log.Info("iMONLCDg.OpenLcd(): completed");
   }
 }
Example #19
0
 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     header[0] = new Phrase(_textHeaderRight, new Font(CustomFont.BaseFontVerdana()));
 }
Example #20
0
 public override void OnOpenDocument(PdfWriter writer, Document document)
 {
     footer[0] = new Phrase(_textFooterLeft, new Font(CustomFont.BaseFontVerdana()));
 }