示例#1
0
 public static void Main()
 {
     FleuxSettings.InertiaMode        = FleuxSettings.InertiaModeOptions.Physics2x;
     FleuxSettings.HapticFeedbackMode = FleuxSettings.HapticOptions.Tap;
     FleuxApplication.TargetDesignDpi = 192; // Default HTC HD2 Res!
     FleuxApplication.Run(new SplashScreen());
 }
示例#2
0
        protected virtual void CreateGraphicBuffers()
        {
            if (this.offBmp != null)
            {
                this.ReleaseGraphicBuffers();
            }

            this.controlGr = CreateGraphics();

            if (Height > 0 && Width > 0)
            {
                if (this.offBmp == null)
                {
                    if (this.controlGr == null)
                    {
                        this.controlGr = CreateGraphics();
                    }

                    this.offBmp = new Bitmap(Width, Height);
                    this.offGr  = Graphics.FromImage(this.offBmp);
                    FleuxApplication.ApplyGraphicsSettings(this.offGr);
                    this.offUpdated = false;
                }
            }
        }
示例#3
0
        public ClipBuffer GetOpaqueClipBuffer(Rectangle region, Bitmap bitmap)
        {
            var gr         = Graphics.FromImage(bitmap);
            var realRegion = this.CalculateRect(region);

            gr.DrawImage(this.canvasImage, 0, 0, realRegion, GraphicsUnit.Pixel);
            FleuxApplication.ApplyGraphicsSettings(gr);
            return(new ClipBuffer(bitmap, gr, realRegion, this.Graphics));
        }
示例#4
0
        public ClipBuffer GetClipBuffer(Rectangle region, Bitmap bitmap)
        {
            var gr         = Graphics.FromImage(bitmap);
            var realRegion = this.CalculateRect(region);

#if WINCE || WIN32
            gr.DrawImage(this.canvasImage, 0, 0, realRegion, GraphicsUnit.Pixel);
#else
            gr.Clear(System.Drawing.Color.Transparent); // win32 gdi draws text badly on transparent images ;(
#endif
            FleuxApplication.ApplyGraphicsSettings(gr);
            return(new ClipBuffer(bitmap, gr, realRegion, this.Graphics));
        }
示例#5
0
        public IDrawingGraphics DrawText(string text)
        {
            this.Graphics.DrawString(text,
                                     this.state.CurrenFont,
                                     this.state.CurrentBrush,
                                     this.CalculateX(this.state.CurrentX),
                                     this.CalculateY(this.state.CurrentY));
            var measure = this.Graphics.MeasureString(text, this.state.CurrenFont);

            this.state.CurrentX += FleuxApplication.ScaleToLogic((int)measure.Width);
            this.ValidateExtends(this.CalculateX(this.state.CurrentX), this.CalculateY(this.state.CurrentY) + (int)measure.Height);
            return(this);
        }
示例#6
0
        public static void Run(string homepage)
        {
            while (ReloadUI)
            {
                try{
                    ReloadUI = false;
                    Thread main = new Thread(() => {
                        try{
                            FleuxPage home = (FleuxPage)Assembly.GetExecutingAssembly().CreateInstance(homepage);
                            FleuxApplication.Run(home);
                            home.Dispose();
                        }catch (Exception e) {
                            Logger.error("HOBD", "fatal UI thread failure, exiting", e);
                        }
                    });
                    main.Start();
                    main.Join();
                }catch (Exception e) {
                    Logger.error("HOBD", "fatal failure, exiting", e);
                    if (engine != null && engine.IsActive())
                    {
                        engine.Deactivate();
                    }
                }
            }

            if (engine != null)
            {
                engine.Deactivate();
            }
            if (Registry != null)
            {
                Registry.Deactivate();
            }
            config.Save();
            Logger.info("HOBD", "app exit");

#if !WINCE
            // hanged threads?
            Environment.Exit(0);
#endif
        }
示例#7
0
 public IDrawingGraphics PenWidth(int width)
 {
     this.state.PenWidth = FleuxApplication.ScaleFromLogic(width);
     return(this);
 }
示例#8
0
        static void Main()
        {
            FleuxApplication.TargetDesignDpi = 192; // Default HTC HD2 Res!

            FleuxApplication.Run(new SplashScreen());
        }
示例#9
0
 public static int ToPixels(this int logic)
 {
     return(FleuxApplication.ScaleFromLogic(logic));
 }
示例#10
0
 public static int ToLogic(this int scaled)
 {
     return(FleuxApplication.ScaleToLogic(scaled));
 }