Esempio n. 1
0
 private void LoadDemo(string name)
 {
     IsMouseVisible = true;
     _currentDemo?.Unload();
     _currentDemo = _demos[name];
     _currentDemo.Load();
 }
Esempio n. 2
0
        void lstDemoList_DoubleClick(object sender, EventArgs e)
        {
            //load demo sample
            var selectedDemoInfo = this.lstDemoList.SelectedItem as DemoInfo;

            if (selectedDemoInfo == null)
            {
                return;
            }
            //------------------------------------------------------------
            DemoBase selectedDemo = (DemoBase)Activator.CreateInstance(selectedDemoInfo.DemoType);

            RunDemo(selectedDemo);
            //------------------------------------------------------------
            //LayoutFarm.UI.UISurfaceViewportControl viewport;
            //Form formCanvas;
            //CreateReadyForm(
            //    out viewport,
            //    out formCanvas);

            //selectedDemo.StartDemo(new SampleViewport(viewport));
            //viewport.TopDownRecalculateContent();
            ////==================================================
            //viewport.PaintMe();
            //ShowFormLayoutInspector(viewport);
        }
Esempio n. 3
0
        void RunSelectedDemo()
        {
            //load demo sample
            DemoInfo selectedDemoInfo = this.lstDemoList.SelectedItem as DemoInfo;

            if (selectedDemoInfo == null)
            {
                return;
            }
            //------------------------------------------------------------
            if (selectedDemoInfo.demoBaseTypeKind == 1)
            {
                DemoBase2 selectedDemo = (DemoBase2)Activator.CreateInstance(selectedDemoInfo.DemoType);
                RunDemo(selectedDemo);
            }
            else
            {
                DemoBase selectedDemo = (DemoBase)Activator.CreateInstance(selectedDemoInfo.DemoType);
                RunDemo(selectedDemo);
            }

            //------------------------------------------------------------
            //LayoutFarm.UI.UISurfaceViewportControl viewport;
            //Form formCanvas;
            //CreateReadyForm(
            //    out viewport,
            //    out formCanvas);

            //selectedDemo.StartDemo(new SampleViewport(viewport));
            //viewport.TopDownRecalculateContent();
            ////==================================================
            //viewport.PaintMe();
            //ShowFormLayoutInspector(viewport);
        }
Esempio n. 4
0
            public MyClass(DemoBase demoBase)
            {
                _demoBase = demoBase;
                Timer timer = new Timer(HandleTick);

                timer.Change(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2));
            }
Esempio n. 5
0
        static ImageBinder LoadImage(string filename)
        {
            ImageBinder binder = new ClientImageBinder(filename);

            binder.SetImage(DemoBase.LoadBitmap(filename));
            binder.State = ImageBinderState.Loaded;
            return(binder);
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            IApplicationContext ctx   = ContextRegistry.GetContext();
            DemoBase            demo  = (DemoBase)ctx.GetObject("DemoBase");
            IDemoBase           idemo = (IDemoBase)ctx.GetObject("DemoBase");

            Console.WriteLine($"{demo.EasyReturn()}\n{idemo.EasyReturn()}");
        }
            public MyClass(DemoBase demoBase)
            {
                _demoBase = demoBase;
                Timer timer = new Timer(HandleTick);

                timer.Change(TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(2));
                //System.Timers.Timer timer2 = new System.Timers.Timer();
                //timer2.Interval = 2000;
                //timer2.Elapsed += (s, e) => HandleTick(null);
                //timer2.Start();
            }
Esempio n. 8
0
        public SampleContentManager(DemoBase serviceDemo)
        {
            this.serviceDemo        = serviceDemo;
            createdObjectIdentities = new ObjectIdentitySet();
            ServiceFactory serviceFactory = ServiceFactory.Instance;

            objectService =
                serviceFactory.GetRemoteService <IObjectService>(serviceDemo.DemoServiceContext);
            aclService = serviceFactory.GetRemoteService <IAccessControlService>(serviceDemo.DemoServiceContext);
            setSampleFolderRelationship();
        }
Esempio n. 9
0
        void contentMx_ImageLoadingRequest(object sender, LayoutFarm.ContentManagers.ImageRequestEventArgs e)
        {
            //load resource -- sync or async?
            string absolutePath = documentRootPath + "\\" + e.ImagSource;

            if (!System.IO.File.Exists(absolutePath))
            {
                return;
            }
            //load
            e.SetResultImage(DemoBase.LoadBitmap(absolutePath));
        }
Esempio n. 10
0
        public void LoadExample(ExampleAndDesc exAndDesc)
        {
            DemoBase exBase = Activator.CreateInstance(exAndDesc.Type) as DemoBase;

            if (exBase == null)
            {
                return;
            }

            this.Text = exAndDesc.ToString();
            //----------------------------------------------------------------------------
            this.exampleBase = exBase;
            exampleBase.Init();
        }
Esempio n. 11
0
        public void Back()
        {
            if (_selectDemoScreen.IsVisible)
            {
                Exit();
            }

            IsMouseVisible = true;
            _currentDemo?.Unload();
            _currentDemo?.Dispose();
            _currentDemo = null;
            _selectDemoScreen.IsVisible = true;
            _guiSystem.ActiveScreen     = _selectDemoScreen;
        }
Esempio n. 12
0
        public void CreateMainForm()
        {
            int           w = 800, h = 600;
            GlFwForm      form1          = new GlFwForm(w, h, "PixelFarm on GLfw and GLES2");
            MyRootGraphic myRootGfx      = new MyRootGraphic(w, h, s_textServices);
            var           canvasViewport = new UISurfaceViewportControl();

            canvasViewport.InitRootGraphics(myRootGfx, myRootGfx.TopWinEventPortal, InnerViewportKind.GLES);
            canvasViewport.SetBounds(0, 0, w, h);
            form1.Controls.Add(canvasViewport);


            //demoContext2.LoadDemo(new T45_TextureWrap());
            //demoContext2.LoadDemo(new T48_MultiTexture());
            //demoContext2.LoadDemo(new T107_1_DrawImages());
            _demoBase = new OpenTkEssTest.T108_LionFill();//new T45_TextureWrap(),T48_MultiTexture()
            //_demoBase = new T110_DrawText();
            //_demoBase = new T107_1_DrawImages();

            _demoContext = new GLDemoContext(w, h);
            _demoContext.SetTextPrinter(painter =>
            {
                var printer         = new PixelFarm.DrawingGL.GLBitmapGlyphTextPrinter(painter, s_textServices);
                painter.TextPrinter = printer;
                //create text printer for opengl
                //----------------------
                //1. win gdi based
                //var printer = new WinGdiFontPrinter(canvas2d, w, h);
                //canvasPainter.TextPrinter = printer;
                //----------------------
                //2. raw vxs
                //var printer = new PixelFarm.Drawing.Fonts.VxsTextPrinter(canvasPainter);
                //canvasPainter.TextPrinter = printer;
                //----------------------
                //3. agg texture based font texture
                //var printer = new AggFontPrinter(canvasPainter, w, h);
                //canvasPainter.TextPrinter = printer;
                //----------------------
                //4. texture atlas based font texture
                //------------
                //resolve request font
                //var printer = new GLBmpGlyphTextPrinter(canvasPainter, YourImplementation.BootStrapWinGdi.myFontLoader);
                //canvasPainter.TextPrinter = printer;
            });


            form1.SetDrawFrameDelegate(e => _demoContext.Render());
            _demoContext.LoadDemo(_demoBase);
        }
Esempio n. 13
0
        public void RunDemo(DemoBase selectedDemo)
        {
            YourImplementation.DemoFormCreatorHelper.CreateReadyForm(out _latestviewport, out _latest_formCanvas);

            selectedDemo.StartDemo(new SampleViewport(_latestviewport));
            _latestviewport.TopDownRecalculateContent();
            //==================================================
            _latestviewport.PaintMe();

            if (this.chkShowLayoutInspector.Checked)
            {
                ShowFormLayoutInspector(_latestviewport);
            }

            if (this.chkShowFormPrint.Checked)
            {
                ShowFormPrint(_latestviewport);
            }
        }
        public override DemoBase Create(string demo)
        {
            int      demoIndex;
            DemoBase demoToRun = null;

            if (int.TryParse(demo, out demoIndex))
            {
                demoToRun = Demoes.ElementAtOrDefault(demoIndex - 1);
            }

            if (demoToRun == null)
            {
                Console.Write("Type not found please enter another type: ");
                return(Create(Console.ReadLine()));
            }
            else
            {
                return(demoToRun);
            }
        }
Esempio n. 15
0
        public void RunDemo(DemoBase selectedDemo)
        {
            Form formCanvas;

            CreateReadyForm(out viewport, out formCanvas);

            selectedDemo.StartDemo(new SampleViewport(viewport));
            viewport.TopDownRecalculateContent();
            //==================================================
            viewport.PaintMe();

            if (this.chkShowLayoutInspector.Checked)
            {
                ShowFormLayoutInspector(viewport);
            }

            if (this.chkShowFormPrint.Checked)
            {
                ShowFormPrint(viewport);
            }
        }
Esempio n. 16
0
        public void RunDemo(DemoBase selectedDemo)
        {
            LayoutFarm.UI.UISurfaceViewportControl viewport;

            Form formCanvas;
            CreateReadyForm(out viewport, out formCanvas);

            selectedDemo.StartDemo(new SampleViewport(viewport));
            viewport.TopDownRecalculateContent();
            //==================================================  
            viewport.PaintMe();

            if (this.chkShowLayoutInspector.Checked)
            {
                ShowFormLayoutInspector(viewport);
            }

            if (this.chkShowFormPrint.Checked)
            {
                ShowFormPrint(viewport);
            }

        }
Esempio n. 17
0
        public BounceBall(int width, int height, bool linear)
        {
            x = DemoBase.Rand.Next(width);
            y = DemoBase.Rand.Next(height);
            if (linear)
            {
                vx = DemoBase.Rand.Next(2) * 2 - 1;
                vy = DemoBase.Rand.Next(2) * 2 - 1;
            }
            else
            {
                vx = DemoBase.Rand.NextDouble() * 2 - 1;
            }

            double rd, gd, bd;
            var    h = DemoBase.Rand.NextDouble();

            DemoBase.HslToRgb(h, 0.5, 0.5, out rd, out gd, out bd);

            r = (int)(rd * 255.0);
            g = (int)(gd * 255.0);
            b = (int)(bd * 255.0);
        }
Esempio n. 18
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(DemoBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_DemoMethod, serviceImpl.DemoMethod).Build());
 }
Esempio n. 19
0
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, DemoBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_DemoMethod, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Simon.GrpcService.GrpcService.RequestParam, global::Simon.GrpcService.GrpcService.ResponseModel>(serviceImpl.DemoMethod));
 }
Esempio n. 20
0
 private void LoadDemo(DemoBase demo)
 {
     _loadDemo(demo.Name);
     Hide();
 }