Beispiel #1
0
        public PanoramaPage()
        {
            RightMenu.DisplayText = "Exit";
            RightMenu.OnClickAction = () => this.Close();

            // Definition for Entrance and Exit Animations
            this.Control.EntranceDuration = 300;
            this.Control.ShadowedAnimationMode = FleuxControl.ShadowedAnimationOptions.FromLeft;

            // Panorama
            this.panorama = new PanoramaElement { Size = this.Size };

            // Title
            this.panorama.Title.AddElement(new DelegateUIElement
                        {
                            Size = new Size(1000, 300),
                            DrawingAction = gr => gr.MoveRel(0, -80).Style(MetroTheme.PhoneTextPanoramaTitleStyle)
                                                    .Color(Color.FromArgb(190, 221, 226))
                                                    .DrawText("panorama").MoveY(0)
                                                    .Style(MetroTheme.PhoneTextLargeStyle)
                                                    .Color(Color.FromArgb(136, 209, 255))
                                                    .DrawText("by fleux")
                        });

            // Background
            this.panorama.Background.AddElement(new ImageElement("background.jpg"));

            // Features
            this.panorama.AddSection(this.CreateMenuSection());

            // Images
            this.panorama.AddSection(this.CreateImagesSection());

            // Horizontal (wide)
            this.panorama.AddSection(this.CreateHorizontalImagesSection(), true);

            // Features
            this.panorama.AddSection(this.CreateMenuSection());

            this.Control.AddElement(this.panorama);
        }
Beispiel #2
0
        protected virtual void SectionChanged(PanoramaElement panorama, PanoramaSection section)
        {
            if (section == menuSection)
            {
                if (volatileSection != null)
                {
                    panorama.RemoveSection(volatileSection);
                    volatileSection = null;
                }
                return;
            }
            List<SensorListener> sensors = null;
            sectionSensorMap.TryGetValue(section, out sensors);

            // remove from all sensors
            HOBD.Registry.RemoveListener(this.SensorChanged);

            if (sensors != null){
                foreach(SensorListener sl in sensors){
                    HOBD.Registry.AddListener(sl.sensor, this.SensorChanged, sl.period);
                }
            }
        }
Beispiel #3
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();
        }