示例#1
0
        public void CustomInsertTypesRenderAsBlock()
        {
            var            ops      = JArray.Parse(@"[
               {insert: 'hello '},
               { insert: { myblot: 'my friend' } },
               { insert: '!' },
               {insert: {myblot: 'how r u?'}, attributes: {renderAsBlock: true}}
            ]");
            CustomRenderer renderer = (op, contextOp) =>
            {
                var insert = (InsertDataCustom)op.Insert;
                if (insert.CustomType == "myblot")
                {
                    return(op.Attributes.RenderAsBlock == true ?
                           $"<div>{insert.Value}</div>" : insert.Value.ToString());
                }
                return("unknown");
            };
            var qdc = new HtmlConverter(ops,
                                        new HtmlConverterOptions {
                CustomRenderer = renderer
            });
            var html = qdc.Convert();

            html.Should().Be("<p>hello my friend!</p><div>how r u?</div>");
        }
示例#2
0
        public void Bind(TreeView view)
        {
            foreach (CustomRenderer renderer in d_customRenderers)
            {
                CustomRenderer rend = renderer;
                TreeViewColumn col  = view.GetColumn(rend.Column);

                if (col != null)
                {
                    if (col.CellRenderers.Length > rend.Renderer)
                    {
                        col.SetCellDataFunc(col.CellRenderers[rend.Renderer], delegate(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) {
                            Node node = GetFromIter <Node>(iter);
                            rend.Method.Invoke(node, new object[] { cell });
                        });
                    }
                    else
                    {
                        Console.Error.WriteLine("Missing renderer {0}", rend.Renderer);
                    }
                }
                else
                {
                    Console.Error.WriteLine("Missing column {0}", rend.Column);
                }
            }
        }
示例#3
0
        private void ChangeTheme(bool IsChanged, bool IsFirstTime)
        {
            if (IsChanged)
            {
                AnimateWindow(Handle, 150, AnimateWindowFlags.AW_HIDE | AnimateWindowFlags.AW_BLEND);
            }

            using (var CstmRenderer = new CustomRenderer(IsDarkMode))
            {
                MenuStrip1.Renderer   = CstmRenderer;
                StatusStrip1.Renderer = CstmRenderer;
                ToolStrip1.Renderer   = CstmRenderer;
                if (!IsFirstTime)
                {
                    PuzzleGame.IsDarkMode = IsDarkMode;
                }

                BackColor = IsDarkMode ? Color.FromArgb(48, 48, 48) : Color.FromArgb(238, 238, 242);
            }

            if (IsChanged)
            {
                Show();
            }
        }
        public Form1()
        {
            InitializeComponent();



            //TODO Radial Guage

            RadialGauge radialGauge1 = new RadialGauge();

            this.radialGauge1.MinorDifference = 5;
            this.Controls.Add(radialGauge1);
            this.radialGauge1.VisualStyle           = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Black;
            this.radialGauge1.MajorDifference       = 10F;
            this.radialGauge1.MaximumValue          = 150F;
            this.radialGauge1.MinimumValue          = 0F;
            this.radialGauge1.MinorDifference       = 30F;
            this.radialGauge1.LabelPlacement        = Syncfusion.Windows.Forms.Gauge.LabelPlacement.Outside;
            this.radialGauge1.TextOrientation       = Syncfusion.Windows.Forms.Gauge.TextOrientation.SlideOver;
            this.radialGauge1.TickPlacement         = Syncfusion.Windows.Forms.Gauge.TickPlacement.OutSide;
            this.radialGauge1.MajorTickMarkColor    = System.Drawing.Color.LightYellow;
            this.radialGauge1.MinorTickMarkColor    = System.Drawing.Color.Red;
            this.radialGauge1.GaugeArcColor         = ColorTranslator.FromHtml("#00a0d1");
            this.radialGauge1.GaugeLableColor       = ColorTranslator.FromHtml("#00a0d1");
            this.radialGauge1.InterLinesColor       = System.Drawing.Color.Red;
            this.radialGauge1.MinorTickMarkHeight   = 55;
            this.radialGauge1.MajorTickMarkHeight   = 6;
            this.radialGauge1.MinorInnerLinesHeight = 60;

            CustomRenderer custom1 = new CustomRenderer(this.linearGauge1);

            linearGauge1.Renderer = custom1;
        }
示例#5
0
        /// <nodoc />
        public Renderer(LoggingContext loggingContext, PathTable pathTable, CustomRenderer customRenderer)
        {
            Contract.Requires(pathTable.IsValid);

            m_loggingContext = loggingContext;
            m_customRenderer = customRenderer;
            PathTable        = pathTable;
        }
        public GameManager()
        {
            graphics = new GraphicsDeviceManager(this);
            GameSetting.InitSetting(graphics);
            Content.RootDirectory = "Content";

            renderer = new CustomRenderer
            {
                GraphicsDeviceService = graphics
            };

            sceneManager = new SceneManager(this);
            Components.Add(sceneManager);
        }
示例#7
0
        public override void Init()
        {
            base.Init();

            var ambientObjectType = GetObjectType();

            if (ambientObjectType.CustomControllerScript != null)
            {
                CustomController = (GameObjectController)SerializationUtils.CreateInstance(ambientObjectType.CustomControllerScript);
            }

            if (ambientObjectType.CustomRendererScript != null)
            {
                CustomRenderer = (GameObjectRenderer)SerializationUtils.CreateInstance(ambientObjectType.CustomRendererScript);
            }

            CustomController?.Init(this);
            CustomRenderer?.Init(this);
        }
示例#8
0
        private void PuzzleGame_GameState(bool _isWin)
        {
            if (_isWin)
            {
                using (FrmWin frm = new FrmWin())
                {
                    frm.Owner = this;
                    using (CustomRenderer CstmRenderer = new CustomRenderer(IsDarkMode))
                    {
                        frm.ToolStrip1.Renderer = CstmRenderer;
                    }

                    frm.LblScore.Text = "Your " + LblScore.Text;
                    frm.LblMode.Text  = PuzzleMode ? "Start New Game With New Image?" : "Start New Game?";
                    frm.LblTitle.Text = LblTitle.Text;
                    frm.ShowDialog();
                }
            }
        }
示例#9
0
        public override void Init()
        {
            relativeBlockingBounds = MetaData.AmbientHitableObjectType.lookup[((AmbientHitableObject)this).AmbientHitableObjectType].RelativeBlockingRectangle;
            relativeHitBoxBounds   = MetaData.AmbientHitableObjectType.lookup[((AmbientHitableObject)this).AmbientHitableObjectType].RelativeHitboxRectangle;

            base.Init();

            var ambientHitableObjectType = GetObjectType();

            if (ambientHitableObjectType.CustomControllerScript != null)
            {
                CustomController = (GameObjectController)SerializationUtils.CreateInstance(ambientHitableObjectType.CustomControllerScript);
            }

            if (ambientHitableObjectType.CustomRendererScript != null)
            {
                CustomRenderer = (GameObjectRenderer)SerializationUtils.CreateInstance(ambientHitableObjectType.CustomRendererScript);
            }

            CustomController?.Init(this);
            CustomRenderer?.Init(this);
        }
示例#10
0
        public Form1()
        {
            InitializeComponent();
            UserInitialization();
            QProcessorThread   = new Thread(new ThreadStart(RXProcessor));
            SerialReaderThread = new Thread(new ThreadStart(SerialReader));
            SerialReaderThread.Start();
            QProcessorThread.Start();
            Debug.WriteLine("-------------------------THREAD-RXProcessor-SerialReader Başlatıldı.--------------------------------------------");
            Debug.WriteLine("-------------------------TURKMEKATRONİK.--------------------------------------------");

            //TODO Radial Guage
            RadialGauge radialGauge1 = new RadialGauge();

            this.radialGauge1.MinorDifference = 5;
            this.Controls.Add(radialGauge1);
            this.radialGauge1.VisualStyle           = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Black;
            this.radialGauge1.MajorDifference       = 10F;
            this.radialGauge1.MaximumValue          = 150F;
            this.radialGauge1.MinimumValue          = 0F;
            this.radialGauge1.MinorDifference       = 30F;
            this.radialGauge1.LabelPlacement        = Syncfusion.Windows.Forms.Gauge.LabelPlacement.Outside;
            this.radialGauge1.TextOrientation       = Syncfusion.Windows.Forms.Gauge.TextOrientation.SlideOver;
            this.radialGauge1.TickPlacement         = Syncfusion.Windows.Forms.Gauge.TickPlacement.OutSide;
            this.radialGauge1.MajorTickMarkColor    = System.Drawing.Color.LightYellow;
            this.radialGauge1.MinorTickMarkColor    = System.Drawing.Color.Red;
            this.radialGauge1.GaugeArcColor         = ColorTranslator.FromHtml("#00a0d1");
            this.radialGauge1.GaugeLableColor       = ColorTranslator.FromHtml("#00a0d1");
            this.radialGauge1.InterLinesColor       = System.Drawing.Color.Red;
            this.radialGauge1.MinorTickMarkHeight   = 55;
            this.radialGauge1.MajorTickMarkHeight   = 6;
            this.radialGauge1.MinorInnerLinesHeight = 60;
            this.radialGauge1.BackColor             = Color.Transparent;
            CustomRenderer custom1 = new CustomRenderer(this.linearGauge1);

            linearGauge1.Renderer = custom1;
            labelError.Text      += "Araç Bağlantısı Bekleniyor-TM";
        }
示例#11
0
        public void CustomBlotUsesGivenRenderer()
        {
            var            ops      = JArray.Parse(@"[
                { insert: { bolditalic: 'my text' } },
                { insert: { blah: 1 } }
             ]");
            CustomRenderer renderer = (op, contextOp) =>
            {
                var insert = (InsertDataCustom)op.Insert;
                if (insert.CustomType == "bolditalic")
                {
                    return($"<b><i>{insert.Value}</i></b>");
                }
                return("unknown");
            };
            var qdc = new HtmlConverter(ops,
                                        new HtmlConverterOptions {
                CustomRenderer = renderer
            });
            var html = qdc.Convert();

            html.Should().Be("<p><b><i>my text</i></b>unknown</p>");
        }
示例#12
0
        protected void Application_Start(IHostingEnvironment env)
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);

            var logGroupName = "Logger/" + env.EnvironmentName;

            // customer renderer (optional, defaults to a simple rendered message of Serilog's LogEvent
            var renderer = new CustomRenderer();

            // options for the sink, specifying the log group name
            var options = new CloudWatchSinkOptions {
                LogGroupName = logGroupName, LogEventRenderer = renderer
            };

            // setup AWS CloudWatch client
            var credentials = new BasicAWSCredentials(myAwsAccessKey, myAwsSecretKey);
            var client      = new AmazonCloudWatchLogsClient(credentials, myAwsRegion);

            // Attach the sink to the logger configuration
            Log.Logger = new LoggerConfiguration().MinimumLevel.Information()
                         .WriteTo.AmazonCloudWatch(options, client)
                         .CreateLogger();
        }
示例#13
0
        public override void Init()
        {
            relativeBlockingBounds = MetaData.LivingEntityType.lookup[((LivingEntity)this).LivingEntityType].RelativeBlockingBounds;
            relativeHitBoxBounds   = MetaData.LivingEntityType.lookup[((LivingEntity)this).LivingEntityType].RelativeHitBoxBounds;

            base.Init();

            // Init skills
            var livingEntityType = GetObjectType();

            Skills = new Skill[livingEntityType.Skills == null ? 0 : livingEntityType.Skills.Length];

            if (livingEntityType.Skills != null)
            {
                for (int i = 0; i < livingEntityType.Skills.Length; i++)
                {
                    Skills[i] = SkillType.Create(this, livingEntityType.Skills[i]);
                }
            }

            // Init
            if (livingEntityType.CustomControllerScript != null)
            {
                CustomController = (GameObjectController)SerializationUtils.CreateInstance(livingEntityType.CustomControllerScript);
            }

            if (livingEntityType.CustomRendererScript != null)
            {
                CustomRenderer = (GameObjectRenderer)SerializationUtils.CreateInstance(livingEntityType.CustomRendererScript);
            }

            CustomController?.Init(this);
            CustomRenderer?.Init(this);

            SimulationGame.World.LivingEntities[ID] = this;
        }
示例#14
0
文件: Program.cs 项目: forki/Labs
        static void Main(string[] args)
        {
#if _DEBUG
            args = "Common.Controllers.dll -t Controller".Split(' ');
            //args = "WebApi.Example.Controllers.ProductsController.xml -r xslt -x iodocuments.xslt -o json".Split(' ');
            //args = "WebApi.Example.Controllers.ProductsController.xml -r xslt -x apitester.xslt -o xml".Split(' ');
            //args = "Common.Controllers.dll -r ctorxml -t Controller".Split(' ');
#endif
            if (null == args || !args.Any())
            {
                DisplayUsage();
                return;
            }

            var options = ParseCommandLine(string.Join(" ", args));

            if (!options.Any() || !(options.ContainsKey("file") || options.ContainsKey("path")) ||
                (options.ContainsKey("file") && !Parser.IsFile(options["file"])) ||
                (options.ContainsKey("path") && !Parser.IsPath(options["path"])) ||
                (options["render"] == "xslt" &&
                 options.ContainsKey("xsltfile") && !Parser.IsFile(options["xsltfile"]))
                )
            {
                DisplayUsage();
                return;
            }

            IRenderable renderer = null;
            switch (options["render"])
            {
            case "text":
                renderer = new CustomRenderer(
                    options.ContainsKey("file") ? options["file"] : options["path"],
                    options.ContainsKey("includeflag")
                    );
                break;

            case "xslt":
                renderer = new XsltRenderer(
                    options["xsltfile"],
                    options.ContainsKey("outext") ? options["outext"] : "json",
                    options.ContainsKey("file") ? options["file"] : options["path"],
                    options.ContainsKey("includeflag")
                    );
                break;

            case "ctorxml":
                renderer = new XmlCtorRenderer(
                    options.ContainsKey("file") ? options["file"] : options["path"],
                    options.ContainsKey("includeflag")
                    );
                break;

            case "text2xml":
                renderer = new Text2XmlRenderer(options["file"]);
                break;

            default:
                renderer = new XmlRenderer(
                    options.ContainsKey("file") ? options["file"] : options["path"],
                    options.ContainsKey("includeflag")
                    );
                break;
            }

            var parser = new Parser(renderer);
            System.Console.WriteLine("Rendering as " + options["render"] + "..." + Environment.NewLine);
            System.Console.WriteLine(parser.Render(
                                         options.ContainsKey("types") ? options["types"].Split(',') : null,
                                         options.ContainsKey("methods") ? options["methods"].Split(','): null
                                         ));
        }
示例#15
0
        public Form1()
        {
            InitializeComponent();
            UserInitialization();

            //batteryLevels[0] = lblBattLevel1;
            //batteryLevels[1] = lblBattLevel2;
            //batteryLevels[2] = lblBattLevel3;
            //batteryLevels[3] = lblBattLevel4;
            //batteryLevels[4] = lblBattLevel5;
            //batteryLevels[5] = lblBattLevel6;
            //batteryLevels[6] = lblBattLevel7;
            //batteryLevels[7] = lblBattLevel8;
            //batteryLevels[8] = lblBattLevel9;
            //batteryLevels[9] = lblBattLevel10;
            //batteryLevels[10] = lblBattLevel11;
            //batteryLevels[11] = lblBattLevel12;
            //batteryLevels[12] = lblBattLevel13;
            //batteryLevels[13] = lblBattLevel14;
            //batteryLevels[14] = lblBattLevel15;
            //batteryLevels[15] = lblBattLevel16;
            //batteryLevels[16] = lblBattLevel17;
            //batteryLevels[17] = lblBattLevel18;
            //batteryLevels[18] = lblBattLevel19;
            //batteryLevels[19] = lblBattLevel20;
            //batteryLevels[20] = lblBattLevel21;
            //batteryLevels[21] = lblBattLevel22;
            //batteryLevels[22] = lblBattLevel23;
            //batteryLevels[23] = lblBattLevel24;
            //batteryTemps[0] = lblBattTemp1;
            //batteryTemps[1] = lblBattTemp2;
            //batteryTemps[2] = lblBattTemp3;
            //batteryTemps[3] = lblBattTemp4;
            //batteryTemps[4] = lblBattTemp5;
            //batteryTemps[5] = lblBattTemp6;
            //batteryTemps[6] = lblBattTemp7;
            //batteryTemps[7] = lblBattTemp8;
            //batteryTemps[8] = lblBattTemp9;
            //batteryTemps[9] = lblBattTemp10;
            //batteryTemps[10] = lblBattTemp11;
            //batteryTemps[11] = lblBattTemp12;
            //batteryTemps[12] = lblBattTemp13;
            //batteryTemps[13] = lblBattTemp14;
            //batteryTemps[14] = lblBattTemp15;
            //batteryTemps[15] = lblBattTemp16;
            //batteryTemps[16] = lblBattTemp17;
            //batteryTemps[17] = lblBattTemp18;
            //batteryTemps[18] = lblBattTemp19;
            //batteryTemps[19] = lblBattTemp20;
            //batteryTemps[20] = lblBattTemp21;
            //batteryTemps[21] = lblBattTemp22;
            //batteryTemps[22] = lblBattTemp23;
            //batteryTemps[23] = lblBattTemp24;



            //TODO Radial Guage
            RadialGauge radialGauge1 = new RadialGauge();

            this.radialGauge1.MinorDifference = 5;
            this.Controls.Add(radialGauge1);
            this.radialGauge1.VisualStyle           = Syncfusion.Windows.Forms.Gauge.ThemeStyle.Black;
            this.radialGauge1.MajorDifference       = 10F;
            this.radialGauge1.MaximumValue          = 150F;
            this.radialGauge1.MinimumValue          = 0F;
            this.radialGauge1.MinorDifference       = 30F;
            this.radialGauge1.LabelPlacement        = Syncfusion.Windows.Forms.Gauge.LabelPlacement.Outside;
            this.radialGauge1.TextOrientation       = Syncfusion.Windows.Forms.Gauge.TextOrientation.SlideOver;
            this.radialGauge1.TickPlacement         = Syncfusion.Windows.Forms.Gauge.TickPlacement.OutSide;
            this.radialGauge1.MajorTickMarkColor    = System.Drawing.Color.LightYellow;
            this.radialGauge1.MinorTickMarkColor    = System.Drawing.Color.Red;
            this.radialGauge1.GaugeArcColor         = ColorTranslator.FromHtml("#00a0d1");
            this.radialGauge1.GaugeLableColor       = ColorTranslator.FromHtml("#00a0d1");
            this.radialGauge1.InterLinesColor       = System.Drawing.Color.Red;
            this.radialGauge1.MinorTickMarkHeight   = 55;
            this.radialGauge1.MajorTickMarkHeight   = 6;
            this.radialGauge1.MinorInnerLinesHeight = 60;
            this.radialGauge1.BackColor             = Color.Transparent;
            CustomRenderer custom1 = new CustomRenderer(this.linearGauge1);

            linearGauge1.Renderer = custom1;
        }
示例#16
0
        public void Start(string szURL, IInternetProtocolSink sink, IInternetBindInfo pOIBindInfo, uint grfPI, uint dwReserved)
        {
            //Debug.WriteLine("xxHelpAsyncPluggableProtocolHandler.Start(" + szURL + ")");

            String mimeType = "text/html";

            // type = "text" / "image" / "audio" / "video" / "application" / extension-token
            //type/subtype eg. "text/html", "image/png", "image/gif", "video/mpeg", "text/css", and "audio/basic"

            if (MsxhelpProtocol.Catalog == null || !MsxhelpProtocol.Catalog.IsOpen)
            {
                _stream = null;
            }
            else
            {
                try
                {
                    if (_customRenderer == null)
                    {
                        _customRenderer = CustomRenderer.Create();
                    }

                    String  topicID;
                    Boolean isTopicUrl = _customRenderer.IsTopicUrl(szURL, out topicID);

                    // -----------------------------------------------------------------------
                    // debug - Host wants to see raw HTML from .mshc

                    if (MsxhelpProtocol.RawCodeHandler != null)
                    {
                        try
                        {
                            if (isTopicUrl && String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText)) // Topic with no text overload
                            {
                                _stream = _customRenderer.UrlToStream(szURL, false);               // false = No Render.
                                if (this._stream != null)
                                {
                                    _stream.Position = 0;
                                    StreamReader reader = new StreamReader(_stream);
                                    String       text   = reader.ReadToEnd();
                                    MsxhelpProtocol.RawCodeHandler(text);    //send text to main form
                                    this._stream.Close();
                                    this._stream = null;
                                }
                            }
                        }
                        catch
                        {
                            //suck it up.. the next bit is the important part
                        }
                    }

                    // -----------------------------------------------------------------------
                    // render - Web browser wants rendered code

//                    if (MsxhelpProtocol.RenderUsingVS)  // Requires VS 11 DLL (Microsoft.VisualStudio.Help.DLL)
//                    {
//                        if (_vsRenderer == null)                      //will crash if VS not installed
//                            _vsRenderer = new TopicRenderer();

                    //                       _stream = (Stream)_vsRenderer.ProcessLink(szURL, (ICatalog)MsxhelpProtocol.Catalog, null/*_renderParameters*/);
//                    }
//                    else  // basic render code supplied with this SDK -- Good for Win 8 where VS 11 not installed
                    {
                        _stream          = _customRenderer.UrlToStream(szURL);
                        _stream.Position = 0;
                    }
                }
                catch
                {
                    _stream = null;
                }
            }

            if (_stream != null)
            {
                //Set Mime type
                uint BINDSTATUS_MIMETYPEAVAILABLE = 13;
                if (mimeType != "")
                {
                    sink.ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, mimeType);
                }

                sink.ReportData(BSCF.LASTDATANOTIFICATION | BSCF.DATAFULLYAVAILABLE, (uint)_stream.Length, (uint)_stream.Length);
                sink.ReportResult((uint)HRESULT.S_OK, 200, null);
            }
            else
            {
                sink.ReportResult((uint)HRESULT.INET_E_OBJECT_NOT_FOUND, 404, "Cannot find the goods");
            }
        }
        public void ToolStripTest()
        {
            var stripSystem = new ContextMenuStrip();
            stripSystem.RenderMode = ToolStripRenderMode.System;

            var stripProfessional = new ContextMenuStrip();
            stripProfessional.RenderMode = ToolStripRenderMode.Professional;

            var stripManager = new ContextMenuStrip();
            stripManager.RenderMode = ToolStripRenderMode.ManagerRenderMode;

            var renderder = new CustomRenderer();
            var stripCustom = new ContextMenuStrip();
            stripCustom.Renderer = renderder;

            Assert.AreEqual(ToolStripRenderMode.System, stripSystem.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.Professional, stripProfessional.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.ManagerRenderMode, stripManager.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.Custom, stripCustom.RenderMode);
            Assert.AreEqual(renderder, stripCustom.Renderer);

            var theme = new VS2012BlueTheme();
            theme.ApplyTo(stripManager);
            theme.ApplyTo(stripProfessional);
            theme.ApplyTo(stripSystem);
            theme.ApplyTo(stripCustom);

            Assert.AreEqual(ToolStripRenderMode.Custom, stripSystem.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.Custom, stripProfessional.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.Custom, stripManager.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.Custom, stripCustom.RenderMode);

            theme.CleanUp(null);
            Assert.AreEqual(ToolStripRenderMode.System, stripSystem.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.Professional, stripProfessional.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.ManagerRenderMode, stripManager.RenderMode);
            Assert.AreEqual(ToolStripRenderMode.Custom, stripCustom.RenderMode);
            Assert.AreEqual(renderder, stripCustom.Renderer);
        }