Inheritance: VisualElement, ILayout
		void SetupTabbedPage()
		{
			_tabbedNavigationPage = new FreshTabbedNavigationContainer ();
			_contactsPage = _tabbedNavigationPage.AddTab<ContactListPageModel> ("Contacts", "contacts.png");
			_quotesPage = _tabbedNavigationPage.AddTab<QuoteListPageModel> ("Quotes", "document.png");
			this.Detail = _tabbedNavigationPage;
		}
		public NavigationEventArgs(Page page)
		{
			if (page == null)
				throw new ArgumentNullException("page");

			Page = page;
		}
        protected override void OnElementChanged(Xamarin.Forms.Platform.Android.ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged (e);

            if (e.OldElement == null && e.NewElement != null) {
                //map created the first time
                page = GetContainingPage (e.NewElement);
                navPage = (page.Parent as myNavPage);
                navPage.Popped += OnPagePopped;
                //return;
            }

            var formsMap = (ExtendedMap)Element;
            var androidMapView = (MapView)Control;

            if (myMarkers == null)
                myMarkers = new List<Marker> ();

            if (androidMapView != null && androidMapView.Map != null) {
                androidMapView.Map.InfoWindowClick += MapOnInfoWindowClick;

            }

            //if (formsMap != null) {
            //	((ObservableCollection<Pin>)formsMap.Pins).CollectionChanged += OnCollectionChanged;
            //}
        }
        protected override Task<bool> OnPushAsync(Page page, bool animated)
        {
            // We don't await this because doing so would mean the buttons don't
            // update until after the view finishes animating into position
            //
            var ret = base.OnPushAsync(page, animated);

            var toolbarItems = page.ToolbarItems.OfType<ToolbarItemEx>();

            // If ToolbarItemEx is in use, then we take over the top toolbar
            //
            if (toolbarItems.Any())
            {
                var navItem = TopViewController.NavigationItem;

                // If you ask for more than one cancel button.. well, you're weird.. so I'll just ignore the others. You're welcome.
                //
                var cancelButton = toolbarItems.FirstOrDefault(tbi => tbi.ToolbarItemType == ToolbarItemType.Cancel);

                if (cancelButton != null)
                {
                    navItem.SetLeftBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Cancel,
                        (s,e) => cancelButton.Activate()), false);
                }

                // TODO: Respect Priority
                //
                var rightItems = toolbarItems.Where(tbi => tbi.ToolbarItemType != ToolbarItemType.Cancel && tbi.Order != ToolbarItemOrder.Secondary)
                    .Select(tbi => CreateUIBarButtonItem(tbi)).ToArray();

                navItem.SetRightBarButtonItems(rightItems, false);
            }

            return ret;
        }
Exemple #5
0
        public void Show(Page page, PopupArguments args)
        {
			args.Popup.Parent = page;

			var container = new PopupDialogContainer(args);
			container.Show();
        }
Exemple #6
0
        private void Foo()
        {

            Page p = new Page
            {
                //BackgroundColor = "white",
            };

            var l = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Micro),
            };

            var e = new Entry()
            {

                Keyboard = Keyboard.Numeric,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };


            var c = new ContentView()
            {
                Padding = new Thickness(5),
            };

            var sl = new StackLayout
            {
                Padding = new Thickness(5),
            };
        }
        public CustomerDetailViewModel(Account account, Page currentPage)
        {
            if (account == null)
            {
                Account = new Account();
                Account.Industry = Account.IndustryTypes[0];
                Account.OpportunityStage = Account.OpportunityStages[0];

                this.Title = "New Account";
            }
            else
            {
                Account = account;
                this.Title = "Account";
            }

            _CurrentPage = currentPage;

            this.Icon = "account.png";

            _DataClient = DependencyService.Get<IDataService>();
            _GeoCodingService = DependencyService.Get<IGeoCodingService>();

            MessagingCenter.Subscribe<Account>(this, MessagingServiceConstants.ACCOUNT, (Account) =>
                {
                    IsInitialized = false;
                });
        }
Exemple #8
0
		public MailMainModel(Page page) : base(page)
		{
			Messages = new ObservableCollection<MailViewCellModel>();
			var accountMan = new AccountManager.AccountManager();
			var account = accountMan.LoadAccount().Result;

			var json = LacunaExpanseAPIWrapper.Inbox.ViewInbox(account.SessionID);
			var apiService = new ApiService(account.Server);
			var service = new RefitApiService(apiService);
			var result = service.InboxAsync(Priority.Background, json).Result;//.ConfigureAwait (false);
			if (result != null)
			{
				foreach(var m in result.result.messages)
				{
					var model = new MailViewCellModel
					{
						BodyPreview = m.body_preview,
						From = m.from,
						MessageID = m.id,
						Subject = m.subject
					};
					Messages.Add(model);
				}
			}
			else
			{
			}
		}
        /// <summary>
        /// 
        /// Initial stack:
        /// <EmptyPage>
        /// 
        /// Home page stack:
        /// <HomePage>
        /// 
        /// Second page stack:
        /// <HomePage> <--> <BackPage> <--> <SecondPage>
        /// 
        /// Third page stack:
        /// <HomePage> <--> <BackPage> <--> <ThirdPage>
        /// 
        /// </summary>
        /// <remarks>
        /// HomePage is kept in stack, since exception is thrown (at least on WP8) 
        /// when trying to push that page again even after being removed from stack.
        /// 
        /// BackPage is inserted before every page navigated to in order to be able 
        /// to detect back navigation from software back button in Android and iOS.
        /// </remarks>
        /// <param name="nextPage">The page to navigate to.</param>
        /// <returns>A task representing the asynchronous show operation.</returns>
        internal async Task ShowAsync(Page nextPage)
        {
            var firstPage = Navigation.NavigationStack.First();
            var secondPage = Navigation.NavigationStack.LastOrDefault();

            // Here we handle initial navigation when EmptyPage is to be displayed.
            if ((Navigation.NavigationStack.Count == 1) && (firstPage == s_emptyPage))
            {
                // HomePage instance is normally set, but might not on 
                // app resume when at the end of the navigation stack.
                if (_navigationManager.NavigationStack.CurrentPage.PageName == SpecialPageNames.Home)
                {
                    _homePage = nextPage;
                }

                await Navigation.PushAsync(nextPage);

                // Make sure BackPage is inserted before last page if we should be able 
                // to navigate back, in order for software back button to be displayed.
                if (_navigationManager.NavigationStack.CanGoBack && (firstPage != s_backPage))
                {
                    Navigation.InsertPageBefore(s_backPage, CurrentPage);
                }

                // Remove first dummy page (EmpptyPage).
                Navigation.RemovePage(firstPage);
                return;
            }

            if ((nextPage == _homePage) && !_navigationManager.NavigationStack.CanGoBack)
            {
                await Navigation.PopAsync();
                return;
            }
            else
            {
                await Navigation.PushAsync(nextPage);
            }

            // Make sure BackPage is inserted before last page if we should be able 
            // to navigate back, in order for software back button to be displayed.
            if (_navigationManager.NavigationStack.CanGoBack && (!Navigation.NavigationStack.Contains(s_backPage)))
            {
                Navigation.InsertPageBefore(s_backPage, CurrentPage);
            }

            // HomePage is kept in stack, since exception is thrown (at least on WP8) when trying 
            // to push that page again (upon back navigation) even after being removed from stack.
            if ((secondPage != null) && (secondPage != s_backPage) && (secondPage != _homePage))
            {
                Navigation.RemovePage(secondPage);
            }

            // If navigation stack is empty, remove first page if it is a back 
            // page, in order for next back navigation to exit application.
            if (!_navigationManager.NavigationStack.CanGoBack && (firstPage == s_backPage))
            {
                Navigation.RemovePage(s_backPage);
            }
        }
 public void PushView(BasePageModel viewModelToPush, Page pageToPush, bool model)
 {
     if (model)
         this.CurrentPage.Navigation.PushModalAsync (pageToPush);
     else
         this.CurrentPage.Navigation.PushAsync (pageToPush);
 }
        protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null)
            {
                if (GetContainingViewCell(e.NewElement) != null)
                {
                    page = GetContainingPage(e.NewElement);
                    if (page.Parent is TabbedPage)
                    {
                        page.Disappearing += PageContainedInTabbedPageDisapearing;
                        return;
                    }

                    navigPage = GetContainingNavigationPage(page);
                    if (navigPage != null)
                    {
                        navigPage.Popped += OnPagePopped;
                        if (page is BaseContentPage)
                            (page as BaseContentPage).Disposing += OnPageDisposed;
                    }
                }
                else if ((page = GetContainingTabbedPage(e.NewElement)) != null)
                {
                    page.Disappearing += PageContainedInTabbedPageDisapearing;
                }
            }
        }
Exemple #12
0
        /*
        private static readonly BindableProperty SetPopoverHiddenProperty = BindableProperty.Create("SetPopoverHidden", typeof(bool), typeof(PopoverPage), false);
        private bool SetPopoverHidden
        {
            get { return (bool)GetValue(SetPopoverHiddenProperty); }
            set { SetValue(SetPopoverHiddenProperty, value); }
        }
        */
        public void Show(Page parentPage, Point point)
        {
            ParentPage = parentPage;
            ShowFromPoint = point;

            this.SetPopoverVisible = !this.SetPopoverVisible;
        }
		public TaxCalendarViewModel(Page page) : base(page)
		{
			Title = "Tax Calendar";
			Subtitle = "Subtitle";


		}
		public FeedbackViewModel (Page page) : base (page)
		{
			
			this.dataStore = DependencyService.Get<IDataStore> ();
			this.Title = "Leave Feedback";
			StoreName = string.Empty;
		}
Exemple #15
0
 void _configureAlerts(Page rootPage)
 {
     if (AlertHandler == null)
     {
         AlertHandler = new FormsAlertHandler(rootPage);
     }
 }
		public override UIViewController PopViewController(bool animated)
		{
			try
			{
				var obj = Element.GetType().InvokeMember("StackCopy", BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Instance, Type.DefaultBinder, Element, null);
				if(obj != null)
				{
					var pages = obj as Stack<Page>;
					if(pages != null && pages.Count >= 2)
					{
						var copy = new Page[pages.Count];
						pages.CopyTo(copy, 0);

						var prev = copy[1];
						ChangeTheme(prev);
					}
				}
			}
			catch(Exception)
			{
				//InsightsManager.Report(e);
			}

			return base.PopViewController(animated);
		}
Exemple #17
0
        public XFPopupDlg(Page _parent, Xamarin.Forms.View _content,  bool _cancelable, String _title, bool _rightClose, String _ok, String _ko)
        {
            var g = GenDialog (_content, _cancelable, _title, _rightClose, _ok, _ko);

            var svr = DependencyService.Get<IXFPopupSrvc> ();
            dlgNative = svr.CreateDialog(_parent, g, _cancelable);
        }
 public MenuItemDetailVM(Page page, string restoName, MenuDAO menu)
     : base(page)
 {
     Title = restoName;
     StoreName = restoName;
     this.Menu = menu;
 }
 public async Task PushPage (Page page, FreshMvvm.FreshBasePageModel model, bool modal = false, bool animate = true)
 {
     if (modal)
         await Navigation.PushModalAsync (page, animate);
     else
         await Navigation.PushAsync (page, animate);
 }
		public FundsTransferViewModel (INavigation navigation, Page currentPage)
		{
			Navigation = navigation;
			CancelCommand = new Command(async () => await Navigation.PopAsync());
			TransferCommand = new Command(async () => await currentPage.DisplayAlert("Transfer", "Success", "Ok"));

		}
 public EvolveNavigationPage(Page root)
     : base(root)
 {
     Init();
     Title = root.Title;
     Icon = root.Icon;
 }
        private async void IniciarSesion()
        {
            var page = new Page();
            try
            {
                IsBusy = true;
                var us = await _servicio.ValidarUsuario(_login);

                if (us != null)
                {
                    await _navigator.PopToRootAsync();
                    await _navigator.PushAsync<ContactosViewModel>(viewModel =>
                    {
                        Titulo = "Inicio de sesión";
                    });
                }
                else
                {
                    var xx = ""; //para comprobar que se haga bien.
                }

                //TODO: aquí navegaríamos a la pantalla principal o daríamos error
                await page.DisplayAlert(Strings.Error, Strings.UserDoesNotExist, Strings.Ok);
            }
            catch (Exception e)
            {
                await page.DisplayAlert(Strings.Error, e.Message, Strings.Ok);
            }
            finally
            {
                IsBusy = false;
            }
        }
 protected virtual Page CreateContainerPage (Page page)
 {
     if (page is NavigationPage || page is MasterDetailPage || page is TabbedPage)
         return page;
     
     return new NavigationPage (page);
 }
        private async void parseFile(Page arg1, string bglPath)
        {
         await   ParseTheBGL(bglPath);


            
        }
Exemple #25
0
        public App()
        {
            //var resolverContainer = new SimpleContainer();
            //resolverContainer.Register<IMediaPicker>(new MediaPicker());

            MainPage = homeView ?? (homeView = new LoginPageView());
        }
 public OrderDetailViewModel(Page page)
     : base(page)
 {
     Title = title;
     OrderDetail = new ObservableCollection<OrderDetails>();
     
 }
Exemple #27
0
 public StoresViewModel(Page page) : base(page)
 {
     Title = "Locations";
     dataStore = DependencyService.Get<IDataStore>();
     Stores = new ObservableRangeCollection<Store>();
     StoresGrouped = new ObservableRangeCollection<Grouping<string, Store>>();
 }
 public OrderInfoViewModel(Page page, string restoName, int storeId)
     : base(page)
 {
     Title = restoName;
     StoreId = storeId;
     TimePickerList = new ObservableCollection<string>();
 }
		public FeedbackListViewModel (Page page) : base(page)
		{
			Title = "Feedback";
			dataStore = DependencyService.Get<IDataStore> ();
			Feedbacks = new ObservableCollection<Feedback> ();
			FeedbacksGrouped = new ObservableCollection<Grouping<string, Feedback>> ();
		}
Exemple #30
0
 public BaseNavigationPage(XF.Page root) : base(root)
 {
     On <iOS>().SetModalPresentationStyle(UIModalPresentationStyle.FormSheet);
     On <iOS>().DisableTranslucentNavigationBar();
     On <iOS>().SetHideNavigationBarSeparator(true);
 }
Exemple #31
0
        public async Task <IViewModel> PopModalAsync()
        {
            Xamarin.Forms.Page vista = await Navigation.PopModalAsync();

            return(vista.BindingContext as IViewModel);
        }
 static async Task InternalNavigateToAsync(this INavigationService nav, Type viewModelType, object parameter)
 {
     Xamarin.Forms.Page page = CreateAndBindPage(viewModelType, parameter);
     await(page.BindingContext as ViewModelBase).InitializeAsync(parameter);
 }
Exemple #33
0
 public PageButton(Page page)
 {
     this.Page = page;
 }
Exemple #34
0
 public CustomNavigationPage(Xamarin.Forms.Page page) : base(page)
 {
 }
Exemple #35
0
        public static void PublishShared(this Xamarin.Forms.Page page, string path)
        {
            var lazyPage = new Lazy <Maoui.Element>((() => page.CreateElement()), true);

            Maoui.UI.Publish(path, () => lazyPage.Value);
        }
 public CustomNavigationPage(Xamarin.Forms.Page root)
     : base(root)
 {
 }
 public CustomNavigationPage(Xamarin.Forms.Page root, TransitionType type) : base(root)
 {
     TransitionType = type;
     InitializeComponent();
 }
        private void DisposeRendererWhenPageIsClosed(MobileBlazorBindingsRenderer renderer, XF.Page page)
        {
            // Unfortunately, XF does not expose any Destroyed event for elements.
            // Therefore we subscribe to Navigated event, and consider page as destroyed
            // if it is not present in the navigation stack.
            XF.Shell.Current.Navigated += DisposeWhenNavigatedAway;

            void DisposeWhenNavigatedAway(object sender, XF.ShellNavigatedEventArgs args)
            {
                // We need to check all navigationStacks for all Shell items.
                var currentPages = XF.Shell.Current.Items
                                   .SelectMany(i => i.Items)
                                   .SelectMany(i => i.Navigation.NavigationStack);

                if (!currentPages.Contains(page))
                {
                    XF.Shell.Current.Navigated -= DisposeWhenNavigatedAway;
                    renderer.Dispose();
                }
            }
        }
Exemple #39
0
 public CheckoutViewModel(Xamarin.Forms.Page element, StackLayout paidPricePanel, ControlTemplate paidPriceTemplate)
 {
     this._element        = element;
     this.ChangePaidPrice = new ChangePaidPriceViewModel(null, RecalcPaidPrice, paidPricePanel, paidPriceTemplate);
 }
 public void SetMainPage(Xamarin.Forms.Page page)
 {
     _application.MainPage = page;
 }
Exemple #41
0
        /// <summary>
        /// Resolves a View and its related ViewModel
        /// </summary>
        /// <param name="viewModelType">The ViewModel type</param>
        /// <param name="vm">The output ViewModel instance</param>
        /// <returns>The ViewModel instance</returns>
        public Xamarin.Forms.Page Resolve(Type viewModelType, out IViewModel viewModel)
        {
            var vm = _resolver.Resolve(viewModelType) as ViewModel;

            Xamarin.Forms.Application.Current.On <iOS>().SetPanGestureRecognizerShouldRecognizeSimultaneously(true);

            Xamarin.Forms.Page view = null;
            ViewMapAttribute   map  = _mappings[viewModelType];

            if (vm == null || map == null)
            {
                throw new InvalidOperationException("View Model not mapped!");
            }

            Xamarin.Forms.Page pageView = _resolver.Resolve(map.View) as Xamarin.Forms.Page;

            if (pageView == null)
            {
                string message = string.Format("Page not mapped! View Model: {0}", viewModelType);
                throw new InvalidOperationException(message);
            }

            if (map.MenuViewModel == null)
            {
                view = pageView;
                view.On <iOS>().SetUseSafeArea(true);
            }
            else
            {
                IViewModel         menuViewModel = null;
                Xamarin.Forms.Page menuView      = Resolve(map.MenuViewModel, out menuViewModel);

                if (menuView != null)
                {
                    pageView.BindingContext = vm;
                    pageView.Parent         = null;
                    menuView.Parent         = null;

                    if (string.IsNullOrWhiteSpace(menuView.Title))
                    {
                        menuView.Title = menuView.GetType().Name;
                    }

                    if (string.IsNullOrWhiteSpace(pageView.Title))
                    {
                        pageView.Title = pageView.GetType().Name;
                    }

                    view = new MasterDetailPage
                    {
                        Master = menuView,
                        Detail = pageView
                    };

                    pageView.On <iOS>().SetUseSafeArea(true);
                }
            }

            view.Title          = vm.Title;
            view.BindingContext = vm;

            if (map.HideNavigation)
            {
                Xamarin.Forms.NavigationPage.SetHasNavigationBar(view, false);
            }

            viewModel = vm;

            return(view);
        }
 public AONNavigationContainer(Xamarin.Forms.Page page) : base(page)
 {
     BarTextColor       = Color.White;
     BarBackgroundColor = (Color)App.Current.Resources["primary"];
 }
Exemple #43
0
        private Xamarin.Forms.NavigationPage CreateNavigationPage(Xamarin.Forms.Page page)
        {
            var navigationPage = new Xamarin.Forms.NavigationPage(page);

            return(navigationPage);
        }
 public PageHandler(NativeComponentRenderer renderer, XF.Page pageControl) : base(renderer, pageControl)
 {
     PageControl = pageControl ?? throw new ArgumentNullException(nameof(pageControl));
 }
Exemple #45
0
 public static void Publish(this Xamarin.Forms.Page page, string path)
 {
     Maoui.UI.Publish(path, () => page.CreateElement());
 }
Exemple #46
0
 protected virtual Xamarin.Forms.Page CreateContainerPage(Xamarin.Forms.Page page)
 {
     return(new NavigationPage(page));
 }
        void ExecuteViewMapCommand(ExampleItemModel item)
        {
            Xamarin.Forms.Page page = null;
            switch (item.Title)
            {
            case "Default styles":
                page = new StylesDefaultPage();
                break;

            case "Symbol layer icons":
                page = new StylesSymbolLayerIconsPage();
                break;

            case "Symbol layer icon size change":
                page = new StylesSymbolLayerIconSizeChangePage();
                break;

            case "Create a line layer":
                page = new StylesLineLayerPage();
                break;

            case "Change a layer's color":
                page = new StylesChangeLayerColorPage();
                break;

            case "Add a vector tile source":
                page = new StylesVectorLayerPage();
                break;

            case "Add a WMS source":
                page = new StylesWebMapServiceLayerPage();
                break;

            case "Add a new layer below labels":
                page = new StylesLayerBelowLabelsPage();
                break;

            case "Adjust a layer's opacity":
                page = new StylesChangeLayerOpacityPage();
                break;

            case "Color dependent on zoom level":
                page = new StylesColorDependentOnRoomLevelPage();
                break;

            case "Change a map's language":
                page = new StylesLanguageSwitchPage();
                break;

            case "Show and hide layers":
                page = new StylesShowHideLayersPage();
                break;

            case "Mapbox Studio style":
                page = new StylesMapboxStudio();
                break;

            case "Local style or custom raster style":
                page = new StylesLocalStyleSource();
                break;

            case "Use an image source":
                page = new StylesImageSource();
                break;

            case "Show time lapse":
                page = new StylesShowTimeLapse();
                break;

            case "Hillshading":
                page = new StylesHillshading();
                break;

            case "Multiple text formats":
                page = new StylesTextFieldMultipleFormats();
                break;

            case "Transparent render surface":
                page = new StylesTransparentRenderSurface();
                break;

            case "Click to add photo":
                page = new StylesClickToAddImage();
                break;

            case "Text anchor position":
                page = new StylesRotatingTextAnchorPosition();
                break;

            case "Opacity fade":
                page = new StylesSatelliteOpacityOnZoom();
                break;

            case "Adjust text labels":
                page = new StylesTextFieldFormatting();
                break;

            case "Style with missing icon":
                page = new StylesMissingIcon();
                break;

            case "Variable label placement":
                page = new StylesVariableLabelPlacement();
                break;

            case "Display 3D building height based on vector data":
                page = new ExtrusionPopulationDensityExtrusion();
                break;

            case "Use GeoJSON data to set extrusion height":
                page = new ExtrusionMarathon();
                break;

            case "Adjust light location and color":
                page = new ExtrusionAdjust();
                break;

            case "Extrude polygons for 3D indoor mapping":
                page = new ExtrusionIndoor3DMap();
                break;

            case "Rotate and tilt with 3D buildings":     // TODO Create Buildings plugin first
                page = new ExtrusionIndoor3DMap();
                break;

            case "Display real-time traffic":     // TODO Create Traffic plugin first
                page = new ExtrusionIndoor3DMap();
                break;

            case "Display buildings in":     // TODO Create Buildings plugin first
                page = new ExtrusionIndoor3DMap();
                break;

            case "Location search":     // TODO Create Places plugin first
                page = new ExtrusionIndoor3DMap();
                break;

            case "Line behind moving icon":
                page = new LabLineBehindMovingIconPage();
                break;

            case "Symbol annotation listener":
                page = new PluginsSymbolListener();
                break;

            case "A simple offline map":
                page = new OfflineSimpleOfflineMapPage();
                break;

            case "Sideload offline map":
                page = new OfflineSideloadOfflineMapPage();
                break;

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

            if (page != null)
            {
                page.Title = item.Title;

                Navigation.PushAsync(page);
            }
        }
        void ActionSheetSignalNameHandler(XPage sender, ActionSheetArguments arguments)
        {
            Native.Dialog dialog = Native.Dialog.CreateDialog(Forms.NativeParent);
            dialog.Title = arguments.Title;

            Box box = new Box(dialog);

            if (null != arguments.Destruction)
            {
                Native.Button destruction = new Native.Button(dialog)
                {
                    Text       = arguments.Destruction,
                    Style      = ButtonStyle.Text,
                    TextColor  = EColor.Red,
                    AlignmentX = -1
                };
                destruction.Clicked += (s, evt) =>
                {
                    arguments.SetResult(arguments.Destruction);
                    dialog.Dismiss();
                };
                destruction.Show();
                box.PackEnd(destruction);
            }

            foreach (string buttonName in arguments.Buttons)
            {
                Native.Button button = new Native.Button(dialog)
                {
                    Text            = buttonName,
                    BackgroundColor = buttonName.ToColor(),
                    AlignmentX      = -1,
                    MinimumWidth    = 400
                };

                if (button.BackgroundColor == EColor.White || button.BackgroundColor == ColorExtensions.Azure)
                {
                    button.TextColor = EColor.Black;
                }

                button.Clicked += (s, evt) =>
                {
                    arguments.SetResult(buttonName);
                    dialog.Dismiss();
                };
                button.Show();
                box.PackEnd(button);
            }

            box.Show();
            dialog.Content = box;

            if (null != arguments.Cancel)
            {
                EButton cancel = new EButton(dialog)
                {
                    Text = arguments.Cancel
                };
                dialog.NegativeButton = cancel;
                cancel.Clicked       += (s, evt) =>
                {
                    dialog.Dismiss();
                };
            }

            dialog.BackButtonPressed += (s, evt) =>
            {
                dialog.Dismiss();
            };

            dialog.Show();
        }
        void ExecuteViewMapCommand(ExampleItemModel item)
        {
            Xamarin.Forms.Page page = null;
            switch (item.Title)
            {
            case "Default styles":
                page = new StylesDefaultPage();
                break;

            case "Symbol layer icons":
                page = new StylesSymbolLayerIconsPage();
                break;

            case "Symbol layer icon size change":
                page = new StylesSymbolLayerIconSizeChangePage();
                break;

            case "Create a line layer":
                page = new StylesLineLayerPage();
                break;

            case "Change a layer's color":
                page = new StylesChangeLayerColorPage();
                break;

            case "Add a vector tile source":
                page = new StylesVectorLayerPage();
                break;

            case "Add a WMS source":
                page = new StylesWebMapServiceLayerPage();
                break;

            case "Add a new layer below labels":
                page = new StylesLayerBelowLabelsPage();
                break;

            case "Adjust a layer's opacity":
                page = new StylesChangeLayerOpacityPage();
                break;

            case "Color dependent on zoom level":
                page = new StylesColorDependentOnRoomLevelPage();
                break;

            case "Change a map's language":
                page = new StylesLanguageSwitchPage();
                break;

            case "Show and hide layers":
                page = new StylesShowHideLayersPage();
                break;

            case "Mapbox Studio style":
                page = new StylesMapboxStudio();
                break;

            case "Local style or custom raster style":
                page = new StylesLocalStyleSource();
                break;

            case "Use an image source":
                page = new StylesImageSource();
                break;

            case "Show time lapse":
                page = new StylesShowTimeLapse();
                break;

            case "Hillshading":
                page = new StylesHillshading();
                break;

            case "Multiple text formats":
                page = new StylesTextFieldMultipleFormats();
                break;

            case "Transparent render surface":
                page = new StylesTransparentRenderSurface();
                break;

            case "Click to add photo":
                page = new StylesClickToAddImage();
                break;

            case "Text anchor position":
                page = new StylesRotatingTextAnchorPosition();
                break;

            case "Opacity fade":
                page = new StylesSatelliteOpacityOnZoom();
                break;

            case "Adjust text labels":
                page = new StylesTextFieldFormatting();
                break;

            case "Style with missing icon":
                page = new StylesMissingIcon();
                break;

            case "Variable label placement":
                page = new StylesVariableLabelPlacement();
                break;

            case "Display 3D building height based on vector data":
                page = new ExtrusionPopulationDensityExtrusion();
                break;

            case "Use GeoJSON data to set extrusion height":
                page = new ExtrusionMarathon();
                break;

            case "Adjust light location and color":
                page = new ExtrusionAdjust();
                break;

            case "Extrude polygons for 3D indoor mapping":
                page = new ExtrusionIndoor3DMap();
                break;

            case "Rotate and tilt with 3D buildings":
                page = new ExtrusionRotation();
                break;

            case "Display real-time traffic":
                page = new PluginTraffic();
                break;

            case "Display buildings in 3D":
                page = new PluginBuilding();
                break;

            case "Location search":
                page = new PluginPlaces();
                break;    // TODO Location search

            case "Symbol annotation listener":
                page = new PluginSymbolListener();
                break;

            case "Change map text to device language":
                page = new PluginLocalization();    // TODO Change map text to device language
                break;

            case "Place picker":
                page = new MapBoxQsPage();    // TODO Place picker
                break;

            case "Line behind moving icon":
                page = new LabLineBehindMovingIconPage();
                break;

            case "A simple offline map":
                page = new OfflineSimpleOfflineMapPage();
                break;

            case "Sideload offline map":
                page = new OfflineSideloadOfflineMapPage();
                break;

            case "Draw a polygon":
                page = new DdsDrawPolygon();
                break;

            case "Draw a GeoJSON line":
                page = new DdsDrawGeojsonLine();
                break;

            case "Draw a polygon with holes":
                page = new DdsPolygonHoles();
                break;

            case "Show heatmap data":
                page = new DdsHeatmap();
                break;

            case "Styling heatmaps":
                page = new DdsMultipleHeatmapStyling();
                break;

            case "Display water depth":
                page = new DdsBathymetry();
                break;

            case "CircleLayer clusters":
                page = new DdsCircleLayerClustering();
                break;

            case "SymbolLayer clustering":
                page = new DdsSymbolLayerClustering();
                break;

            case "Style circles categorically":
                page = new DdsStyleCirclesCategorically();
                break;

            case "Update a choropleth layer by zoom level":
                page = new DdsChoroplethZoomChange();
                break;

            case "Style lines using an identity property function":
                page = new DdsStyleLineIdentityProperty();
                break;

            case "Line gradient":
                page = new DdsLineGradient();
                break;

            case "Create hotspots from points":
                page = new DdsCreateHotspots();
                break;

            case "Join local JSON data with vector tile geometries":
                page = new DdsChoroplethJsonVectorMix();
                break;

            case "Draw multiple geometries":
                page = new DdsMultipleGeometries();
                break;

            //case "Symbol layer info window": TODO
            //   page = new DdsInfoWindowSymbol();
            //   break;
            case "Data time lapse":
                page = new DdsAddRainFallStyle();
                break;

            case "Multiple expressions":
                page = new DdsExpressionIntegration();
                break;

            case "Icon Rotation and Alignment":
                page = new IconRotateAndAlignment();
                break;

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

            if (page != null)
            {
                page.Title = item.Title;

                Navigation.PushAsync(page);
            }
        }
Exemple #50
0
        public HomeMDPMaster()
        {
            InitializeComponent();

            ListView = lst_notebooks;

            object version = "";

            App.Current.Resources.TryGetValue("version", out version);
            lbl_version.Text = version.ToString();

            mst_lock_unlock.Clicked += new EventHandler((o, e) =>
            {
                LocknoteMgr.GetInstance().SecureErase();
                ((App)Application.Current).ResumeApp();
            });
            mst_settings.Clicked += new EventHandler((o, e) =>
            {
                ((NavigationPage)((HomeMDP)Application.Current.MainPage).Detail).PushAsync(new SettingsPage());
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });
            mst_new_notebook.Clicked += new EventHandler((o, e) =>
            {
                TextEntryPrompt p = new TextEntryPrompt()
                {
                    IsNavPage = true, PositiveButtonText = "Create", NegativeButtonText = "Cancel", PromptTitle = "New Notebook", Hint = "A Notebook"
                };
                p.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                {
                    LocknoteMgr.GetInstance().NoteManager.NewNotebook(p.Text);
                    LocknoteMgr.GetInstance().SaveNotebooks(true);
                    ((HomeMDP)Application.Current.MainPage).IsPresented = true;
                });
                p.Show(((HomeMDP)Application.Current.MainPage).Detail);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });

            lst_notebooks.ItemTapped += new EventHandler((o, e) =>
            {
                Notebook nb             = (Notebook)o;
                SectionsPage sp         = new SectionsPage(nb);
                sp.Title                = nb.Title + " | Sections";
                sp.ListView.ItemsSource = nb.Sections;
                ((HomeMDP)Application.Current.MainPage).Detail      = new NavigationPage(sp);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });

            lst_notebooks.ItemLongTapped += new LNListView.ItemLongTappedHandler((o, e) =>
            {
                Notebook nb          = (Notebook)o;
                EditNotebookPrompt p = new EditNotebookPrompt()
                {
                    Title = nb.Title, IsNavPage = true
                };
                Xamarin.Forms.Page pg = ((NavigationPage)((HomeMDP)Application.Current.MainPage).Detail).CurrentPage;
                p.OnPromptSaved      += new Prompt.PromptClosedEventListener(() =>
                {
                    nb.Title = p.Title;
                    if (pg.GetType() == typeof(SectionsPage))
                    {
                        pg.Title = p.Title + " | Sections";
                    }
                    LocknoteMgr.GetInstance().SaveNotebooks(true);
                    lst_notebooks.ItemsSource = LocknoteMgr.GetInstance().NoteManager.Notebooks;
                });
                p.DeleteClicked += new EventHandler((o2, e2) =>
                {
                    Prompt p2 = new Prompt()
                    {
                        PromptTitle = "Are you sure?", PositiveButtonText = "Yes", NegativeButtonText = "No", IsNavPage = true
                    };
                    p2.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                    {
                        LocknoteMgr.GetInstance().NoteManager.DeleteNotebook(nb);
                        p.Dismiss();
                    });
                    p2.Show(((HomeMDP)Application.Current.MainPage).Detail);
                });
                p.Show(((HomeMDP)Application.Current.MainPage).Detail);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });
        }
 public void CurrentTab(Xamarin.Forms.Page p)
 {
     this.CurrentPage = p;
 }
 public NavigationPageGradientHeader(Xamarin.Forms.Page root) : base(root)
 {
 }
Exemple #53
0
 private Xamarin.Forms.Page CreateContainerPage(Xamarin.Forms.Page page)
 {
     return(new NavigationPage(page));
 }
Exemple #54
0
        public void exportXMLData(Xamarin.Forms.Page page)
        {
            var directory = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory, "OMIKAS_Raports").ToString();

            try
            {
                if (App.DAUtil.GetAllAlloys().Any())
                {
                    var xml = new XElement("Alloys", App.DAUtil.GetAllAlloys().Select(x => new XElement("Alloy",
                                                                                                        new XAttribute("name", x.name),
                                                                                                        new XAttribute("Fe", x.Fe),
                                                                                                        new XAttribute("C", x.C),
                                                                                                        new XAttribute("Si", x.Si),
                                                                                                        new XAttribute("Mn", x.Mn),
                                                                                                        new XAttribute("P", x.P),
                                                                                                        new XAttribute("S", x.S),
                                                                                                        new XAttribute("Cr", x.Cr),
                                                                                                        new XAttribute("Mo", x.Mo),
                                                                                                        new XAttribute("Ni", x.Ni),
                                                                                                        new XAttribute("Al", x.Al),
                                                                                                        new XAttribute("Co", x.Co),
                                                                                                        new XAttribute("Cu", x.Cu),
                                                                                                        new XAttribute("Nb", x.Nb),
                                                                                                        new XAttribute("Ti", x.Ti),
                                                                                                        new XAttribute("V", x.V),
                                                                                                        new XAttribute("W", x.W),
                                                                                                        new XAttribute("Pb", x.Pb),
                                                                                                        new XAttribute("Sn", x.Sn),
                                                                                                        new XAttribute("B", x.B),
                                                                                                        new XAttribute("Ca", x.Ca),
                                                                                                        new XAttribute("Zr", x.Zr),
                                                                                                        new XAttribute("As", x.As),
                                                                                                        new XAttribute("Bi", x.Bi),
                                                                                                        new XAttribute("Sb", x.Sb),
                                                                                                        new XAttribute("Zn", x.Zn),
                                                                                                        new XAttribute("Mg", x.Mg),
                                                                                                        new XAttribute("N", x.N),
                                                                                                        new XAttribute("H", x.H),
                                                                                                        new XAttribute("O", x.O))));

                    if (!Directory.Exists(directory))
                    {
                        Directory.CreateDirectory(directory);
                    }

                    //sciezka do exportu xml
                    var path = Path.Combine(directory, "OMIKAS_AlloysExport.xml");
                    if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                    xml.Save(path);
                    page.DisplayAlert("Export", "Skladniki stopowe wyeksportowano do pliku " + path.ToString(), "OK");
                }
                else
                {
                    page.DisplayAlert("Export", "Brak stopów do eksportu", "OK");
                }
            }
            catch (Exception ex)
            {
                page.DisplayAlert("Error", ex.ToString(), "OK");
            }
            try
            {
                if (App.DAUtil.GetAllSmelts().Any())
                {
                    var xml = new XElement("Smelts", App.DAUtil.GetAllSmelts().Select(x => new XElement("Smelt",
                                                                                                        new XAttribute("name", x.name),
                                                                                                        new XAttribute("minFe", x.Fe_min),
                                                                                                        new XAttribute("minC", x.C_min),
                                                                                                        new XAttribute("minSi", x.Si_min),
                                                                                                        new XAttribute("minMn", x.Mn_min),
                                                                                                        new XAttribute("minP", x.P_min),
                                                                                                        new XAttribute("minS", x.S_min),
                                                                                                        new XAttribute("minCr", x.Cr_min),
                                                                                                        new XAttribute("minMo", x.Mo_min),
                                                                                                        new XAttribute("minNi", x.Ni_min),
                                                                                                        new XAttribute("minAl", x.Al_min),
                                                                                                        new XAttribute("minCo", x.Co_min),
                                                                                                        new XAttribute("minCu", x.Cu_min),
                                                                                                        new XAttribute("minNb", x.Nb_min),
                                                                                                        new XAttribute("minTi", x.Ti_min),
                                                                                                        new XAttribute("minV", x.V_min),
                                                                                                        new XAttribute("minW", x.W_min),
                                                                                                        new XAttribute("minPb", x.Pb_min),
                                                                                                        new XAttribute("minSn", x.Sn_min),
                                                                                                        new XAttribute("minB", x.B_min),
                                                                                                        new XAttribute("minCa", x.Ca_min),
                                                                                                        new XAttribute("minZr", x.Zr_min),
                                                                                                        new XAttribute("minAs", x.As_min),
                                                                                                        new XAttribute("minBi", x.Bi_min),
                                                                                                        new XAttribute("minSb", x.Sb_min),
                                                                                                        new XAttribute("minZn", x.Zn_min),
                                                                                                        new XAttribute("minMg", x.Mg_min),
                                                                                                        new XAttribute("minN", x.N_min),
                                                                                                        new XAttribute("minH", x.H_min),
                                                                                                        new XAttribute("minO", x.O_min),

                                                                                                        new XAttribute("maxFe", x.Fe_max),
                                                                                                        new XAttribute("maxC", x.C_max),
                                                                                                        new XAttribute("maxSi", x.Si_max),
                                                                                                        new XAttribute("maxMn", x.Mn_max),
                                                                                                        new XAttribute("maxP", x.P_max),
                                                                                                        new XAttribute("maxS", x.S_max),
                                                                                                        new XAttribute("maxCr", x.Cr_max),
                                                                                                        new XAttribute("maxMo", x.Mo_max),
                                                                                                        new XAttribute("maxNi", x.Ni_max),
                                                                                                        new XAttribute("maxAl", x.Al_max),
                                                                                                        new XAttribute("maxCo", x.Co_max),
                                                                                                        new XAttribute("maxCu", x.Cu_max),
                                                                                                        new XAttribute("maxNb", x.Nb_max),
                                                                                                        new XAttribute("maxTi", x.Ti_max),
                                                                                                        new XAttribute("maxV", x.V_max),
                                                                                                        new XAttribute("maxW", x.W_max),
                                                                                                        new XAttribute("maxPb", x.Pb_max),
                                                                                                        new XAttribute("maxSn", x.Sn_max),
                                                                                                        new XAttribute("maxB", x.B_max),
                                                                                                        new XAttribute("maxCa", x.Ca_max),
                                                                                                        new XAttribute("maxZr", x.Zr_max),
                                                                                                        new XAttribute("maxAs", x.As_max),
                                                                                                        new XAttribute("maxBi", x.Bi_max),
                                                                                                        new XAttribute("maxSb", x.Sb_max),
                                                                                                        new XAttribute("maxZn", x.Zn_max),
                                                                                                        new XAttribute("maxMg", x.Mg_max),
                                                                                                        new XAttribute("maxN", x.N_max),
                                                                                                        new XAttribute("maxH", x.H_max),
                                                                                                        new XAttribute("maxO", x.O_max),

                                                                                                        new XAttribute("evoFe", x.Fe_evo),
                                                                                                        new XAttribute("evoC", x.C_evo),
                                                                                                        new XAttribute("evoSi", x.Si_evo),
                                                                                                        new XAttribute("evoMn", x.Mn_evo),
                                                                                                        new XAttribute("evoP", x.P_evo),
                                                                                                        new XAttribute("evoS", x.S_evo),
                                                                                                        new XAttribute("evoCr", x.Cr_evo),
                                                                                                        new XAttribute("evoMo", x.Mo_evo),
                                                                                                        new XAttribute("evoNi", x.Ni_evo),
                                                                                                        new XAttribute("evoAl", x.Al_evo),
                                                                                                        new XAttribute("evoCo", x.Co_evo),
                                                                                                        new XAttribute("evoCu", x.Cu_evo),
                                                                                                        new XAttribute("evoNb", x.Nb_evo),
                                                                                                        new XAttribute("evoTi", x.Ti_evo),
                                                                                                        new XAttribute("evoV", x.V_evo),
                                                                                                        new XAttribute("evoW", x.W_evo),
                                                                                                        new XAttribute("evoPb", x.Pb_evo),
                                                                                                        new XAttribute("evoSn", x.Sn_evo),
                                                                                                        new XAttribute("evoB", x.B_evo),
                                                                                                        new XAttribute("evoCa", x.Ca_evo),
                                                                                                        new XAttribute("evoZr", x.Zr_evo),
                                                                                                        new XAttribute("evoAs", x.As_evo),
                                                                                                        new XAttribute("evoBi", x.Bi_evo),
                                                                                                        new XAttribute("evoSb", x.Sb_evo),
                                                                                                        new XAttribute("evoZn", x.Zn_evo),
                                                                                                        new XAttribute("evoMg", x.Mg_evo),
                                                                                                        new XAttribute("evoN", x.N_evo),
                                                                                                        new XAttribute("evoH", x.H_evo),
                                                                                                        new XAttribute("evoO", x.O_evo))));

                    if (!Directory.Exists(directory))
                    {
                        Directory.CreateDirectory(directory);
                    }
                    var path = Path.Combine(directory, "OMIKAS_SmeltsExport.xml");
                    if (File.Exists(path))
                    {
                        File.Delete(path);
                    }
                    xml.Save(path);
                    page.DisplayAlert("Export", "Wytopy wyeksportowano do pliku " + path.ToString(), "OK");
                }
                else
                {
                    page.DisplayAlert("Export", "Brak wytopów do eksportu", "OK");
                }
            }
            catch (Exception ex)
            {
                page.DisplayAlert("Error", ex.ToString(), "OK");
            }
        }
 public virtual Task PushPage(Xamarin.Forms.Page page, FreshBasePageModel model, bool modal = false, bool animate = true)
 => (modal)
     ? Navigation.PushModalAsync(CreateContainerPageSafe(page), animate)
     : Navigation.PushAsync(page, animate);
        public App()
        {
            var tabbedPage = new TabbedPage { Title = "Hello!" };

            tab1Page = new HelloPage ();
            tab2Page = new HelloPage ();
            tab3Page = new HelloPage ();

            tabbedPage.Children.Add(tab1Page);
            tabbedPage.Children.Add(tab2Page);
            tabbedPage.Children.Add(tab3Page);

            var navigationPage = new NavigationPage(tabbedPage);

            MessagingCenter.Subscribe<HelloPage, string> (this, "Bar bg color", (page, color) => {
                DependencyService.Get<IChangeSBColor>().ChangeStatusBarColor(color);
                navigationPage.BarBackgroundColor = Color.FromHex (color);
            });
            navigationPage.BarTextColor = Color.FromHex ("#fff");

            //			tabbedPage.CurrentPage = tab1Page;
            //			if (tabbedPage.CurrentPage == tab2Page) {
            //				navigationPage.BarBackgroundColor = Color.FromHex ("#f000");
            //			}

            MainPage = navigationPage;
        }