Exemple #1
0
        protected virtual void CreatePortSection()
        {
            var section = new ConfigurationSection(layoutX, layoutY - SectionContentDelta)
            {
                ChoosePortAction = () => {
                    panorama.CurrentSectionIndex -= 1;
                    HOBD.config.Save();
                    HOBD.EngineConnect();
                    HOBD.engine.Activate();
                }
            };

            panorama.AddSection(section);
            this.volatileSection          = section;
            panorama.CurrentSectionIndex += 1;
        }
Exemple #2
0
        protected virtual void InitializePanorama()
        {
            panorama = new PanoramaElement();
            panorama.Sections.Location = new Point(0, 0);
            panorama.Sections.Size     = new Size(layoutX, layoutY - SectionContentDelta);

            Fleux.Controls.Gestures.GestureDetectionParameters.Current.TapTimePeriod = 150;
            Fleux.Controls.Gestures.GestureDetectionParameters.Current.TapDistance   = 50;

/*
 *          panorama.SectionTitleDelta = 0;
 *          panorama.SectionContentDelta = 40;
 *          panorama.TitleWidth = 400;
 *          panorama.SectionsPadding = 30;
 *
 *
 *          panorama.DrawTitleAction = gr =>
 *             {   gr
 *                 .Style(HOBD.theme.PhoneTextPanoramaTitleStyle)
 *                 .MoveX(0).MoveY(0).DrawText(Title)
 *                 .Style(HOBD.theme.PhoneTextPanoramaSubTitleStyle)
 *                 .DrawText("v"+HOBDBuild.Version);
 *                 if (panorama.TitleWidth == 0)
 *                 {
 *                     panorama.TitleWidth = FleuxApplication.ScaleFromLogic(gr.Right);
 *                 }
 *             };
 */
            Bitmap original;

            if (HOBD.theme.Background != null)
            {
                original = new Bitmap(Path.Combine(Path.GetDirectoryName(HOBD.theme.File), HOBD.theme.Background));
            }
            else
            {
                original = ResourceManager.Instance.GetBitmapFromEmbeddedResource(HomePage.DefaultBackground);
            }
            double scale  = ((double)layoutY) / original.Height;
            var    target = new Bitmap((int)(original.Width * scale), (int)(original.Height * scale));

            using (var gr = Graphics.FromImage(target))
            {
                gr.DrawImage(original,
                             new Rectangle(0, 0, target.Width, target.Height),
                             new Rectangle(0, 0, original.Width, original.Height),
                             GraphicsUnit.Pixel);
            }
            //var target = original;

//            panorama.BackgroundImage = target;

//            panorama.ClearSections();

            this.LoadSections();

            menuSection = this.CreateMenuSection();
            panorama.AddSection(menuSection);

            //panorama.AddSection(this.CreateFeaturedSection());
            //panorama.AddSection(this.CreateHorizontalFeaturedSection());

            panorama.OnSectionChange += this.SectionChanged;

            // activate first section
            this.SectionChanged(this.panorama, this.panorama.CurrentSection);

            statusField = new DynamicElement("///hobd")
            {
                Style = HOBD.theme.PhoneTextStatusStyle
            };
            statusField.Location = new Point(10, (layoutY - 20));
            statusField.Size     = new Size(layoutX, 20);
            panorama.AddElement(statusField);
            HOBD.engine.StateNotify += StateChanged;

            this.theForm.Text = HomePage.Title;
            this.theForm.Menu = null;

            var asm     = Assembly.GetExecutingAssembly();
            var keyName = asm.GetManifestResourceNames().FirstOrDefault(p => p.EndsWith("hobd.ico"));

            this.theForm.Icon = new Icon(asm.GetManifestResourceStream(keyName));

            if (HOBD.config.Fullscreen)
            {
                this.theForm.FormBorderStyle = FormBorderStyle.None;
                this.theForm.WindowState     = FormWindowState.Maximized;
            }
            else
            {
                this.theForm.Width  = layoutX.ToPixels();
                this.theForm.Height = layoutY.ToPixels() + 30;
            }

            this.Control.AddElement(panorama);

            Logger.info("HomePage", "System DPI: " + this.theForm.CreateGraphics().DpiX);
            Logger.info("HomePage", "App DPI: " + FleuxApplication.TargetDesignDpi);


            Logger.info("HomePage", "system width: " + Screen.PrimaryScreen.Bounds.Width + ", height: " + Screen.PrimaryScreen.Bounds.Height);
            Logger.info("HomePage", "form width: " + this.theForm.Width + ", height: " + this.theForm.Height);

            HOBD.engine.Activate();
        }