예제 #1
0
        public void Show()
        {
            DispatcherHelpers.RunOnDispatcher(() =>
            {
                _popup.SetContent(_box);
                _popup.Show();

                _box.PackEnd(_label);
                _box.PackEnd(_entry);
                _box.PackEnd(_button);

                _box.Show();

                _label.Show();
                _entry.Show();
                _button.Show();

                _label.AlignmentX = 0.5;
                _label.AlignmentY = 0.25;
                _label.WeightX    = 1;
                _label.WeightY    = 1;

                _entry.AlignmentX = 0.5;
                _entry.AlignmentY = 0.5;
                _entry.WeightX    = 1;
                _entry.WeightY    = 1;

                _button.AlignmentX = 0.5;
                _button.AlignmentY = 0.65;
                _button.WeightX    = 1;
                _button.WeightY    = 1;
            });
        }
예제 #2
0
        ////////////////////////////////////////////////////////////////////////////////
        //static public RedBoxDialog GetInstance(Action onClick)
        //{
        //    if (_instance == null)
        //    {
        //        _instance = new RedBoxDialog(onClick);
        //    }
        //    return _instance;
        //}


        public void Show()
        {
            DispatcherHelpers.RunOnDispatcher(() =>
            {
                if (redboxTitle != null)
                {
                    _message           = _message.Replace("&", "&");
                    _message           = _message.Replace("<", "&lt;");
                    _message           = _message.Replace(">", "&gt;");
                    string strfontsize = "0";
                    if (_message.Length < 200)
                    {
                        strfontsize = "30";
                    }
                    else if (_message.Length < 400)
                    {
                        strfontsize = "26";
                    }
                    else if (_message.Length < 600)
                    {
                        strfontsize = "22";
                    }
                    else if (_message.Length < 800)
                    {
                        strfontsize = "18";
                    }
                    else
                    {
                        strfontsize = "14";
                    }
                    redboxTitle.Text         = $"<span font_weight=bold font_size={strfontsize} color=#ffffff>" + _message + "</span>";
                    redboxTitle.LineWrapType = WrapType.Mixed;
                    redboxTitle.Show();
                }
                if (reloadBg != null)
                {
                    reloadBg.Show();
                }
                if (reloadBtn != null)
                {
                    reloadBtn.Show();
                }
                if (background != null)
                {
                    background.Show();
                }
                if (scroller != null)
                {
                    scroller.Show();
                }
                if (scrollBox != null)
                {
                    scrollBox.Show();
                }
                if (_stackTrace != null && scrollBox != null)
                {
                    foreach (var item in _stackTrace)
                    {
                        ReactTextView slideLine = new ReactTextView(ReactProgram.RctWindow)
                        {
                            AlignmentX      = -1,
                            AlignmentY      = -1,
                            WeightX         = 1,
                            WeightY         = 1,
                            BackgroundColor = Color.White,
                            MinimumHeight   = 5,
                        };
                        scrollBox.PackEnd(slideLine);
                        if (labelList != null)
                        {
                            labelList.Add(slideLine);
                        }
                        else
                        {
                            RNTracer.Write(ReactConstants.Tag, "Fatal Error in Redbox add slideLine in list, list is null");
                        }

                        ReactTextView colorBox = new ReactTextView(ReactProgram.RctWindow)
                        {
                            AlignmentX      = -1,
                            AlignmentY      = -1,
                            WeightX         = 1,
                            WeightY         = 1,
                            BackgroundColor = Color.Red,
                            MinimumHeight   = 100,
                        };
                        var tempFilename = item.FileName.Replace("&", "&amp;");
                        colorBox.Text    = "<span font_size=30 color=#ffffff>" + item.Method + "</span><span font_size=20 color=#ffffff><br>" + tempFilename + ":" + item.Line + ":" + item.Column + "</span>";
                        scrollBox.PackEnd(colorBox);
                        if (labelList != null)
                        {
                            labelList.Add(colorBox);
                        }
                        else
                        {
                            RNTracer.Write(ReactConstants.Tag, "Fatal Error in Redbox add colorBox in list, list is null");
                        }
                    }
                }

                if (labelList != null)
                {
                    foreach (var item in labelList)
                    {
                        item.Show();
                    }
                }
            });
        }