Beispiel #1
0
        protected void btnCreateDemoAccount_Click(object sender, EventArgs e)
        {
            var token       = Session["Token"].ToString();
            var demoAccount = new DemoAccount();

            demoAccount.AccountType     = "HEDGED";
            demoAccount.Balance         = 10000;
            demoAccount.CountryID       = 100;
            demoAccount.DepositCurrency = "EUR";
            demoAccount.Leverage        = 500;
            demoAccount.Password        = "******";
            demoAccount.PhoneNumber     = "99999999";
            var result = demoAccount.CreateDemoAccount(_apiUrl, token);
        }
        public PolicyPage GetPolicy()
        {
            _carouselView = new PanCardView.CarouselView
            {
                ItemTemplate = new DataTemplate(GetPolicyCard)
            };

            // instantiate account to access policies
            DemoAccount   demoAccount = new DemoAccount();
            Account       account     = demoAccount.GetAccount();
            List <Policy> source      = new List <Policy>();

            source = account.GetPolicies();
            _carouselView.ItemsSource   = source;
            _carouselView.SelectedIndex = TappedIndex;
            Content = _carouselView;

            // topToolbar replaces NavigationBar
            NavigationPage.SetTitleView(this, new PolicyView().TopToolbar);

            return(this);
        }
        public PolicyListView()
        {
            // instantiate the Account first.
            Account     account     = new Account();
            DemoAccount demoAccount = new DemoAccount();

            account = demoAccount.GetAccount();

            // grab the List of Policies from the Account
            List <Policy> policies = account.GetPolicies();

            ListView activePolicyListView = new ListView();

            activePolicyListView.RowHeight     = 74;
            activePolicyListView.ItemsSource   = policies;
            activePolicyListView.ItemTemplate  = new DataTemplate(typeof(PolicyCell));
            activePolicyListView.ItemSelected += ActivePolicy_ItemSelected;
            ActiveView = activePolicyListView;

            // previousPolicyListView not yet implemented.
            ListView previousPolicyListView = new ListView();

            previousPolicyListView.IsVisible = false;
            PreviousView = previousPolicyListView;

            //Icon menuIcon = new Icon().MakeIconImage(viewmodel.Icon.IconType.Solid, "\uf0c9", Color.White);
            //TapGestureRecognizer menuTap = new TapGestureRecognizer();

            //RonocoToolbarButton menuButton = new RonocoToolbarButton
            //{
            //    HorizontalOptions = LayoutOptions.StartAndExpand,
            //    VerticalOptions = LayoutOptions.Center,
            //    Children = { menuIcon }
            //};
            //menuButton.GestureRecognizers.Add(menuTap);
            //(menuButton.GestureRecognizers.ElementAt(0) as TapGestureRecognizer).Tapped += MenuButton_Clicked;

            Label titleLabel = new Label
            {
                FontFamily        = "SFUIText-Semibold",
                FontSize          = 16,
                TextColor         = Color.White,
                Text              = "Policies",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Center
            };

            Icon plusIcon = new Icon().MakeIconImage(viewmodel.Icon.IconType.Solid, "\uf067", Color.White);
            TapGestureRecognizer plusTap = new TapGestureRecognizer();

            RonocoToolbarButton plusMiniMenuButton = new RonocoToolbarButton
            {
                HorizontalOptions = LayoutOptions.EndAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Children          = { plusIcon }
            };

            plusMiniMenuButton.GestureRecognizers.Add(plusTap);
            (plusMiniMenuButton.GestureRecognizers.ElementAt(0) as TapGestureRecognizer).Tapped += PlusMiniMenuButton_Clicked;

            RonocoToolbar listToolbar = new RonocoToolbar().MakeRonocoToolbar(Color.FromRgb(70, 120, 200));

            listToolbar.Padding = new Thickness(0, 0, 10, 0);
            // listToolbar.Children.Add(menuButton);
            listToolbar.Children.Add(titleLabel);
            listToolbar.Children.Add(plusMiniMenuButton);

            // sets listToolbar as NavigationBar
            NavigationPage.SetTitleView(this, listToolbar);

            RonocoToolbar bottomToolbar = new RonocoToolbar().MakeBottomRonocoToolbar(Color.FromRgb(202, 202, 208), Color.FromRgb(80, 80, 100));

            StackLayout layout = new StackLayout();

            layout.Orientation = StackOrientation.Horizontal;
            Grid tabbedNavListGrid = constants.RonocoGrid.RonocoBottomToolbarTabsGrid;

            // Tab Buttons defined here to get dimensions of instantiated grid and pass the Button object to Grid.Children
            RonocoToolbarButton activeButton = new RonocoToolbarButton().GetTabToolbarButton("Active", Color.White);

            activeButton.BackgroundColor = Color.FromRgb(70, 120, 200);
            activeButton.Padding         = new Thickness(0, 8);
            (activeButton.GestureRecognizers.ElementAt(0) as TapGestureRecognizer).Tapped += ActiveButton_Clicked;

            RonocoToolbarButton previousButton = new RonocoToolbarButton().GetTabToolbarButton("Previous", Color.White);

            previousButton.BackgroundColor = Color.FromRgb(70, 120, 200);
            previousButton.Padding         = new Thickness(0, 8);
            (previousButton.GestureRecognizers.ElementAt(0) as TapGestureRecognizer).Tapped += PreviousButton_Clicked;

            BoxView activeTabLine = new BoxView
            {
                BackgroundColor   = Color.FromRgb(195, 215, 245),
                HeightRequest     = 4,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.End
            };

            ActiveTabLine = activeTabLine;

            // add a BoxView first to hide Button corners
            BoxView box = new BoxView
            {
                BackgroundColor   = Color.FromRgb(70, 120, 200),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            tabbedNavListGrid.Children.Add(box, 0, 0);
            Grid.SetColumnSpan(box, 2);
            tabbedNavListGrid.Children.Add(activeButton, 0, 0);
            tabbedNavListGrid.Children.Add(previousButton, 1, 0);
            tabbedNavListGrid.Children.Add(activeTabLine, 0, 0);

            // add both/all listviews into same Grid Column, Row, ColumnSpan, etc.
            // IMPORTANT!!! Make sure ONLY ONE ListView IsVisible at a time.
            tabbedNavListGrid.Children.Add(activePolicyListView, 0, 1);
            Grid.SetColumnSpan(activePolicyListView, 2);
            tabbedNavListGrid.Children.Add(previousPolicyListView, 0, 1);
            Grid.SetColumnSpan(previousPolicyListView, 2);

            tabbedNavListGrid.Children.Add(bottomToolbar, 0, 2);
            Grid.SetColumnSpan(bottomToolbar, 2);

            Content = tabbedNavListGrid;
        }
Beispiel #4
0
        public MasterDetailMenu()
        {
            DemoAccount           demoAccount = new DemoAccount();
            Account               account     = demoAccount.GetAccount();
            List <model.MenuItem> menuItems   = new List <model.MenuItem>();

            menuItems.Add(new model.MenuItem
            {
                MenuIcon       = new viewmodel.Icon().MakeIconImage(viewmodel.Icon.IconType.Solid, "\uf3ed", Color.FromRgb(80, 80, 100)),
                MenuPageName   = "Policies",
                TargetPageType = typeof(PolicyListView)
            });
            menuItems.Add(new model.MenuItem
            {
                MenuIcon       = new viewmodel.Icon().MakeIconImage(viewmodel.Icon.IconType.Solid, "\uf550", Color.FromRgb(80, 80, 100)),
                MenuPageName   = "Assets",
                TargetPageType = typeof(AssetsPage)
            });
            menuItems.Add(new model.MenuItem
            {
                MenuIcon       = new viewmodel.Icon().MakeIconImage(viewmodel.Icon.IconType.Solid, "\uf3fd", Color.FromRgb(80, 80, 100)),
                MenuPageName   = "Score",
                TargetPageType = typeof(ScorePage)
            });
            menuItems.Add(new model.MenuItem
            {
                MenuIcon       = new viewmodel.Icon().MakeIconImage(viewmodel.Icon.IconType.Solid, "\uf470", Color.FromRgb(80, 80, 100)),
                MenuPageName   = "Advice",
                TargetPageType = typeof(AdvicePage)
            });

            constants.RonocoGrid gridInstance = new constants.RonocoGrid();
            Grid masterGrid = gridInstance.RonocoMenuGrid;

            FileImageSource imageSource = new FileImageSource {
                File = "avatarJenniferGenacco.png"
            };

            Image profileImage = new Image
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Source            = imageSource
            };

            Label profileLabel = new Label
            {
                FontFamily = "SFUIText-Semibold",
                FontSize   = 16,
                TextColor  = Color.White,
                Text       = account.GetFirstname() + " " + account.GetLastname()
            };

            Label profileDetails = new Label
            {
                FontFamily = "SFUIText-Medium",
                FontSize   = 11,
                TextColor  = Color.White,
                Text       = account.GetEmail()
            };

            StackLayout profileLayout = new StackLayout
            {
                Orientation     = StackOrientation.Horizontal,
                BackgroundColor = Color.FromRgb(70, 120, 200),
                Padding         = new Thickness(16, 0),
                Children        = { profileImage }
            };

            BoxView whiteBackgroundBox = new BoxView
            {
                BackgroundColor   = Color.White,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            BoxView greyBackgroudBox = new BoxView
            {
                BackgroundColor   = Color.FromRgb(239, 239, 241),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand
            };

            masterGrid.RowSpacing    = 0;
            masterGrid.ColumnSpacing = 0;
            masterGrid.Children.Add(profileLayout, 0, 0);
            Grid.SetRowSpan(profileLayout, 1);
            Grid.SetColumnSpan(profileLayout, 4);
            masterGrid.Children.Add(whiteBackgroundBox, 0, 1);
            Grid.SetRowSpan(whiteBackgroundBox, 6);
            Grid.SetColumnSpan(whiteBackgroundBox, 4);
            masterGrid.Children.Add(greyBackgroudBox, 0, 7);
            Grid.SetRowSpan(greyBackgroudBox, 5);
            Grid.SetColumnSpan(greyBackgroudBox, 4);

            Icon = (new viewmodel.Icon().MakeIconImage(viewmodel.Icon.IconType.Solid, "\uf0c9", Color.White).Source as FileImageSource);



            Title   = "Ronoco";
            Content = masterGrid;
        }