Ejemplo n.º 1
0
        /// <summary>
        /// Raises the element changed event (when page loads)
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            xMapPage = (MapPage)e.NewElement;

            var vm = (xMapPage.BindingContext as MapPageViewModel);

            vm.MapPageStatusChanged += MapPage_StatusChanged;

            // Ignore unmounted events
            if (e.OldElement != null || Element == null)
            {
                return;
            }

            try {
                // TODO: Persist center / zoom, or get from user location
                var camera  = CameraPosition.FromCamera(-34, 151, 12);
                var mapView = MapView.FromCamera(RectangleF.Empty, camera);

                mapView.MyLocationEnabled = true;
                //mapView.Settings.MyLocationButton = true; // TODO: On click
                //mapView.Settings.CompassButton = true;
                mapView.Settings.SetAllGesturesEnabled(true);

                mapView.CameraPositionIdle += MapPage_CameraPositionIdle;

                View = mapView;
            } catch (Exception ex) {
            }
        }
Ejemplo n.º 2
0
 void clickMap()
 {
     if (ActualPage?.GetType() != typeof(MapPage))
     {
         ActualPage = new MapPage();
     }
 }
Ejemplo n.º 3
0
        async void PageItemTapped(System.Object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
            var titles = (string[])Resources["PageArray"];
            var title  = titles[e.ItemIndex];

            Page page = null;

            switch (e.ItemIndex)
            {
            case 0:
                page = new LabelPage();
                break;

            case 1:
                page = new ButtonPage();
                break;

            case 2:
                page = new ViewBindingDemoPage();
                break;

            case 3:
                page = new MapPage();
                break;
            }

            page.Title = title;
            await Navigation.PushAsync(page);
        }
Ejemplo n.º 4
0
        private Page GetPage(BaseViewModel vm)
        {
            if (vm is DashboardViewModel)
            {
                var Page = new DashboardPage();
                Page.BindingContext = new DashboardViewModel();
                return(Page);
            }
            if (vm is ActivitiesListViewModel)
            {
                var Page = new ActivitiesListPage();
                Page.BindingContext = vm;
                return(Page);
            }
            if (vm is ActivityListItemViewModel)
            {
                var Page = new ActivityPage();
                Page.BindingContext = vm;
                return(Page);
            }
            if (vm is MapViewModel)
            {
                var Page = new MapPage();
                Page.BindingContext = vm;
                Page.Longitude      = ((MapViewModel)vm).Longitude;
                Page.Latitude       = ((MapViewModel)vm).Latitude;
                return(Page);
            }

            throw new Exception("Not implemented page");
        }
Ejemplo n.º 5
0
        public MapViewModel(MapPage page, IMapService mapService)
        {
            this.mapService             = mapService;
            geoLocator                  = CrossGeolocator.Current;
            geoLocator.PositionChanged += GeoLocatorOnPositionChanged;
            page.Appearing             += OnAppearing;
            page.Disappearing          += OnDisappearing;
            map = new Xamarin.Forms.GoogleMaps.Map
            {
                HeightRequest     = 100,
                WidthRequest      = 960,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                MapType           = MapType.Hybrid,
                MyLocationEnabled = true,
                IsTrafficEnabled  = true,
                UiSettings        =
                {
                    CompassEnabled          = true,
                    MyLocationButtonEnabled = true,
                    ZoomControlsEnabled     = true
                }
            };
            var stack = new StackLayout {
                Spacing = 0
            };

            stack.Children.Add(map);
            page.Content = stack;
        }
Ejemplo n.º 6
0
        private void Input_ButtonPressed(object sender, ButtonPressedEventArgs e)
        {
            if (Game1.activeClickableMenu is GameMenu && (Game1.activeClickableMenu as GameMenu).currentTab == GameMenu.mapTab && e.Button == Config.TeleportKey)
            {
                MapPage mp = (Game1.activeClickableMenu as GameMenu).pages[(Game1.activeClickableMenu as GameMenu).currentTab] as MapPage;
                int     x  = Game1.getMouseX(true);
                int     y  = Game1.getMouseY(true);
                Monitor.Log($"Trying to teleport, mouse pos {x},{y}; raw {Game1.getMouseX(false)},{Game1.getMouseY(false)}");

                foreach (ClickableComponent c in mp.points)
                {
                    if (c.containsPoint(x, y))
                    {
                        Coordinates co = coordinates.coordinates.Find(o => o.id == c.myID);
                        if (co == null)
                        {
                            Monitor.Log($"Teleport location {c.name} not found!", LogLevel.Warn);
                            return;
                        }
                        Monitor.Log($"Teleporting to {c.name}, {co.mapName}, {co.x},{co.y}", LogLevel.Debug);
                        Game1.activeClickableMenu.exitThisMenu(true);
                        Game1.warpFarmer(co.mapName, co.x, co.y, false);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public App()
        {
            InitializeComponent();

            // TODO : Set Root/Main Page
            MainPage = new MapPage();
        }
Ejemplo n.º 8
0
        public void CommmonTest()
        {
            //AppForm form = new AppForm();
            //var tab = new AppFormTab();
            //var section = new AppFormSection();
            //var item = new AppFormItem();
            //item.Options = new List<SelectOption>();
            //SelectOption so1 = new SelectOption();
            //so1.Value = "1";
            //so1.Text = "yes ";
            //SelectOption so2 = new SelectOption();
            //so2.Value = "0";
            //so2.Text = "no ";
            //item.Options.Add(so1);
            //item.Options.Add(so2);
            //section.Items.Add(item);
            //tab.Sections.Add(section);
            //form.Tabs.Add(tab);

            //var formXml = XmlHelper.XmlSerialize(form);
            System.Threading.Thread.Sleep(100000);

            DbAccessManager.Init("Server=wh-pc066;database=dotnet_erp302sp1_scxxw;user id=sa;password=95938");
            MapPage    page       = GetPage();
            PageResult pageresult = AppValidationManager.ValidatePage(page);

            foreach (Result result in pageresult.Results)
            {
                Debug.WriteLine(string.Format("Level: {0}, Title: {1}, Message: {2}", result.Level, result.Title, result.Message));
            }
        }
Ejemplo n.º 9
0
        private MapPage GetPage()
        {
            AppConfigManager.Setting.WebSite.SiteRoot = @"E:\10.5.11.17\四川新希望\ERP302\安全漏洞检测-分支\明源整体解决方案\Map";
            string testdata = "";

            //testdata = @"E:\10.5.11.17\四川新希望\ERP302\安全漏洞检测-分支\明源整体解决方案\Map\Cbgl\PUB\SelectProductPlanProduct.xml";
            testdata = @"E:\360云盘\Mysoft\源码\MySourceCode\ControlChecker\Mysoft.Business.Validation.UnitTest\TestData\AppForm.xml";

            var boo = AppValidationManager.IsMapXml(testdata);

            List <PageResult> pages = AppValidationManager.ValidateFiles(new List <string>()
            {
                testdata
            });

            MapPage page = null;

            try
            {
                page = AppValidationManager.GetPage(testdata);
            }
            catch (Exception)
            {
                string content = FileHelper.Read(testdata);
                content = Regex.Replace(content, "(encoding=\"gb2312\"|xmlns=\"http://map.mysoft.com/2_0/XMLSchema\")", "", RegexOptions.IgnoreCase);
                page    = XmlHelper.XmlDeserialize <MapPage>(content);
            }

            return(page);
        }
Ejemplo n.º 10
0
        // Map menu that uses modified map page and modified component locations for hover
        public ModMapPage(Dictionary <string, string> npcNames, HashSet <NPCMarker> npcMarkers, Dictionary <long, KeyValuePair <Farmer, Vector2> > farmers)
        {
            // initialise
            this.npcNames   = npcNames;
            this.npcMarkers = npcMarkers;
            this.farmers    = farmers;
            okButton        = new ClickableTextureComponent(Game1.content.LoadString("Strings\\StringsFromCSFiles:MapPage.cs.11059", new object[0]), new Rectangle(this.xPositionOnScreen + width + Game1.tileSize, this.yPositionOnScreen + height - IClickableMenu.borderWidth - Game1.tileSize / 4, Game1.tileSize, Game1.tileSize), null, null, Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
            map             = Game1.content.Load <Texture2D>("LooseSprites\\map");
            Vector2 centeringOnScreen = Utility.getTopLeftPositionForCenteringOnScreen(this.map.Bounds.Width * 4, 720, 0, 0);

            drawPamHouseUpgrade = Game1.MasterPlayer.mailReceived.Contains("pamHouseUpgrade");
            mapX   = (int)centeringOnScreen.X;
            mapY   = (int)centeringOnScreen.Y;
            points = this.GetMapPoints().ToList();

            // update vanilla points (for compatibility with mods that check them), but make sure they don't peek out from under new map
            GameMenu menu = (GameMenu)Game1.activeClickableMenu;
            List <IClickableMenu> menuPages = (List <IClickableMenu>) typeof(GameMenu).GetField("pages", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(menu);
            MapPage mapPage = (MapPage)menuPages[menu.currentTab];
            List <ClickableComponent> vanillaPoints = ModMain.modHelper.Reflection.GetField <List <ClickableComponent> >(mapPage, "points").GetValue();

            vanillaPoints.Clear();
            foreach (ClickableComponent point in this.GetMapPoints())
            {
                point.label = "";
                point.scale = 0.1f;
                vanillaPoints.Add(point);
            }
        }
Ejemplo n.º 11
0
 public void CheckRoot()
 {
     for (int i = 0; i < formList.Count; i++)
     {
         StatPage sp = formList[i] as StatPage;
         if (sp != null)
         {
             sp.CheckRoot();
             sp.ChangeLoginButton();
             continue;
         }
         StorePage storePage = formList[i] as StorePage;
         if (storePage != null)
         {
             storePage.CheckRoot();
             continue;
         }
         MapPage mp = formList[i] as MapPage;
         if (mp != null)
         {
             mp.CheckRoot();
             continue;
         }
     }
 }
Ejemplo n.º 12
0
        static Page GetDetailPage(MainMasterPageMenuItem item)
        {
            Page page;

            switch (item.Id)
            {
            case 1:
                page = new BusChoicePage();
                break;

            case 2:
                page = new DelaysBusStopChoosePage();
                break;

            case 3:
                page = new MapPage();
                break;

            case 4:
                page = new UserAccountPage();
                break;

            case 5:
                page = new SettingsPage();
                break;

            default:
                page = new MainMasterPageDetail();
                break;
            }

            page.Title = item.Title;
            return(page);
        }
Ejemplo n.º 13
0
        public MapViewModel(AppShell appShell)
        {
            this.Title = "Mapa";

            this.AppShell = appShell;

            this.Pins = new List <PinViewModel>();

            FlyOutItem = new FlyoutItem()
            {
                Title = this.Title,
                Icon  = "icon_map.png",
            };

            MapPage = new MapPage(this)
            {
                Title = this.Title
            };

            ShellContent = new ShellContent {
                Content = MapPage
            };

            FlyOutItem.Items.Add(ShellContent);

            AddToBar();
        }
Ejemplo n.º 14
0
        void OnDidSelectAnnotationView(object sender, MKAnnotationViewEventArgs e)
        {
            // centralise map and freeze map updates
            MapPage.CentraliseMap(new Position(e.View.Annotation.Coordinate.Latitude,
                                               e.View.Annotation.Coordinate.Longitude));
            MapPage.SetFreezeMap(true);

            // create custom callout with bus info
            // set background for callout
            var frame = new CGRect(0, 0, 200, 84);

            customPinView = new UIView {
                Frame           = frame,
                BackgroundColor = new UIColor(0.8f, 0.8f, 0.8f, 0.3f),
                Center          = new CGPoint(0, -(e.View.Frame.Height + 20))
            };
            customPinView.Layer.BorderColor  = new CGColor(0, 0, 0, 50);
            customPinView.Layer.BorderWidth  = 1f;
            customPinView.Layer.CornerRadius = 2f;

            // add text info
            customPinView.Add(new UILabel {
                Frame = frame,
                // title - label, subtitle - address (in xamarin.forms.maps)
                Text                      = e.View.Annotation.GetTitle() + "\n" + e.View.Annotation.GetSubtitle(),
                Font                      = UIFont.FromName("Helvetica", 12f),
                TextAlignment             = UITextAlignment.Left,
                AdjustsFontSizeToFitWidth = true,
                LineBreakMode             = UILineBreakMode.WordWrap,
                Lines                     = 0
            });
            e.View.AddSubview(customPinView);
        }
Ejemplo n.º 15
0
        public static MapPage GetPage(string filepath)
        {
            MapPage page = XmlHelper.XmlDeserializeFromFile <MapPage>(filepath);

            page.PageXml = filepath;
            return(page);
        }
Ejemplo n.º 16
0
        public static List <PageResult> ValidateFiles(List <string> files)
        {
            DbAccessManager.Init(AppConfigManager.ConnectionString);

            List <PageResult> pageResults = new List <PageResult>();

            if (files != null)
            {
                int total = files.Count <string>();
                for (int i = 0; i < total; i++)
                {
                    Exception  ex;
                    PageResult pr   = null;
                    string     file = files[i];
                    Notify(string.Format("检测({0}/{1}):{2}", i + 1, total, file));

                    MapPage page = null;

                    try
                    {
                        page = GetPage(file);
                    }
                    catch (Exception exception1)
                    {
                        ex = exception1;
                        if (IsMapXml(file))
                        {
                            pr = GetPageResult("配置文件不规范", ex.Message, file);
                        }
                        else
                        {
                            pr = GetPageResult("忽略文件", "非MAP配置文件。", file, Level.Message);
                        }
                        pageResults.Add(pr);
                    }

                    if (page != null)
                    {
                        pr = new PageResult();

                        try
                        {
                            pr = ValidatePage(page);
                        }
                        catch (Exception exception2)
                        {
                            ex = exception2;
                            pr.Results.Add(new Result("验证执行出错", ex.StackTrace, Level.Warn, typeof(AppValidationManager)));
                        }

                        if (pr.Results.Count > 0)
                        {
                            pageResults.Add(pr);
                        }
                    }
                }
            }
            return(pageResults);
        }
Ejemplo n.º 17
0
        public static MapPage DeserializeFromFile(string xmlPath, Encoding encoding)
        {
            MapPage mp = Mysoft.Map.Extensions.Xml.XmlHelper.XmlDeserializeFromFile <MapPage>(xmlPath, encoding);

            mp.Arrange();
            mp.PageXml = xmlPath;
            return(mp);
        }
Ejemplo n.º 18
0
 private void closePopups(MapPage page)
 {
     foreach (var currentPopupLayer in openedPopupLayers)
     {
         page.Map.Layers.Remove(currentPopupLayer);
     }
     openedPopupLayers.Clear();
 }
Ejemplo n.º 19
0
        public void TestDefaultCtor()
        {
            // set up
            var page = new MapPage();

            // check
            Assert.IsTrue(page.Title.Length > 0, "page title must have been set");
        }
Ejemplo n.º 20
0
        public void LoadMapPage()
        {
            Frame   mapContentFrame = new Frame();
            MapPage mapContent      = new MapPage();

            mapContentFrame.Content = mapContent;
            MapTab.Content          = mapContentFrame;
        }
Ejemplo n.º 21
0
 private async Task tryCreateHighStopLabelsAt(MapPage page, GeoCoordinate currentLocation)
 {
     if (!highMarkedLocations.Any(loc => currentLocation.GetDistanceTo(loc) < App.Config.HighStopsRadius * 0.8))
     {
         highMarkedLocations.Add(currentLocation);
         await createStopLabelsAt(page, currentLocation, priorityLimit : 2.1, radius : App.Config.HighStopsRadius);
     }
 }
Ejemplo n.º 22
0
 public override async void OnNavigatedTo(INavigationParameters parameters)
 {
     if (MapPage != null)
     {
         MapPage.MoveCamera();
     }
     base.OnNavigatedTo(parameters);
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Sets up MainPage; it contains a MapPage instance.
        /// </summary>
        private void SetupMainPage()
        {
            this.MapPage = new MapPage();

            var rootPage = new RootPage();

            this.MainPage = rootPage;
        }
Ejemplo n.º 24
0
 private void clearOpenedOpopup(MapPage page)
 {
     if (currentPopupLayer != null)
     {
         page.Map.Layers.Remove(currentPopupLayer);
         currentPopupLayer = null;
     }
 }
Ejemplo n.º 25
0
 public App()
 {
     // Old weather design
     //MainPage = new MainPage();
     //Weather on Map
     MainPage = new MapPage();
     //  Location l = new Location();
 }
Ejemplo n.º 26
0
 private async Task tryCreateStopLabelsAt(MapPage page, GeoCoordinate currentLocation, IEnumerable <Stop> mandatoryStops = null)
 {
     if (!lowMarkedLocations.Any(loc => currentLocation.GetDistanceTo(loc) < App.Config.LowStopsRadius * 0.8))
     {
         lowMarkedLocations.Add(currentLocation);
         //highMarkedLocations.Add(currentLocation);
         await createStopLabelsAt(page, currentLocation, mandatoryStops, radius : App.Config.LowStopsRadius);
     }
 }
Ejemplo n.º 27
0
        private void mapButton_Click(object sender, EventArgs e)
        {
            MainPush.Text = "Загрузка системы картографии...";
            MapPage mp = new MapPage();

            formList.Add(mp);
            mp.Show();
            MainPush.Text = "";
        }
Ejemplo n.º 28
0
 protected override void OnElementChanged(ElementChangedEventArgs <Page> e)
 {
     base.OnElementChanged(e);
     myAMapPage = e.NewElement as MapPage;
     layout1    = new LinearLayout(this.Context);
     this.AddView(layout1);
     IniMapView();
     layout1.AddView(mapView); //类似可以设计更复杂布局!!!!!
 }
Ejemplo n.º 29
0
        /// <summary>Raised after the player presses a button on the keyboard, controller, or mouse.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnButtonPressed(object sender, ButtonPressedEventArgs e)
        {
            if (Game1.activeClickableMenu is GameMenu gameMenu && gameMenu.currentTab == GameMenu.mapTab)
            {
                if (modHelper.Input.IsDown(SButton.LeftAlt) && modHelper.Input.IsDown(SButton.MouseLeft))
                {
                    MapPage mapPage  = (MapPage)Reflection.GetField <List <IClickableMenu> >(gameMenu, "pages").GetValue()[GameMenu.mapTab];
                    Vector2 mapCoord = new Vector2(Reflection.GetField <int>(mapPage, "mapX").GetValue(), Reflection.GetField <int>(mapPage, "mapY").GetValue());

                    //Vector2 mapPos = Utility.getTopLeftPositionForCenteringOnScreen(Sprites.Map.SourceRectangle.Width * Game1.pixelZoom, Sprites.Map.SourceRectangle.Height * Game1.pixelZoom);
                    Vector2 pingedCoord = new Vector2(e.Cursor.ScreenPixels.X - mapCoord.X, e.Cursor.ScreenPixels.Y - mapCoord.Y);

                    int mapWidth  = Sprites.Map.SourceRectangle.Width * Game1.pixelZoom;
                    int mapHeight = Sprites.Map.SourceRectangle.Height * Game1.pixelZoom;
                    if (IsPingWithinMapBounds(mapWidth, mapHeight, pingedCoord))
                    {
                        //TODO: Send ping to players

                        if (config.ShowPingsInChat)
                        {
                            string hoverText = Reflection.GetField <string>(mapPage, "hoverText").GetValue();

                            if (!String.IsNullOrWhiteSpace(hoverText))
                            {
                                hoverText = $"\"{GetHoverTextLocationName(hoverText)}\"";
                            }

                            if (!MapPings.ContainsKey(Game1.player))
                            {
                                MapPings.Add(Game1.player, new PlayerMapPing(Color.Red));
                            }

                            MapPings[Game1.player].AddPing(Game1.player, pingedCoord, hoverText);

                            string messageKey  = "UserNotificationMessageFormat";
                            string messageText = $"{Game1.player.Name} pinged {hoverText} [X:{pingedCoord.X}, Y:{pingedCoord.Y}]";

                            if (Game1.IsMultiplayer)
                            {
                                Multiplayer multiplayer = Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue();
                                multiplayer.globalChatInfoMessage(messageKey, messageText);
                            }
                            else
                            {
                                Game1.chatBox.addInfoMessage(Game1.content.LoadString("Strings\\UI:Chat_" + messageKey, messageText));
                            }
                        }
#if DEBUG
                        ModEntry.ModLogger.Log($"MapCoords => (x: {pingedCoord.X}, y: {pingedCoord.Y})");
                        ModEntry.ModLogger.Log($"Map (X: {mapCoord.X}, Y: {mapCoord.Y})");
#endif
                    }

                    modHelper.Input.Suppress(SButton.MouseLeft);
                }
            }
        }
Ejemplo n.º 30
0
 void OnDidDeselectAnnotationView(object sender, MKAnnotationViewEventArgs e)
 {
     if (!e.View.Selected)
     {
         customPinView.RemoveFromSuperview();
         customPinView.Dispose();
         customPinView = null;
         MapPage.SetFreezeMap(false);
     }
 }
Ejemplo n.º 31
0
        static void Main()
        {
            Handle.GET("/KitchenSink/standalone", () => {
                Session session = Session.Current;

                if (session != null && session.Data != null)
                    return session.Data;

                var standalone = new StandalonePage();

                if (session == null) {
                    session = new Session(SessionOptions.PatchVersioning);
                    standalone.Html = "/KitchenSink/StandalonePage.html";
                }
                else {
                    standalone.Html = "/KitchenSink/LauncherWrapperPage.html";
                }

                var nav = new NavPage();
                standalone.CurrentPage = nav;

                standalone.Session = session;
                return standalone;
            });

            Handle.GET("/KitchenSink", () => {
                return Self.GET("/KitchenSink/text");
            });

            Handle.GET("/KitchenSink/button", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is ButtonPage)) {
                    var page = new ButtonPage();
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/chart", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is ChartPage)) {
                    var page = new ChartPage();

                    page.AddChartData("January", 4);
                    page.AddChartData("February", 7);
                    page.AddChartData("March", 9);
                    page.AddChartData("April", 12);
                    page.AddChartData("May", 15);
                    page.AddChartData("June", 19);

                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/checkbox", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is CheckboxPage)) {
                    var page = new CheckboxPage();
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/datagrid", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is DatagridPage)) {
                    var page = new DatagridPage();

                    DatagridPagePetsElementJson pet;
                    pet = page.Pets.Add();
                    pet.Name = "Rocky";
                    pet.Kind = "Dog";

                    pet = page.Pets.Add();
                    pet.Name = "Tigger";
                    pet.Kind = "Cat";

                    pet = page.Pets.Add();
                    pet.Name = "Bella";
                    pet.Kind = "Rabbit";

                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/decimal", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is DecimalPage)) {
                    var page = new DecimalPage();
                    page.Price = 10;
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/dropdown", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is DropdownPage)) {
                    var page = new DropdownPage();

                    DropdownPage.PetsElementJson pet;
                    pet = page.Pets.Add();
                    pet.Label = "dogs";

                    pet = page.Pets.Add();
                    pet.Label = "cats";

                    pet = page.Pets.Add();
                    pet.Label = "rabbit";

                    page.SelectedPet = "dogs";

                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/html", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is HtmlPage)) {
                    var page = new HtmlPage();
                    page.Bio = @"<h1>This is a markup text</h1>

            You can put <strong>any</strong> <a href=""https://en.wikipedia.org/wiki/HTML"">HTML</a> in it.";
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/integer", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is IntegerPage)) {
                    var page = new IntegerPage();
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/Geo", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is MapPage)) {
                    var page = new MapPage();
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/markdown", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is MarkdownPage)) {
                    var page = new MarkdownPage();
                    page.Bio = @"# This is a strucured text

            It supports **markdown** *syntax*.";
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/radiolist", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is RadiolistPage)) {
                    var page = new RadiolistPage();
                    MenuOptionsElement a;
                    a = page.MenuOptions.Add();
                    a.Label = "Dogs";
                    a = page.MenuOptions.Add();
                    a.Label = "Cats";
                    page.SelectOption(0);
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/multiselect", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is MultiselectPage)) {
                    var page = new MultiselectPage() {
                        Data = null
                    };
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/password", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is PasswordPage)) {
                    var page = new PasswordPage();
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/table", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is TablePage)) {
                    var page = new TablePage();

                    TablePage.PetsElementJson pet;
                    pet = page.Pets.Add();
                    pet.Name = "Rocky";
                    pet.Kind = "Dog";

                    pet = page.Pets.Add();
                    pet.Name = "Tigger";
                    pet.Kind = "Cat";

                    pet = page.Pets.Add();
                    pet.Name = "Bella";
                    pet.Kind = "Rabbit";

                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/text", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is TextPage)) {
                    var page = new TextPage();
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/textarea", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is TextareaPage)) {
                    var page = new TextareaPage();
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/radio", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is RadioPage)) {
                    var page = new RadioPage();

                    RadioPage.PetsElementJson pet;
                    pet = page.Pets.Add();
                    pet.Label = "dogs";

                    pet = page.Pets.Add();
                    pet.Label = "cats";

                    pet = page.Pets.Add();
                    pet.Label = "rabbit";

                    page.SelectedPet = "dogs";

                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            Handle.GET("/KitchenSink/url", () => {
                var master = (StandalonePage)Self.GET("/KitchenSink/standalone");
                if (!((master.CurrentPage as NavPage).CurrentPage is UrlPage)) {
                    var page = new UrlPage();
                    page.Url = "/KitchenSink";
                    page.Label = "Go to home page";
                    (master.CurrentPage as NavPage).CurrentPage = page;
                }
                return master;
            });

            //for a launcher
            Handle.GET("/KitchenSink/app-name", () => {
                return new AppName();
            });

            Handle.GET("/KitchenSink/menu", () => {
                return new Page() { Html = "/KitchenSink/AppMenuPage.html" };
            });

            UriMapping.Map("/KitchenSink/menu", UriMapping.MappingUriPrefix + "/menu");
            UriMapping.Map("/KitchenSink/app-name", UriMapping.MappingUriPrefix + "/app-name");
        }