Ejemplo n.º 1
0
		public ToolbarButton(Context context, ToolbarItem item) : base(context)
		{
			if (item == null)
				throw new ArgumentNullException("item", "you should specify a ToolbarItem");
			Item = item;
			Enabled = Item.IsEnabled;
			Text = Item.Text;
			SetBackgroundColor(new Color(0, 0, 0, 0).ToAndroid());
			Click += (sender, e) => Item.Activate();
			Item.PropertyChanged += HandlePropertyChanged;
		}
Ejemplo n.º 2
0
		public void PropagateToolbarItemBindingContextPostAdd ()
		{
			var page = new ContentPage ();
			object context = "hello";

			var toolbarItem = new ToolbarItem ();
			page.BindingContext = context;

			page.ToolbarItems.Add (toolbarItem);

			Assert.AreEqual (context, toolbarItem.BindingContext);
		}
Ejemplo n.º 3
0
		public ToolbarImageButton(Context context, ToolbarItem item) : base(context)
		{
			if (item == null)
				throw new ArgumentNullException("item", "you should specify a ToolbarItem");
			Item = item;
			Enabled = item.IsEnabled;
			Bitmap bitmap;
			bitmap = Context.Resources.GetBitmap(Item.Icon);
			SetImageBitmap(bitmap);
			SetBackgroundColor(new Color(0, 0, 0, 0).ToAndroid());
			Click += (sender, e) => item.Activate();
			bitmap.Dispose();
			Item.PropertyChanged += HandlePropertyChanged;
		}
Ejemplo n.º 4
0
			public PrimaryToolbarItem(ToolbarItem item, bool forceName)
			{
				_forceName = forceName;
				_item = item;

				if (!string.IsNullOrEmpty(item.Icon) && !forceName)
					UpdateIconAndStyle();
				else
					UpdateTextAndStyle();
				UpdateIsEnabled();

				Clicked += (sender, e) => item.Activate();
				item.PropertyChanged += OnPropertyChanged;

				if (item != null && !string.IsNullOrEmpty(item.AutomationId))
					AccessibilityIdentifier = item.AutomationId;
			}
Ejemplo n.º 5
0
		public Issue229 ()
		{
			Title = "I am a navigation page.";

			var label = new Label {
				Text = "I should have a toolbar item",
#pragma warning disable 618
				XAlign = TextAlignment.Center,
#pragma warning restore 618

#pragma warning disable 618
				YAlign = TextAlignment.Center
#pragma warning restore 618
			};

			var refreshBtn = new ToolbarItem ("Refresh", null, () => label.Text = "Clicking it works");

			ToolbarItems.Add (refreshBtn);

			Content = label;
		}
		public void TrackPreConstructedTabbedPage ()
		{
			var tracker = new ToolbarTracker ();

			var toolbarItem1 = new ToolbarItem ("Foo", "Foo.png", () => { });
			var toolbarItem2 = new ToolbarItem ("Foo", "Foo.png", () => { });
			var toolbarItem3 = new ToolbarItem ("Foo", "Foo.png", () => { });

			var subPage1 = new ContentPage {
				ToolbarItems = {toolbarItem1}
			};

			var subPage2 = new ContentPage {
				ToolbarItems = {toolbarItem2, toolbarItem3}
			};

			var tabbedpage = new TabbedPage {
				Children = {
					subPage1,
					subPage2
				}
			};

			tabbedpage.CurrentPage = subPage1;

			tracker.Target = tabbedpage;

			Assert.True (tracker.ToolbarItems.Count () == 1);
			Assert.True (tracker.ToolbarItems.First () == subPage1.ToolbarItems[0]);

			bool changed = false;
			tracker.CollectionChanged += (sender, args) => changed = true;

			tabbedpage.CurrentPage = subPage2;

			Assert.True (tracker.ToolbarItems.Count () == 2);
			Assert.True (tracker.ToolbarItems.First () == subPage2.ToolbarItems[0]);
			Assert.True (tracker.ToolbarItems.Last () == subPage2.ToolbarItems[1]);
		}
Ejemplo n.º 7
0
        /// <summary>
        /// Creates all of the ToolbarItems.
        /// </summary>
        /// <returns>Array of the created ToolbarItems.</returns>
        ToolbarItem[] CreateToolbarItems()
        {
            // Get the values
            var values = EnumHelper<ToolbarItemType>.Values.Select(EnumHelper<ToolbarItemType>.ToInt);

            // Find the largest value, and create the array
            var max = values.Max();
            var items = new ToolbarItem[max + 1];

            // Create the items
            foreach (var index in values)
            {
                var pos = GetItemPosition(index);
                var sprite = GetItemSprite(index);

                var item = new ToolbarItem(this, (ToolbarItemType)index, pos, sprite);
                item.Clicked += ToolbarItem_Clicked;

                items[index] = item;
            }

            return items;
        }
Ejemplo n.º 8
0
        public void DoCommand(ToolbarItem command)
        {

            var style = EditorStyles.toolbarButton;
            if (command.IsDropdown)
            {
                style = EditorStyles.toolbarDropDown;
            }
            if (command.Checked)
            {
                style = new GUIStyle(EditorStyles.toolbarButton);
                style.normal.background = style.active.background;
            }
            
            var guiContent = new GUIContent(command.Title);
            if (GUILayout.Button(guiContent, style))
            {
                InvertApplication.Execute(command.Command);
            }
            InvertGraphEditor.PlatformDrawer.SetTooltipForRect(GUILayoutUtility.GetLastRect(),command.Description);
            
            GUI.enabled = true;
        }
Ejemplo n.º 9
0
        public App()
        {
            Button helloWorldButton = new Button();

            helloWorldButton.Text = "Hello world";

            Button planarSubdivisionButton = new Button();

            planarSubdivisionButton.Text = "Planar Subdivision";

            Button faceDetectionButton = new Button();

            faceDetectionButton.Text = "Face Detection (CascadeClassifier)";

            Button faceLandmarkDetectionButton = new Button();

            faceLandmarkDetectionButton.Text = "Face Landmark Detection (DNN Module)";

            Button featureDetectionButton = new Button();

            featureDetectionButton.Text = "Feature Matching";

            Button shapeDetectionButton = new Button();

            shapeDetectionButton.Text = "Shape Detection";

            Button pedestrianDetectionButton = new Button();

            pedestrianDetectionButton.Text = "Pedestrian Detection";

            Button ocrButton = new Button();

            ocrButton.Text = "OCR";

            Button maskRcnnButton = new Button();

            maskRcnnButton.Text = "Mask RCNN (DNN module)";

            Button yoloButton = new Button();

            yoloButton.Text = "Yolo (DNN module)";

            Button stopSignDetectionButton = new Button();

            stopSignDetectionButton.Text = "Stop Sign Detection (DNN module)";

            Button licensePlateRecognitionButton = new Button();

            licensePlateRecognitionButton.Text = "License Plate Recognition";

            List <View> buttonList = new List <View>()
            {
                helloWorldButton,
                planarSubdivisionButton,
                faceDetectionButton,
                faceLandmarkDetectionButton,
                featureDetectionButton,
                shapeDetectionButton,
                pedestrianDetectionButton,
                ocrButton,
                maskRcnnButton,
                stopSignDetectionButton,
                yoloButton,
                licensePlateRecognitionButton
            };

            var  openCVConfigDict   = CvInvoke.ConfigDict;
            bool haveViz            = (openCVConfigDict["HAVE_OPENCV_VIZ"] != 0);
            bool haveDNN            = (openCVConfigDict["HAVE_OPENCV_DNN"] != 0);
            bool hasInferenceEngine = false;

            if (haveDNN)
            {
                var dnnBackends = DnnInvoke.AvailableBackends;
                hasInferenceEngine = Array.Exists(dnnBackends, dnnBackend =>
                                                  (dnnBackend.Backend == Dnn.Backend.InferenceEngine ||
                                                   dnnBackend.Backend == Dnn.Backend.InferenceEngineNgraph ||
                                                   dnnBackend.Backend == Dnn.Backend.InferenceEngineNnBuilder2019));
            }

            if (haveViz)
            {
                Button viz3dButton = new Button();
                viz3dButton.Text = "Simple 3D reconstruction";

                buttonList.Add(viz3dButton);

                viz3dButton.Clicked += (sender, args) =>
                {
                    Mat   left  = CvInvoke.Imread("imL.png", ImreadModes.Color);
                    Mat   right = CvInvoke.Imread("imR.png", ImreadModes.Color);
                    Viz3d v     = Simple3DReconstruct.GetViz3d(left, right);
                    v.Spin();
                };
            }

            StackLayout buttonsLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Start,
            };

            foreach (View b in buttonList)
            {
                buttonsLayout.Children.Add(b);
            }

            // The root page of your application
            ContentPage page =
                new ContentPage()
            {
                Content = new ScrollView()
                {
                    Content = buttonsLayout,
                }
            };

            String aboutIcon = null;

            /*
             * String aboutIcon;
             * if (Emgu.Util.Platform.OperationSystem == Emgu.Util.Platform.OS.IOS)
             * {
             *  aboutIcon = null;
             * }
             * else if (Emgu.Util.Platform.ClrType == Emgu.Util.Platform.Clr.NetFxCore)
             *  aboutIcon = null;
             * else
             *  aboutIcon = "questionmark.png";*/

            MainPage =
                new NavigationPage(
                    page
                    );

            ToolbarItem aboutItem = new ToolbarItem("About", aboutIcon,
                                                    () =>
            {
                MainPage.Navigation.PushAsync(new AboutPage());
                //page.DisplayAlert("Emgu CV Examples", "App version: ...", "Ok");
            }
                                                    );

            page.ToolbarItems.Add(aboutItem);

            helloWorldButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new HelloWorldPage()); };

            planarSubdivisionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PlanarSubdivisionPage());
            };

            faceDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FaceDetectionPage());
            };

            shapeDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new ShapeDetectionPage());
            };

            pedestrianDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new PedestrianDetectionPage());
            };

            featureDetectionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new FeatureMatchingPage());
            };

            licensePlateRecognitionButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new LicensePlateRecognitionPage());
            };

            maskRcnnButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new MaskRcnnPage()); };
            faceLandmarkDetectionButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new FaceLandmarkDetectionPage()); };
            stopSignDetectionButton.Clicked     += (sender, args) =>
            {
                MaskRcnnPage stopSignDetectionPage = new MaskRcnnPage();
                stopSignDetectionPage.DefaultImage      = "stop-sign.jpg";
                stopSignDetectionPage.ObjectsOfInterest = new string[] { "stop sign" };
                MainPage.Navigation.PushAsync(stopSignDetectionPage);
            };
            yoloButton.Clicked += (sender, args) => { MainPage.Navigation.PushAsync(new YoloPage()); };

            ocrButton.Clicked += (sender, args) =>
            {
                MainPage.Navigation.PushAsync(new OcrPage());
            };

            maskRcnnButton.IsVisible = haveDNN;
            faceLandmarkDetectionButton.IsVisible = haveDNN;
            stopSignDetectionButton.IsVisible     = haveDNN;
            yoloButton.IsVisible = haveDNN;
            licensePlateRecognitionButton.IsVisible = hasInferenceEngine;
        }
Ejemplo n.º 10
0
        void CreateLayout()
        {
            _noDataView = new NoDataView("ic_cloud_off_48pt", "No Data Found")
            {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            _loadingDataView = new LoadingDataView {
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            _arrowImage = new Image {
                Source = "ic_arrow_downward"
            };
            _pullText = new Label()
            {
                Text      = "Pull To Refresh",
                FontSize  = 15,
                TextColor = Color.Black,
                HorizontalTextAlignment = TextAlignment.Center
            };

            _pullToRefreshLayout = new StackLayout {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Spacing           = 5,
                Padding           = new Thickness(0, 5, 0, 0),
                Children          =
                {
                    _arrowImage,
                    _pullText
                }
            };

            _mainNoDataLayout = new ListView {
                SeparatorVisibility    = SeparatorVisibility.None,
                IsPullToRefreshEnabled = true,
                HorizontalOptions      = LayoutOptions.FillAndExpand,
                VerticalOptions        = LayoutOptions.FillAndExpand,
                Header = new StackLayout {
                    Spacing  = 200,
                    Children =
                    {
                        _pullToRefreshLayout,
                        _noDataView
                    }
                }
            };
            if (Device.OS == TargetPlatform.iOS)
            {
                var isfavorite = League.IsFavorite;
                _addItem          = new ToolbarItem();
                _addItem.Text     = isfavorite ? "remove" : "add";
                _addItem.Clicked += _addItem_Clicked;
                _addItem.Icon     = isfavorite ? "ic_favorite_white" : "ic_favorite_border_white";

                ToolbarItems.Add(_addItem);
            }

            _fixturesListView = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                RowHeight = 120,
                IsPullToRefreshEnabled = true,
                BackgroundColor        = Color.White,
                ItemTemplate           = new DataTemplate(typeof(FixtureLayout)),
                SeparatorVisibility    = SeparatorVisibility.None,
                Opacity = 0
            };
        }
        public TasksPage(SQLiteAsyncConnection connection)
        {
            db = connection;

            Title = "Tasks";

            Content = new StackLayout {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    (listView                  = new ListView               {
                        ItemTemplate           = new DataTemplate(() =>     {
                            // edit button
                            var editItem       = new MenuItem               {
                                Text           = "Edit",
                                Command        = new Command(async param => {
                                    var task   = (TaskItem)param;
                                    await EditItem(task);
                                })
                            };
                            editItem.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));

                            // delete button
                            var deleteItem     = new MenuItem               {
                                Text           = "Delete",
                                IsDestructive  = true,
                                Command        = new Command(async param => {
                                    var task   = (TaskItem)param;
                                    await DeleteItem(task);
                                })
                            };
                            deleteItem.SetBinding(MenuItem.CommandParameterProperty, new Binding("."));

                            // list item
                            var cell           = new TaskItemCell           {
                                ContextActions =
                                {
                                    editItem,
                                    deleteItem
                                }
                            };
                            return(cell);
                        }),
                    })
                }
            };

            listView.ItemSelected += async(sender, e) => {
                if (e.SelectedItem != null)
                {
                    var task = (TaskItem)e.SelectedItem;

                    await CompleteItem(task);

                    listView.SelectedItem = null;
                }
            };

            var addButton = new ToolbarItem {
                Text    = "Add",
                Command = new Command(async() => {
                    await EditItem(null);
                })
            };

            ToolbarItems.Add(addButton);
        }
        public AddOpportunityPage()
        {
            #region Create Topic Controls
            var topicLabel = new Label
            {
                Text = "Topic"
            };

            _topicEntry = new CustomReturnEntry
            {
                ReturnType    = ReturnType.Next,
                AutomationId  = AutomationIdConstants.TopicEntry,
                ReturnCommand = new Command(() => _companyEntry.Focus())
            };
            _topicEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.Topic));
            #endregion

            #region Create Company Controls
            var companyLabel = new Label
            {
                Text = "Company"
            };

            _companyEntry = new CustomReturnEntry
            {
                ReturnType    = ReturnType.Next,
                AutomationId  = AutomationIdConstants.CompanyEntry,
                ReturnCommand = new Command(() => _leaseAmountEntry.Focus())
            };
            _companyEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.Company));
            #endregion

            #region Create DBA Controls
            var dbaLabel = new Label
            {
                Text = "DBA"
            };

            _dbaEntry = new CustomReturnEntry
            {
                AutomationId = AutomationIdConstants.DBAEntry,
                ReturnType   = ReturnType.Go
            };
            _dbaEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.DBA));
            _dbaEntry.SetBinding(CustomReturnEntry.ReturnCommandProperty, nameof(ViewModel.SaveButtonTapped));
            #endregion

            #region Create LeaseAmount Controls
            var leaseAmountLabel = new Label
            {
                Text = "Lease Amount"
            };

            _leaseAmountEntry = new CustomReturnEntry
            {
                ReturnType    = ReturnType.Next,
                AutomationId  = AutomationIdConstants.LeaseAmountEntry,
                Keyboard      = Keyboard.Numeric,
                Placeholder   = "0",
                ReturnCommand = new Command(() => _ownerEntry.Focus())
            };
            _leaseAmountEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.LeaseAmount));
            #endregion

            #region Create Owner Controls
            var ownerLabel = new Label
            {
                Text = "Owner"
            };

            _ownerEntry = new CustomReturnEntry
            {
                ReturnType    = ReturnType.Next,
                AutomationId  = AutomationIdConstants.OwnerEntry,
                ReturnCommand = new Command(() => _dbaEntry.Focus())
            };
            _ownerEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.Owner));
            #endregion

            #region create the Relative Layout
            var mainLayout = new RelativeLayout();
            mainLayout.Children.Add(topicLabel,
                                    Constraint.Constant(0),
                                    Constraint.Constant(0)
                                    );
            mainLayout.Children.Add(_topicEntry,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(topicLabel, (parent, view) => view.Y + view.Height),
                                    Constraint.RelativeToParent((parent) => parent.Width)
                                    );
            mainLayout.Children.Add(companyLabel,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(_topicEntry, (parent, view) => view.Y + view.Height + _relativeLayoutSpacing)
                                    );
            mainLayout.Children.Add(_companyEntry,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(companyLabel, (parent, view) => view.Y + view.Height),
                                    Constraint.RelativeToParent((parent) => parent.Width)
                                    );
            mainLayout.Children.Add(leaseAmountLabel,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(_companyEntry, (parent, view) => view.Y + view.Height + _relativeLayoutSpacing)
                                    );
            mainLayout.Children.Add(_leaseAmountEntry,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(leaseAmountLabel, (parent, view) => view.Y + view.Height),
                                    Constraint.RelativeToParent((parent) => parent.Width)
                                    );
            mainLayout.Children.Add(ownerLabel,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(_leaseAmountEntry, (parent, view) => view.Y + view.Height + _relativeLayoutSpacing)
                                    );
            mainLayout.Children.Add(_ownerEntry,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(ownerLabel, (parent, view) => view.Y + view.Height),
                                    Constraint.RelativeToParent((parent) => parent.Width)
                                    );
            mainLayout.Children.Add(dbaLabel,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(_ownerEntry, (parent, view) => view.Y + view.Height + _relativeLayoutSpacing)
                                    );
            mainLayout.Children.Add(_dbaEntry,
                                    Constraint.Constant(0),
                                    Constraint.RelativeToView(dbaLabel, (parent, view) => view.Y + view.Height),
                                    Constraint.RelativeToParent((parent) => parent.Width)
                                    );
            #endregion

            #region Create Save Button
            var saveButtonToolBar = new ToolbarItem
            {
                Text         = _saveToolBarItemText,
                Priority     = 0,
                AutomationId = AutomationIdConstants.SaveButton
            };
            saveButtonToolBar.SetBinding(ToolbarItem.CommandProperty, nameof(ViewModel.SaveButtonTapped));
            ToolbarItems.Add(saveButtonToolBar);
            #endregion

            #region Create Cancel Button
            _cancelButtonToolBarItem = new ToolbarItem
            {
                Text         = _cancelToolBarItemText,
                Priority     = 1,
                AutomationId = AutomationIdConstants.CancelButton
            };
            ToolbarItems.Add(_cancelButtonToolBarItem);
            #endregion

            Title = PageTitleConstants.AddOpportunityPageTitle;

            Padding = new Thickness(20, 10, 20, 0);

            Content = mainLayout;
        }
Ejemplo n.º 13
0
        public TodoListPage()
        {
            Title = "Just Do It";
            var toolbarItem = new ToolbarItem
            {
                Text            = "Add Task",
                IconImageSource = Device.RuntimePlatform == Device.iOS ? null : "plus.png"
            };

            toolbarItem.Clicked += async(sender, e) =>
            {
                await Navigation.PushAsync(new CreateTodoViewModel
                {
                    BindingContext = new TodoModel()
                });
            };
            ToolbarItems.Add(toolbarItem);

            listView = new ListView
            {
                Margin       = new Thickness(20),
                ItemTemplate = new DataTemplate(() =>
                {
                    var label = new Label
                    {
                        VerticalTextAlignment = TextAlignment.Center,
                        HorizontalOptions     = LayoutOptions.StartAndExpand,
                    };
                    var status = new Label
                    {
                        VerticalTextAlignment = TextAlignment.Center,
                        HorizontalOptions     = LayoutOptions.EndAndExpand
                    };

                    label.SetBinding(Label.TextProperty, "Name");
                    status.SetBinding(Label.TextProperty, "Status");

                    var stackLayout = new StackLayout
                    {
                        Margin            = new Thickness(15, 5, 0, 0),
                        Padding           = new Thickness(10, 0, 10, 0),
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Children          = { label, status }
                    };
                    stackLayout.Spacing = 0.9;


                    return(new ViewCell {
                        View = stackLayout
                    });
                })
            };

            listView.ItemSelected += async(sender, e) =>
            {
                if (e.SelectedItem != null)
                {
                    await Navigation.PushAsync(new CreateTodoViewModel
                    {
                        BindingContext = e.SelectedItem as TodoModel
                    });
                }
            };
            Content = listView;
        }
Ejemplo n.º 14
0
		public void AdditionalTargets ()
		{
			var tracker = new ToolbarTracker ();

			var toolbarItem1 = new ToolbarItem ("Foo", "Foo.png", () => { });
			var toolbarItem2 = new ToolbarItem ("Foo", "Foo.png", () => { });

			var page = new ContentPage {
				ToolbarItems = {
					toolbarItem1
				}
			};

			var additionalPage = new ContentPage {
				ToolbarItems = {toolbarItem2}
			};

			tracker.Target = page;
			tracker.AdditionalTargets = new[] {additionalPage};

			Assert.True (tracker.ToolbarItems.Contains (toolbarItem1));
			Assert.True (tracker.ToolbarItems.Contains (toolbarItem2));
		}
Ejemplo n.º 15
0
        static void UpdateMenuItem(AToolbar toolbar,
                                   ToolbarItem item,
                                   int?menuItemIndex,
                                   IMauiContext mauiContext,
                                   Color?tintColor,
                                   PropertyChangedEventHandler toolbarItemChanged,
                                   List <IMenuItem> previousMenuItems,
                                   List <ToolbarItem> previousToolBarItems,
                                   Action <Context, IMenuItem, ToolbarItem>?updateMenuItemIcon = null)
        {
            var context = mauiContext.Context ??
                          throw new ArgumentNullException($"{nameof(mauiContext.Context)}");

            IMenu menu = toolbar.Menu;

            item.PropertyChanged -= toolbarItemChanged;
            item.PropertyChanged += toolbarItemChanged;

            IMenuItem menuitem;

            Java.Lang.ICharSequence?newTitle = null;

            if (!String.IsNullOrWhiteSpace(item.Text))
            {
                if (item.Order != ToolbarItemOrder.Secondary && tintColor != null && tintColor != null)
                {
                    var             color       = item.IsEnabled ? tintColor.ToPlatform() : tintColor.MultiplyAlpha(0.302f).ToPlatform();
                    SpannableString titleTinted = new SpannableString(item.Text);
                    titleTinted.SetSpan(new ForegroundColorSpan(color), 0, titleTinted.Length(), 0);
                    newTitle = titleTinted;
                }
                else
                {
                    newTitle = new Java.Lang.String(item.Text);
                }
            }
            else
            {
                newTitle = new Java.Lang.String();
            }

            if (menuItemIndex == null || menuItemIndex >= previousMenuItems?.Count)
            {
                menuitem = menu.Add(0, AView.GenerateViewId(), 0, newTitle) ??
                           throw new InvalidOperationException($"Failed to create menuitem: {newTitle}");
                previousMenuItems?.Add(menuitem);
            }
            else
            {
                if (previousMenuItems == null || previousMenuItems.Count < menuItemIndex.Value)
                {
                    return;
                }

                menuitem = previousMenuItems[menuItemIndex.Value];

                if (!menuitem.IsAlive())
                {
                    return;
                }

                menuitem.SetTitle(newTitle);
            }

            menuitem.SetEnabled(item.IsEnabled);
            menuitem.SetTitleOrContentDescription(item);

            if (updateMenuItemIcon != null)
            {
                updateMenuItemIcon(context, menuitem, item);
            }
            else
            {
                UpdateMenuItemIcon(mauiContext, menuitem, item, tintColor);
            }

            if (item.Order != ToolbarItemOrder.Secondary)
            {
                menuitem.SetShowAsAction(ShowAsAction.Always);
            }

            menuitem.SetOnMenuItemClickListener(new GenericMenuClickListener(((IMenuItemController)item).Activate));

            if (item.Order != ToolbarItemOrder.Secondary && !OperatingSystem.IsAndroidVersionAtLeast(26) && (tintColor != null && tintColor != null))
            {
                var view = toolbar.FindViewById(menuitem.ItemId);
                if (view is ATextView textView)
                {
                    if (item.IsEnabled)
                    {
                        textView.SetTextColor(tintColor.ToPlatform());
                    }
                    else
                    {
                        textView.SetTextColor(tintColor.MultiplyAlpha(0.302f).ToPlatform());
                    }
                }
            }
        }
Ejemplo n.º 16
0
        private void Init()
        {
            MessagingCenter.Send(Application.Current, "ShowStatusBar", true);

            var padding = Helpers.OnPlatform(
                iOS: new Thickness(15, 20),
                Android: new Thickness(15, 8),
                Windows: new Thickness(10, 8));

            PasswordHintCell = new FormEntryCell(AppResources.MasterPasswordHint, useLabelAsPlaceholder: true,
                                                 imageSource: "lightbulb.png", containerPadding: padding);
            ConfirmPasswordCell = new FormEntryCell(AppResources.RetypeMasterPassword, isPassword: true,
                                                    nextElement: PasswordHintCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock.png",
                                                    containerPadding: padding);
            PasswordCell = new FormEntryCell(AppResources.MasterPassword, isPassword: true,
                                             nextElement: ConfirmPasswordCell.Entry, useLabelAsPlaceholder: true, imageSource: "lock.png",
                                             containerPadding: padding);
            EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry,
                                          entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true, imageSource: "envelope.png",
                                          containerPadding: padding);

            PasswordHintCell.Entry.TargetReturnType = Enums.ReturnType.Done;

            var table = new FormTableView(this)
            {
                Root = new TableRoot
                {
                    new TableSection(Helpers.GetEmptyTableSectionTitle())
                    {
                        EmailCell,
                        PasswordCell
                    }
                }
            };

            PasswordLabel = new Label
            {
                Text          = AppResources.MasterPasswordDescription,
                LineBreakMode = LineBreakMode.WordWrap,
                FontSize      = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                Style         = (Style)Application.Current.Resources["text-muted"],
                Margin        = new Thickness(15, (this.IsLandscape() ? 5 : 0), 15, 25)
            };

            var table2 = new FormTableView(this)
            {
                NoHeader = true,
                Root     = new TableRoot
                {
                    new TableSection(Helpers.GetEmptyTableSectionTitle())
                    {
                        ConfirmPasswordCell,
                        PasswordHintCell
                    }
                }
            };

            HintLabel = new Label
            {
                Text          = AppResources.MasterPasswordHintDescription,
                LineBreakMode = LineBreakMode.WordWrap,
                FontSize      = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                Style         = (Style)Application.Current.Resources["text-muted"],
                Margin        = new Thickness(15, (this.IsLandscape() ? 5 : 0), 15, 25)
            };

            StackLayout = new RedrawableStackLayout
            {
                Children = { table, PasswordLabel, table2, HintLabel },
                Spacing  = 0
            };

            var scrollView = new ScrollView
            {
                Content = StackLayout
            };

            var loginToolbarItem = new ToolbarItem(AppResources.Submit, Helpers.ToolbarImage("ion_chevron_right.png"), async() =>
            {
                await Register();
            }, ToolbarItemOrder.Default, 0);

            if (Device.RuntimePlatform == Device.iOS)
            {
                table.RowHeight          = table2.RowHeight = -1;
                table.EstimatedRowHeight = table2.EstimatedRowHeight = 70;
                ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel, () =>
                {
                    MessagingCenter.Send(Application.Current, "ShowStatusBar", false);
                }));
            }

            ToolbarItems.Add(loginToolbarItem);
            Title   = AppResources.CreateAccount;
            Content = scrollView;
        }
Ejemplo n.º 17
0
 public Action<Boolean, String> AddItem(string text, object tag)
 {
     items = items ?? new List<ToolbarItem>();
     var it = new ToolbarItem { Text = text, Tag = tag };
     items.Add(it);
     Refresh();
     return (b,dsc) => {
         it.NewContent = b;
         it.ContentDescription = b ? dsc : null;
         this.Invoke(Refresh);
     };
 }
Ejemplo n.º 18
0
        private int DrawItem(Graphics g, ToolbarItem item, int pos, bool sel)
        {
            var text = item.NewContent && !String.IsNullOrEmpty(item.ContentDescription) ?
                String.Format("{0} ({1})", item.Text, item.ContentDescription) : item.Text;
            var color = sel ? UserColors.HighlightText : UserColors.Text;
            var font = item.NewContent ? boldFont : Fonts.Menu;
            var width = TextRenderer.MeasureText(text, font).Width ;

            if (sel)
                g.FillRectangle(UserBrushes.Selection, new Rectangle(pos - 5, 3, width + 10, 14));

            TextRenderer.DrawText(g, text, font, new Rectangle(pos, 3, width, ClientSize.Height), color, TextFormatFlags.Left);
            return width;
        }
Ejemplo n.º 19
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            var item = GetSelected(e.X);

            if (item == selItem)
            {
                hoverItem = null;
                Refresh();
            }
            else if (item != null && item != hoverItem)
            {
                hoverItem = item;
                Refresh();
            }
        }
Ejemplo n.º 20
0
 protected override void OnMouseLeave(EventArgs e)
 {
     if (hoverItem != null)
     {
         hoverItem = null;
         Refresh();
     }
 }
Ejemplo n.º 21
0
        protected override void OnMouseClick(MouseEventArgs e)
        {
            var sel = GetSelected(e.X);

            if (sel != null)
            {
                selItem = selItem == sel ? null : sel;
                Refresh();
                OnSelectedIndexChanged();
            }
        }
Ejemplo n.º 22
0
 public AllFlags()
 {
     BindingContext = DependencyService.Get <FunFlactsViewModel>();
     InitializeComponent();
     cancelEditButton = (ToolbarItem)Resources[nameof(cancelEditButton)];
 }
Ejemplo n.º 23
0
        public void Init()
        {
            var padding = Device.OnPlatform(
                iOS: new Thickness(15, 20),
                Android: new Thickness(15, 8),
                WinPhone: new Thickness(15, 20));

            PasswordCell = new FormEntryCell(AppResources.MasterPassword, isPassword: true,
                                             useLabelAsPlaceholder: true, imageSource: "lock", containerPadding: padding);

            PasswordCell.Entry.ReturnType = Enums.ReturnType.Go;
            PasswordCell.Entry.Completed += Entry_Completed;

            var table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = false,
                HasUnevenRows   = true,
                EnableSelection = false,
                VerticalOptions = LayoutOptions.Start,
                NoFooter        = true,
                Root            = new TableRoot
                {
                    new TableSection
                    {
                        PasswordCell
                    }
                }
            };

            var logoutButton = new ExtendedButton
            {
                Text            = AppResources.LogOut,
                Command         = new Command(async() => await LogoutAsync()),
                VerticalOptions = LayoutOptions.End,
                Style           = (Style)Application.Current.Resources["btn-primaryAccent"],
                BackgroundColor = Color.Transparent,
                Uppercase       = false
            };

            var stackLayout = new StackLayout
            {
                Spacing  = 10,
                Children = { table, logoutButton }
            };

            var scrollView = new ScrollView {
                Content = stackLayout
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                table.RowHeight          = -1;
                table.EstimatedRowHeight = 70;
            }

            var loginToolbarItem = new ToolbarItem(AppResources.Submit, null, async() =>
            {
                await CheckPasswordAsync();
            }, ToolbarItemOrder.Default, 0);

            ToolbarItems.Add(loginToolbarItem);
            Title   = AppResources.VerifyMasterPassword;
            Content = scrollView;
        }
Ejemplo n.º 24
0
        public AddPhotoPage()
        {
            _photoTitleEntry = new Entry
            {
                Placeholder       = "Title",
                BackgroundColor   = Color.White,
                TextColor         = ColorConstants.TextColor,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                ReturnType        = ReturnType.Go
            };
            _photoTitleEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.PhotoTitle));
            _photoTitleEntry.SetBinding(Entry.ReturnCommandProperty, nameof(ViewModel.TakePhotoCommand));

            _takePhotoButton = new Button
            {
                Text            = "Take Photo",
                BackgroundColor = ColorConstants.NavigationBarBackgroundColor,
                TextColor       = ColorConstants.TextColor
            };
            _takePhotoButton.SetBinding(Button.CommandProperty, nameof(ViewModel.TakePhotoCommand));
            _takePhotoButton.SetBinding(IsEnabledProperty, new Binding(nameof(ViewModel.IsPhotoSaving), BindingMode.Default, new InverseBooleanConverter(), ViewModel.IsPhotoSaving));

            _photoImage = new CachedImage();
            _photoImage.SetBinding(CachedImage.SourceProperty, nameof(ViewModel.PhotoImageSource));

            _saveToobarItem = new ToolbarItem
            {
                Text         = "Save",
                Priority     = 0,
                AutomationId = AutomationIdConstants.AddPhotoPage_SaveButton,
            };
            _saveToobarItem.SetBinding(MenuItem.CommandProperty, nameof(ViewModel.SavePhotoCommand));
            ToolbarItems.Add(_saveToobarItem);

            _cancelToolbarItem = new ToolbarItem
            {
                Text         = "Cancel",
                Priority     = 1,
                AutomationId = AutomationIdConstants.CancelButton
            };
            ToolbarItems.Add(_cancelToolbarItem);

            var activityIndicator = new ActivityIndicator();

            activityIndicator.SetBinding(IsVisibleProperty, nameof(ViewModel.IsPhotoSaving));
            activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(ViewModel.IsPhotoSaving));

            this.SetBinding(TitleProperty, nameof(ViewModel.PhotoTitle));

            Padding = new Thickness(20);

            var stackLayout = new StackLayout
            {
                Spacing = 20,

                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.FillAndExpand,

                Children =
                {
                    _photoImage,
                    _photoTitleEntry,
                    _takePhotoButton,
                    activityIndicator
                }
            };

            Content = new ScrollView {
                Content = stackLayout
            };
        }
Ejemplo n.º 25
0
 public void AddToolbarItem(ToolbarItem item, string text, string value)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 26
0
        private void Init()
        {
            _canUseAttachments = _cryptoService.EncKey != null;

            SubscribeFileResult(true);
            var selectButton = new ExtendedButton
            {
                Text     = AppResources.ChooseFile,
                Command  = new Command(async() => await _deviceActiveService.SelectFileAsync()),
                Style    = (Style)Application.Current.Resources["btn-primaryAccent"],
                FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button))
            };

            FileLabel = new Label
            {
                Text     = AppResources.NoFileChosen,
                Style    = (Style)Application.Current.Resources["text-muted"],
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                HorizontalTextAlignment = TextAlignment.Center
            };

            AddNewStackLayout = new StackLayout
            {
                Children        = { selectButton, FileLabel },
                Orientation     = StackOrientation.Vertical,
                Padding         = new Thickness(20, Helpers.OnPlatform(iOS: 10, Android: 20), 20, 20),
                VerticalOptions = LayoutOptions.Start
            };

            NewTable = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                HasUnevenRows   = true,
                NoFooter        = true,
                EnableScrolling = false,
                EnableSelection = false,
                VerticalOptions = LayoutOptions.Start,
                Margin          = new Thickness(0, Helpers.OnPlatform(iOS: 10, Android: 30), 0, 0),
                Root            = new TableRoot
                {
                    new TableSection(AppResources.AddNewAttachment)
                    {
                        new ExtendedViewCell
                        {
                            View            = AddNewStackLayout,
                            BackgroundColor = Color.White
                        }
                    }
                }
            };

            ListView = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                ItemsSource     = PresentationAttchments,
                HasUnevenRows   = true,
                ItemTemplate    = new DataTemplate(() => new VaultAttachmentsViewCell()),
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            if (_tokenService.TokenPremium)
            {
                ListView.Footer = NewTable;
            }

            NoDataLabel = new Label
            {
                Text = AppResources.NoAttachments,
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                Style    = (Style)Application.Current.Resources["text-muted"]
            };

            NoDataStackLayout = new StackLayout
            {
                VerticalOptions = LayoutOptions.Start,
                Spacing         = 0,
                Margin          = new Thickness(0, 40, 0, 0)
            };

            var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async() =>
            {
                if (_lastAction.LastActionWasRecent() || _login == null)
                {
                    return;
                }
                _lastAction = DateTime.UtcNow;


                if (!_canUseAttachments)
                {
                    await ShowUpdateKeyAsync();
                    return;
                }

                if (!_connectivity.IsConnected)
                {
                    AlertNoConnection();
                    return;
                }

                if (_fileBytes == null)
                {
                    await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
                                                                                      AppResources.File), AppResources.Ok);
                    return;
                }

                _userDialogs.ShowLoading(AppResources.Saving, MaskType.Black);
                var saveTask = await _loginService.EncryptAndSaveAttachmentAsync(_login, _fileBytes, FileLabel.Text);

                _userDialogs.HideLoading();

                if (saveTask.Succeeded)
                {
                    _fileBytes     = null;
                    FileLabel.Text = AppResources.NoFileChosen;
                    _userDialogs.Toast(AppResources.AttachementAdded);
                    _googleAnalyticsService.TrackAppEvent("AddedAttachment");
                    await LoadAttachmentsAsync();
                }
                else if (saveTask.Errors.Count() > 0)
                {
                    await _userDialogs.AlertAsync(saveTask.Errors.First().Message, AppResources.AnErrorHasOccurred);
                }
                else
                {
                    await _userDialogs.AlertAsync(AppResources.AnErrorHasOccurred);
                }
            }, ToolbarItemOrder.Default, 0);

            Title   = AppResources.Attachments;
            Content = ListView;

            if (_tokenService.TokenPremium)
            {
                ToolbarItems.Add(saveToolBarItem);
            }

            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
            {
                ListView.RowHeight          = -1;
                NewTable.RowHeight          = -1;
                NewTable.EstimatedRowHeight = 44;
                NewTable.HeightRequest      = 180;
                ListView.BackgroundColor    = Color.Transparent;
                ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
            }
        }
Ejemplo n.º 27
0
 private void Tb_Clicked(object sender, EventArgs e)
 {
     if (item)
     {
         Children.Remove(Children[0]);
         Children.Remove(Children[0]);
         Children.Remove(Children[0]);
         Children.Add(new TimeTable(Color.FromHex("#424242"))
         {
             IconImageSource = "timetable.png"
         });
         Children.Add(new Serv(Color.FromHex("#424242"))
         {
             IconImageSource = "station.png"
         });
         Children.Add(new Settings(Color.FromHex("#424242"))
         {
             IconImageSource = "settings.img"
         });
         item               = false;
         SelectedTabColor   = Color.FromHex("#FFFFFF");
         BarBackgroundColor = Color.FromHex("#424242");
         ((NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#424242");
         ToolbarItems.Remove(ToolbarItems[0]);
         ToolbarItem tb = new ToolbarItem
         {
             Order           = ToolbarItemOrder.Primary,
             IconImageSource = "moon2.png",
         };
         tb.Clicked += Tb_Clicked;
         ToolbarItems.Add(tb);
     }
     else
     {
         Children.Remove(Children[0]);
         Children.Remove(Children[0]);
         Children.Remove(Children[0]);
         Children.Add(new TimeTable(Color.FromHex("#FFFFFF"))
         {
             IconImageSource = "timetable.png"
         });
         Children.Add(new Serv(Color.FromHex("#FFFFFF"))
         {
             IconImageSource = "station.png"
         });
         Children.Add(new Settings(Color.FromHex("#FFFFFF"))
         {
             IconImageSource = "settings.img"
         });
         item               = true;
         SelectedTabColor   = Color.FromHex("#424242");
         BarBackgroundColor = Color.FromHex("#FFFFFF");
         ((NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#F44336");
         ToolbarItems.Remove(ToolbarItems[0]);
         ToolbarItem tb = new ToolbarItem
         {
             Order           = ToolbarItemOrder.Primary,
             IconImageSource = "moon.png",
         };
         tb.Clicked += Tb_Clicked;
         ToolbarItems.Add(tb);
     }
 }
Ejemplo n.º 28
0
        private void Init()
        {
            NameCell = new FormEntryCell(AppResources.Name);

            var table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = false,
                HasUnevenRows   = true,
                Root            = new TableRoot
                {
                    new TableSection(Helpers.GetEmptyTableSectionTitle())
                    {
                        NameCell
                    }
                }
            };

            if (Device.RuntimePlatform == Device.iOS)
            {
                table.RowHeight          = -1;
                table.EstimatedRowHeight = 70;
            }
            else if (Device.RuntimePlatform == Device.Android)
            {
                table.BottomPadding = 50;
            }

            var saveToolBarItem = new ToolbarItem(AppResources.Save, Helpers.ToolbarImage("envelope.png"), async() =>
            {
                if (_lastAction.LastActionWasRecent())
                {
                    return;
                }
                _lastAction = DateTime.UtcNow;

                if (!_connectivity.IsConnected)
                {
                    AlertNoConnection();
                    return;
                }

                if (string.IsNullOrWhiteSpace(NameCell.Entry.Text))
                {
                    await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
                                                                                      AppResources.Name), AppResources.Ok);
                    return;
                }

                var folder = new Folder
                {
                    Name = NameCell.Entry.Text.Encrypt()
                };

                _deviceActionService.ShowLoading(AppResources.Saving);
                var saveResult = await _folderService.SaveAsync(folder);
                _deviceActionService.HideLoading();

                if (saveResult.Succeeded)
                {
                    _deviceActionService.Toast(AppResources.FolderCreated);
                    _googleAnalyticsService.TrackAppEvent("CreatedFolder");
                    await Navigation.PopForDeviceAsync();
                }
                else if (saveResult.Errors.Count() > 0)
                {
                    await DisplayAlert(AppResources.AnErrorHasOccurred, saveResult.Errors.First().Message, AppResources.Ok);
                }
                else
                {
                    await DisplayAlert(null, AppResources.AnErrorHasOccurred, AppResources.Ok);
                }
            }, ToolbarItemOrder.Default, 0);

            Title   = AppResources.AddFolder;
            Content = table;
            ToolbarItems.Add(saveToolBarItem);
            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.UWP)
            {
                ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
            }
        }
Ejemplo n.º 29
0
        public MonthViewPage()
        {
            try
            {
                #region Page
                Title = "Expense Tracker";

                var toolAdd = new ToolbarItem
                {
                    Text = "Add"
                };
                ToolbarItems.Add(toolAdd);
                #endregion

                #region Controls
                listView = new ListView
                {
                    HasUnevenRows          = true,
                    SeparatorVisibility    = SeparatorVisibility.None,
                    IsPullToRefreshEnabled = true,
                    ItemsSource            = observableCollection
                };

                listView.ItemTemplate = new DataTemplate(() =>
                {
                    var lblDate = new Label
                    {
                        TextColor = Colors.Black75,
                        FontSize  = Styles.FontSmall
                    };
                    lblDate.SetBinding(Label.TextProperty, "Date");
                    var lblAmount = new Label
                    {
                        TextColor         = Colors.Blue75,
                        FontSize          = Styles.FontSmall,
                        HorizontalOptions = LayoutOptions.EndAndExpand
                    };
                    lblAmount.SetBinding(Label.TextProperty, "Amount", stringFormat: "{0:F2}");
                    var grid = new Grid
                    {
                        Padding           = 16,
                        ColumnDefinitions =
                        {
                            new ColumnDefinition {
                                Width = new GridLength(3, GridUnitType.Star)
                            },
                            new ColumnDefinition {
                                Width = new GridLength(1, GridUnitType.Auto)
                            },
                        },
                        RowDefinitions =
                        {
                            new RowDefinition {
                                Height = new GridLength(1, GridUnitType.Star)
                            }
                        }
                    };
                    grid.Children.Add(lblDate);
                    grid.Children.Add(lblAmount, 1, 0);

                    return(new ViewCell
                    {
                        View = grid
                    });
                });

                pickerMonth = new Picker
                {
                    IsVisible = false
                };

                pickerYear = new Picker
                {
                    IsVisible = false
                };

                pickerMonth.Items.Add("January");
                pickerMonth.Items.Add("February");
                pickerMonth.Items.Add("March");
                pickerMonth.Items.Add("April");
                pickerMonth.Items.Add("May");
                pickerMonth.Items.Add("June");
                pickerMonth.Items.Add("July");
                pickerMonth.Items.Add("August");
                pickerMonth.Items.Add("September");
                pickerMonth.Items.Add("October");
                pickerMonth.Items.Add("November");
                pickerMonth.Items.Add("December");

                var startYear = DateTime.Today.Year - 10;
                for (int i = startYear; i <= DateTime.Today.Year; i++)
                {
                    pickerYear.Items.Add(i.ToString());
                }

                lblMonth = new Label
                {
                    Text              = "",
                    TextColor         = Colors.Black75,
                    HorizontalOptions = LayoutOptions.Center
                };

                stkMonth = new StackLayout
                {
                    Padding         = 16,
                    BackgroundColor = Colors.Black25,
                    Children        =
                    {
                        lblMonth
                    }
                };

                lblTotal = new Label
                {
                    Text              = "0.00",
                    FontSize          = Styles.FontMedium,
                    TextColor         = Colors.White,
                    HorizontalOptions = LayoutOptions.End
                };

                stkTotalView = new StackLayout
                {
                    Spacing         = 0,
                    Padding         = 16,
                    BackgroundColor = Colors.Primary,
                    Children        =
                    {
                        new Label
                        {
                            Text              = "Total:",
                            FontSize          = Styles.FontSmall,
                            TextColor         = Colors.WhiteSmoke,
                            HorizontalOptions = LayoutOptions.End
                        },
                        lblTotal
                    }
                };

                lblNoExpense = new Label
                {
                    Margin            = new Thickness(0, 60, 0, 0),
                    Text              = "No expenses found",
                    HorizontalOptions = LayoutOptions.Center,
                    VerticalOptions   = LayoutOptions.Center,
                    TextColor         = Colors.Black25,
                    FontSize          = Styles.FontMedium,
                    IsVisible         = false
                };
                #endregion

                #region Container
                Content = new StackLayout
                {
                    Spacing  = 0,
                    Children =
                    {
                        pickerMonth,  pickerYear,
                        stkMonth,
                        lblNoExpense,
                        listView,
                        stkTotalView,
                        new AdControlContainer()
                    }
                };
                #endregion

                #region Load Before Gestures
                pickerMonth.SelectedItem = DateTime.Today.ToString("MMMM");
                pickerYear.SelectedItem  = DateTime.Today.Year.ToString();
                lblMonth.Text            = pickerMonth.SelectedItem.ToString() + ", " + pickerYear.SelectedItem.ToString();
                #endregion

                #region Gestures/Events
                toolAdd.Clicked += (sender, args) =>
                {
                    Navigation.PushAsync(new AddExpensePage(DateTime.Today.Date), true);
                };

                listView.RefreshCommand = new Command(() =>
                {
                    LoadData();
                });

                listView.ItemTapped += async(sender, args) =>
                {
                    listView.SelectedItem = null;

                    var action = await DisplayActionSheet("Action", "Cancel", null, "View", "Delete");

                    if (action == "View")
                    {
                        await Navigation.PushAsync(new DayViewPage(((DayExpense)args.Item).DateTime.Date), true);
                    }
                    else if (action == "Delete")
                    {
                        var deleteAction = await DisplayAlert("Warning", "Are you sure you want to delete all the expenses for this day?", "Yes", "No");

                        if (deleteAction)
                        {
                            data.DeleteByDay(((DayExpense)args.Item).DateTime);
                            LoadData();
                        }
                    }
                };

                stkMonth.GestureRecognizers.Add(new TapGestureRecognizer
                {
                    Command = new Command(() =>
                    {
                        pickerMonth.Focus();
                    }),
                    NumberOfTapsRequired = 1
                });

                pickerMonth.SelectedIndexChanged += (sender, args) =>
                {
                    lblMonth.Text  = pickerMonth.SelectedItem.ToString();
                    lblMonth.Text += ", " + pickerYear.SelectedItem.ToString();
                    pickerYear.Focus();

                    LoadData();
                };

                pickerYear.SelectedIndexChanged += (sender, args) =>
                {
                    lblMonth.Text  = pickerMonth.SelectedItem.ToString();
                    lblMonth.Text += ", " + pickerYear.SelectedItem.ToString();

                    LoadData();
                };
                #endregion
            }
            catch (Exception ex)
            {
                Utils.LogMessage("MonthViewPage()", ex);
            }
        }
Ejemplo n.º 30
0
        private void Init()
        {
            MessagingCenter.Send(Application.Current, "ShowStatusBar", true);

            var padding = Helpers.OnPlatform(
                iOS: new Thickness(15, 20),
                Android: new Thickness(15, 8),
                WinPhone: new Thickness(15, 20));

            PasswordCell = new FormEntryCell(AppResources.MasterPassword, isPassword: true,
                                             useLabelAsPlaceholder: true, imageSource: "lock", containerPadding: padding);
            EmailCell = new FormEntryCell(AppResources.EmailAddress, nextElement: PasswordCell.Entry,
                                          entryKeyboard: Keyboard.Email, useLabelAsPlaceholder: true, imageSource: "envelope",
                                          containerPadding: padding);

            var lastLoginEmail = _settings.GetValueOrDefault(Constants.LastLoginEmail, string.Empty);

            if (!string.IsNullOrWhiteSpace(_email))
            {
                EmailCell.Entry.Text = _email;
            }
            else if (!string.IsNullOrWhiteSpace(lastLoginEmail))
            {
                EmailCell.Entry.Text = lastLoginEmail;
            }

            PasswordCell.Entry.ReturnType = Enums.ReturnType.Go;

            var table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = false,
                HasUnevenRows   = true,
                EnableSelection = true,
                NoFooter        = true,
                //NoHeader = true,
                VerticalOptions = LayoutOptions.Start,
                Root            = new TableRoot
                {
                    new TableSection(" ")
                    {
                        EmailCell,
                        PasswordCell
                    }
                }
            };

            var forgotPasswordButton = new ExtendedButton
            {
                Text            = AppResources.GetPasswordHint,
                Style           = (Style)Application.Current.Resources["btn-primaryAccent"],
                Margin          = new Thickness(15, 0, 15, 25),
                Command         = new Command(async() => await ForgotPasswordAsync()),
                Uppercase       = false,
                BackgroundColor = Color.Transparent
            };

            var layout = new StackLayout
            {
                Children = { table, forgotPasswordButton },
                Spacing  = Helpers.OnPlatform(iOS: 0, Android: 10, WinPhone: 0)
            };

            var scrollView = new ScrollView {
                Content = layout
            };

            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Windows)
            {
                table.RowHeight          = -1;
                table.EstimatedRowHeight = 70;
                ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel, () =>
                {
                    MessagingCenter.Send(Application.Current, "ShowStatusBar", false);
                }));
            }

            var loginToolbarItem = new ToolbarItem(AppResources.LogIn, null, async() =>
            {
                await LogIn();
            }, ToolbarItemOrder.Default, 0);

            ToolbarItems.Add(loginToolbarItem);
            Title   = AppResources.Bitwarden;
            Content = scrollView;
            NavigationPage.SetBackButtonTitle(this, AppResources.LogIn);
        }
Ejemplo n.º 31
0
        public InspectionList()
        {
            Title = "Tom's Inspections";
            NavigationPage.SetHasNavigationBar(this, true);

            activityIndicator                   = new ActivityIndicator();
            activityIndicator.Color             = Color.FromHex("#3693FF");
            activityIndicator.VerticalOptions   = LayoutOptions.Center;
            activityIndicator.HorizontalOptions = LayoutOptions.Center;

            ToolbarItem toolbarItem = new ToolbarItem();

            toolbarItem.Icon = "Contact.png";
            ToolbarItems.Add(toolbarItem);

            newButton = new Button();
            newButton.WidthRequest      = 100;
            newButton.HeightRequest     = 100;
            newButton.CornerRadius      = 50;
            newButton.Text              = "6";
            newButton.BackgroundColor   = Color.FromHex("#C0BF07");
            newButton.HorizontalOptions = LayoutOptions.Start;
            //newButton.Margin = new Thickness(150, 0, 0, 0);
            newButton.FontSize  = 50;
            newButton.TextColor = Color.White;

            Label lblNew = new Label();

            lblNew.Text = "New";
            //lblNew.Margin = new Thickness(185, 0, 0, 0);

            inprogressButton = new Button();
            inprogressButton.WidthRequest      = 100;
            inprogressButton.HeightRequest     = 100;
            inprogressButton.CornerRadius      = 50;
            inprogressButton.Text              = "2";
            inprogressButton.BackgroundColor   = Color.FromHex("#CBCBCB");
            inprogressButton.HorizontalOptions = LayoutOptions.CenterAndExpand;
            inprogressButton.FontSize          = 50;
            inprogressButton.TextColor         = Color.White;

            Label lblInprogress = new Label();

            lblInprogress.Text = "In Progress";
            lblInprogress.HorizontalOptions = LayoutOptions.CenterAndExpand;

            completedButton = new Button();
            completedButton.WidthRequest      = 100;
            completedButton.HeightRequest     = 100;
            completedButton.CornerRadius      = 50;
            completedButton.Text              = "12";
            completedButton.BackgroundColor   = Color.FromHex("#CBCBCB");
            completedButton.HorizontalOptions = LayoutOptions.End;
            //completedButton.Margin = new Thickness(0, 0, 150, 0);
            completedButton.FontSize  = 50;
            completedButton.TextColor = Color.White;

            Label lblCompleted = new Label();

            lblCompleted.Text = "Completed";
            //lblCompleted.Margin= new Thickness(0, 0, 150, 0);
            lblCompleted.HorizontalOptions = LayoutOptions.End;

            syncButton = new Button();
            syncButton.WidthRequest    = 100;
            syncButton.HeightRequest   = 40;
            syncButton.Text            = "Sync All";
            syncButton.BorderColor     = Color.FromHex("#CBCBCB");
            syncButton.BorderWidth     = 1;
            syncButton.BackgroundColor = Color.White;
            syncButton.TextColor       = Color.FromHex("#3693FF");
            //syncButton.Margin = new Thickness(25, 0, 0, 0);
            //syncButton.FontSize = 20;
            syncButton.HorizontalOptions = LayoutOptions.Start;

            deleteList                 = new Button();
            deleteList.Clicked        += DeleteList_Clicked;
            deleteList.WidthRequest    = 100;
            deleteList.HeightRequest   = 40;
            deleteList.Text            = "Delete All";
            deleteList.BorderColor     = Color.FromHex("#CBCBCB");
            deleteList.BorderWidth     = 1;
            deleteList.BackgroundColor = Color.White;
            deleteList.TextColor       = Color.FromHex("#3693FF");
            //deleteList.Padding = new Thickness(25, 0, 0, 0);
            //syncButton.FontSize = 20;
            //deleteList.HorizontalOptions = LayoutOptions.Start;

            refreshList                 = new Button();
            refreshList.Clicked        += RefreshList_Clicked;
            refreshList.WidthRequest    = 100;
            refreshList.HeightRequest   = 40;
            refreshList.Text            = "Get All";
            refreshList.BorderColor     = Color.FromHex("#CBCBCB");
            refreshList.BorderWidth     = 1;
            refreshList.BackgroundColor = Color.White;
            refreshList.TextColor       = Color.FromHex("#3693FF");
            //refreshList.Padding = new Thickness(25, 0, 0, 0);


            inspectionList = new ListView();
            Content        = new StackLayout
            {
                //Padding = 10,
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new StackLayout             {
                        HeightRequest   = 175,
                        BackgroundColor = Color.FromHex("#F8F9F9"),

                        Children =
                        {
                            new StackLayout
                            {
                                Padding           = new Thickness(25, 25, 25, 25),
                                Orientation       = StackOrientation.Horizontal,
                                HorizontalOptions = LayoutOptions.CenterAndExpand,
                                Children          =
                                {
                                    new StackLayout
                                    {
                                        Padding = new Thickness(0, 0, 25, 0),//

                                        Orientation = StackOrientation.Vertical,
                                        //HorizontalOptions = LayoutOptions.Start,
                                        Children =
                                        {
                                            newButton,
                                            new StackLayout
                                            {
                                                VerticalOptions   = LayoutOptions.Center,
                                                HorizontalOptions = LayoutOptions.Center,
                                                Children          =
                                                {
                                                    lblNew
                                                }
                                            }
                                        }
                                    },
                                    new StackLayout
                                    {
                                        Orientation = StackOrientation.Vertical,
                                        //HorizontalOptions = LayoutOptions.CenterAndExpand,
                                        Padding  = new Thickness(25, 0, 25, 0),
                                        Children =
                                        {
                                            inprogressButton,
                                            new StackLayout
                                            {
                                                VerticalOptions   = LayoutOptions.Center,
                                                HorizontalOptions = LayoutOptions.Center,
                                                Children          =
                                                {
                                                    lblInprogress
                                                }
                                            }
                                        }
                                    },
                                    new StackLayout
                                    {
                                        Orientation = StackOrientation.Vertical,
                                        //HorizontalOptions = LayoutOptions.End,
                                        Padding  = new Thickness(25, 0, 0, 0),//
                                        Children =
                                        {
                                            completedButton,
                                            new StackLayout
                                            {
                                                VerticalOptions   = LayoutOptions.Center,
                                                HorizontalOptions = LayoutOptions.Center,
                                                Children          =
                                                {
                                                    lblCompleted
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Padding     = 25,
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            syncButton,
                            deleteList,
                            refreshList
                        }
                    }

                    , inspectionList
                }
            };


            AssessmentService assessmentService         = new AssessmentService();
            List <AssessmentMetadataEntity> assessments = assessmentService.GetListOfAllAssignedAssessmentsFromDevice();
            var customAssessmentCell = new DataTemplate(typeof(CustomInspectionCell));

            //Bind forms
            inspectionList.ItemsSource    = assessments;
            inspectionList.ItemTemplate   = customAssessmentCell;
            inspectionList.ItemSelected  += InspectionList_ItemSelected;
            inspectionList.HeightRequest  = 500;
            inspectionList.RowHeight      = 100;
            inspectionList.SelectionMode  = ListViewSelectionMode.Single;
            inspectionList.SeparatorColor = Color.Gray;
            inspectionList.HasUnevenRows  = false;

            UpdateInspectionCountCircles(assessments);
        }
Ejemplo n.º 32
0
        private void Init()
        {
            NameCell = new FormEntryCell(AppResources.Name);

            var table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = false,
                HasUnevenRows   = true,
                Root            = new TableRoot
                {
                    new TableSection(" ")
                    {
                        NameCell
                    }
                }
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                table.RowHeight          = -1;
                table.EstimatedRowHeight = 70;
            }

            var saveToolBarItem = new ToolbarItem(AppResources.Save, null, async() =>
            {
                if (!_connectivity.IsConnected)
                {
                    AlertNoConnection();
                    return;
                }

                if (string.IsNullOrWhiteSpace(NameCell.Entry.Text))
                {
                    await DisplayAlert(AppResources.AnErrorHasOccurred, string.Format(AppResources.ValidationFieldRequired,
                                                                                      AppResources.Name), AppResources.Ok);
                    return;
                }

                var folder = new Folder
                {
                    Name = NameCell.Entry.Text.Encrypt()
                };

                _userDialogs.ShowLoading(AppResources.Saving, MaskType.Black);
                var saveResult = await _folderService.SaveAsync(folder);

                _userDialogs.HideLoading();

                if (saveResult.Succeeded)
                {
                    await Navigation.PopForDeviceAsync();
                    _userDialogs.Toast(AppResources.FolderCreated);
                    _googleAnalyticsService.TrackAppEvent("CreatedFolder");
                }
                else if (saveResult.Errors.Count() > 0)
                {
                    await _userDialogs.AlertAsync(saveResult.Errors.First().Message, AppResources.AnErrorHasOccurred);
                }
                else
                {
                    await _userDialogs.AlertAsync(AppResources.AnErrorHasOccurred);
                }
            }, ToolbarItemOrder.Default, 0);

            Title   = AppResources.AddFolder;
            Content = table;
            ToolbarItems.Add(saveToolBarItem);
            if (Device.OS == TargetPlatform.iOS)
            {
                ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel));
            }
        }
Ejemplo n.º 33
0
        //SearchBar searchBar;
        //Label resultsLabel;

        public FoodTabbedPage()
        {
            //  List<ResturentItems> ResturentList = new List<ResturentItems>();

            InitializeComponent();
            NavigationPage.SetHasBackButton(this, false);
            /// this.BackgroundImage = "Resources/drawable/background.png";
            this.BackgroundColor = Color.Maroon;
            Children.Add(new TabLoader());


            try
            {
                int         newnumber = 1;
                ToolbarItem cartItem  = new ToolbarItem();
                cartItem.Order = ToolbarItemOrder.Primary;
                cartItem.Text  = "TABLE VIEW";
                // cartItem.Icon = "orderNewThree.png";

                cartItem.Command = new Command(() => Navigation.PushAsync(new JsonTable(newnumber)));
                ToolbarItems.Add(cartItem);

                //SQLiteConnection m;
                //m = DependencyService.Get<ISQLite>().GetConnection();
                //TempTbl mit = new TempTbl();
                //m.Table<TempTbl>();
                //m.DeleteAll<TempTbl>();
            }
            catch (Exception ex)
            {
                // Console.WriteLine("An error occurred: '{0}'", ex);
            }

            //View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("Images/bg.png"));
            //this.ParentView = "background.png";
            // this.View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("your-background.png"));
            //ActivityIndicator ciclenow = new ActivityIndicator();
            //ciclenow.Color = Color.Green;
            //ciclenow.IsRunning = true;
            ActivityIndicator ai = new ActivityIndicator
            {
                Color     = Color.Black,
                IsRunning = true,
            };


            this.IsBusy = true;
            if (CrossConnectivity.Current.IsConnected)
            {
                try
                {
                    GetJSON();
                }
                catch (Exception ex)
                {
                    // Console.WriteLine("An error occurred: '{0}'", ex);
                }
            }

            else
            {
                // write your code if there is no Internet available

                DisplayAlert("NETWORK ERROR", "SYSTEM IS OFFLINE", "Ok");
            }
            //Children.Remove(new JsonDesertNew());
            //var stack = new StackLayout
            //{
            //    Spacing = 20,
            //    Children = {
            //             new Label {Text = "Hello World!"},
            //             new Button {Text = "Click Me!"}
            //                }
            //};

            //ToolbarItem cartItem = new ToolbarItem();
            //cartItem.Order = ToolbarItemOrder.Primary;
            //cartItem.Text = "serch";
            //cartItem.Command = new Command(() => Navigation.PushAsync(new SearchItemsPage()));
            //ToolbarItems.Add(cartItem);

            //// remove below at the time /////////////////////////////////////////////////////////////////////

            //ToolbarItem serch = new ToolbarItem();
            //serch.Order = ToolbarItemOrder.Secondary;
            //serch.Text = "SERCH MORE";
            //serch.Command = new Command(() => Navigation.PushAsync(new SearchItemsPage()));
            //ToolbarItems.Add(serch);
        }
Ejemplo n.º 34
0
        public CardsSampleView()
        {
            var cardsView = new CardsView
            {
                ItemTemplate    = new DataTemplate(() => new DefaultCardItemView()),
                BackgroundColor = Color.Black.MultiplyAlpha(.9)
            };

            AbsoluteLayout.SetLayoutFlags(cardsView, AbsoluteLayoutFlags.All);
            AbsoluteLayout.SetLayoutBounds(cardsView, new Rectangle(0, 0, 1, 1));

            var prevItem = new ToolbarItem
            {
                Text             = "**Prev**",
                IconImageSource  = "prev.png",
                CommandParameter = false
            };

            prevItem.SetBinding(MenuItem.CommandProperty, nameof(CardsSampleViewModel.PanPositionChangedCommand));

            var nextItem = new ToolbarItem
            {
                Text             = "**Next**",
                IconImageSource  = "next.png",
                CommandParameter = true
            };

            nextItem.SetBinding(MenuItem.CommandProperty, nameof(CardsSampleViewModel.PanPositionChangedCommand));

            ToolbarItems.Add(prevItem);
            ToolbarItems.Add(nextItem);

            cardsView.SetBinding(CardsView.ItemsSourceProperty, nameof(CardsSampleViewModel.Items));
            cardsView.SetBinding(CardsView.SelectedIndexProperty, nameof(CardsSampleViewModel.CurrentIndex));

            Title = "Cards View";


            var removeButton = new Button
            {
                Text            = "Remove current",
                FontAttributes  = FontAttributes.Bold,
                TextColor       = Color.Black,
                BackgroundColor = Color.Yellow.MultiplyAlpha(.7),
                Margin          = new Thickness(0, 0, 0, 10)
            };

            removeButton.SetBinding(Button.CommandProperty, nameof(CardsSampleViewModel.RemoveCurrentItemCommand));

            AbsoluteLayout.SetLayoutFlags(removeButton, AbsoluteLayoutFlags.PositionProportional);
            AbsoluteLayout.SetLayoutBounds(removeButton, new Rectangle(.5, 1, 150, 40));



            Content = new AbsoluteLayout()
            {
                Children =
                {
                    cardsView,
                    removeButton
                }
            };

            BindingContext = new CardsSampleViewModel();
        }
Ejemplo n.º 35
0
        public MonthPage()
        {
            InitializeComponent();

            ToolbarItem toolbarItem = new ToolbarItem
            {
                Text = "Logout"
            };

            ToolbarItems.Add(toolbarItem);
            toolbarItem.Clicked += (object sender, EventArgs e) => {
                DataBase.Instance.DeleteAccount();
                Navigation.PushModalAsync(new NavigationPage(new HomePage()));
            };

            var layout = new AbsoluteLayout {
                Padding = new Thickness(5, 10)
            };

            this.Content = layout;

            // add title
            var title = new Label {
                FontSize = 20
            };

            title.FontAttributes = FontAttributes.Bold;
            title.FontSize       = 40;
            title.TranslationX   = 19;
            title.TranslationY   = 40;
            title.Text           = Time.FormattedMonth(Time.CurrentTime.Month);
            title.TextColor      = Color.White;
            layout.Children.Add(title);

            // add date
            Point startPoint = new Point(20, 100);
            float offsetX    = 50;
            float offsetY    = 55;

            int[] days     = { 7, 1, 2, 3, 4, 5, 6 };
            int   dayCount = 0;

            foreach (var day in days)
            {
                var label = new Label {
                    FontSize = 20
                };
                //TODO center
                label.FormattedText     = Time.FormattedDay(day).ToString();
                label.TextColor         = Color.FromHex("#ADD8E6");
                label.FontAttributes    = FontAttributes.Bold;
                label.HorizontalOptions = LayoutOptions.Center;
                label.TranslationX      = startPoint.X + offsetX * dayCount;
                label.TranslationY      = startPoint.Y;
                layout.Children.Add(label);
                dayCount++;
            }

            startPoint.Y += offsetY;
            for (int i = 0; i < 31; i++)
            {
                int date      = i + 1;
                var buttonDay = new Button {
                    FontSize = 20
                };
                buttonDay.Text      = date.ToString();
                buttonDay.TextColor = Color.FromHex("#87CEFA");
                //buttonDay.FontAttributes = FontAttributes.Italic;
                buttonDay.TranslationX = startPoint.X + offsetX * (i % 7);
                buttonDay.TranslationY = startPoint.Y + offsetY * (i / 7);
                layout.Children.Add(buttonDay);
                buttonDay.Clicked += OnButtonDayClicked;
            }

            // add button
            var button = new Button();

            button.Text           = "Add Notes";
            button.FontAttributes = FontAttributes.Italic;
            button.FontSize       = 10;
            button.TextColor      = Color.White;
            button.TranslationX   = 240;
            button.TranslationY   = 50;
            layout.Children.Add(button);
            button.Clicked += OnButtonClicked;
        }
        public void Init()
        {
            Password = new Label
            {
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                Margin   = new Thickness(15, 40, 15, 40),
                HorizontalTextAlignment = TextAlignment.Center,
                FontFamily      = Device.OnPlatform(iOS: "Courier", Android: "monospace", WinPhone: "Courier"),
                LineBreakMode   = LineBreakMode.TailTruncation,
                VerticalOptions = LayoutOptions.Start
            };

            Tgr = new TapGestureRecognizer();
            Password.GestureRecognizers.Add(Tgr);
            Password.SetBinding <PasswordGeneratorPageModel>(Label.TextProperty, m => m.Password);

            SliderCell   = new SliderViewCell(this, _passwordGenerationService, _settings);
            SettingsCell = new ExtendedTextCell {
                Text = AppResources.MoreSettings, ShowDisclousure = true
            };

            var buttonColor = Color.FromHex("3c8dbc");

            RegenerateCell = new ExtendedTextCell {
                Text = AppResources.RegeneratePassword, TextColor = buttonColor
            };
            CopyCell = new ExtendedTextCell {
                Text = AppResources.CopyPassword, TextColor = buttonColor
            };

            var table = new ExtendedTableView
            {
                VerticalOptions = LayoutOptions.Start,
                EnableScrolling = false,
                Intent          = TableIntent.Settings,
                HasUnevenRows   = true,
                NoHeader        = true,
                Root            = new TableRoot
                {
                    new TableSection
                    {
                        RegenerateCell,
                        CopyCell
                    },
                    new TableSection(AppResources.Options)
                    {
                        SliderCell,
                        SettingsCell
                    }
                }
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                table.RowHeight          = -1;
                table.EstimatedRowHeight = 44;
                ToolbarItems.Add(new DismissModalToolBarItem(this,
                                                             _passwordValueAction == null ? AppResources.Close : AppResources.Cancel));
            }

            var stackLayout = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                Children        = { Password, table },
                VerticalOptions = LayoutOptions.FillAndExpand,
                Spacing         = 0
            };

            var scrollView = new ScrollView
            {
                Content         = stackLayout,
                Orientation     = ScrollOrientation.Vertical,
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            if (_passwordValueAction != null)
            {
                var selectToolBarItem = new ToolbarItem(AppResources.Select, null, async() =>
                {
                    if (_fromAutofill)
                    {
                        _googleAnalyticsService.TrackExtensionEvent("SelectedGeneratedPassword");
                    }
                    else
                    {
                        _googleAnalyticsService.TrackAppEvent("SelectedGeneratedPassword");
                    }

                    _passwordValueAction(Password.Text);
                    await Navigation.PopForDeviceAsync();
                }, ToolbarItemOrder.Default, 0);

                ToolbarItems.Add(selectToolBarItem);
            }

            Title          = AppResources.GeneratePassword;
            Content        = scrollView;
            BindingContext = Model;
        }
Ejemplo n.º 37
0
 public static void SetTitleOrContentDescription(this IMenuItem Control, ToolbarItem Element)
 {
     SetTitleOrContentDescription(Control, (MenuItem)Element);
 }
Ejemplo n.º 38
0
        public Lab7BListPageCS()
        {
            Title = "Lab7B";

            var toolbarItem = new ToolbarItem
            {
                Text            = "+",
                IconImageSource = Device.RuntimePlatform == Device.iOS ? null : "plus.png"
            };

            toolbarItem.Clicked += async(sender, e) =>
            {
                await Navigation.PushAsync(new Lab7BItemPageCS
                {
                    BindingContext = new Lab7BItem()
                });
            };
            ToolbarItems.Add(toolbarItem);

            listView = new ListView
            {
                Margin       = new Thickness(20),
                ItemTemplate = new DataTemplate(() =>
                {
                    var label = new Label
                    {
                        VerticalTextAlignment = TextAlignment.Center,
                        HorizontalOptions     = LayoutOptions.StartAndExpand
                    };
                    label.SetBinding(Label.TextProperty, "Name");

                    var tick = new Image
                    {
                        Source            = ImageSource.FromFile("check.png"),
                        HorizontalOptions = LayoutOptions.End
                    };
                    tick.SetBinding(VisualElement.IsVisibleProperty, "Done");

                    var stackLayout = new StackLayout
                    {
                        Margin            = new Thickness(20, 0, 0, 0),
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Children          = { label, tick }
                    };

                    return(new ViewCell {
                        View = stackLayout
                    });
                })
            };
            listView.ItemSelected += async(sender, e) =>
            {
                if (e.SelectedItem != null)
                {
                    await Navigation.PushAsync(new Lab7BItemPageCS
                    {
                        BindingContext = e.SelectedItem as Lab7BItem
                    });
                }
            };

            Content = listView;
        }
Ejemplo n.º 39
0
        public Feedback(Job job, JobSeeker jobseeker, Enterprise enterprise, Submission submission)
        {
            this.job        = job;
            this.jobseeker  = jobseeker;
            this.enterprise = enterprise;
            this.submission = submission;

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                var a = new ToolbarItem
                {
                    Text = "back",
                };
                a.Clicked += BackPage;

                ToolbarItems.Add(a);
                break;

            default:
                this.Padding = new Thickness(10, 0, 10, 5);
                break;
            }

            DisplayAlert("Message", "Please complete the feedback form in order for you to review back your application.", "Cancel");

            Label hearderLbl = new Label
            {
                Text = "Feedback",
                Font = Font.SystemFontOfSize(30),
                HorizontalOptions = LayoutOptions.Center,
            };

            Label commentLbl = new Label
            {
                Text = "Comment",
            };

            commentTxt = new Editor
            {
                HeightRequest     = 200,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            Label ratelbl = new Label
            {
                Text = "Rating",
            };

            slider = new Slider
            {
                Minimum = 0,
                Maximum = 5,
            };
            slider.ValueChanged += OnSliderValueChanged;

            label = new Label
            {
                Text = "Slider value is 0",
                HorizontalOptions = LayoutOptions.Center,
                //VerticalOptions = LayoutOptions.CenterAndExpand
            };

            // Accomodate iPhone status bar.
            this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);


            Button Savebtn = new Button()
            {
                //BackgroundColor = existingBook != null ? Color.Gray : Color.Green,
                TextColor       = Color.White,
                Text            = "Save",
                BorderRadius    = 0,              // corner of the button
                HeightRequest   = 50,
                VerticalOptions = LayoutOptions.EndAndExpand,
            };

            Savebtn.Clicked += OnSave;

            Content = new StackLayout
            {
                Spacing  = 0,                //no idea
                Children = { hearderLbl, commentLbl, commentTxt, ratelbl, slider, label, Savebtn },
            };
        }
Ejemplo n.º 40
0
 private void ToolbarItemTapped(IToolbarView toolbarView, ToolbarItem toolbarItem)
 {
     if (toolbarItem.HasChildren)
     {
         PushToolbar(toolbarItem, toolbarItem.AnimatesNavigation, null);
     }
     else if (toolbarItem.IsBackButton)
     {
         Pop(toolbarItem.AnimatesNavigation);
     }
     if (toolbarItem.Tapped != null) toolbarItem.Tapped(this, toolbarItem);
 }
Ejemplo n.º 41
0
        private void Init()
        {
            var padding = Device.OnPlatform(
                iOS: new Thickness(15, 20),
                Android: new Thickness(15, 8),
                WinPhone: new Thickness(15, 20));

            EmailCell = new FormEntryCell(AppResources.EmailAddress, entryKeyboard: Keyboard.Email,
                                          useLabelAsPlaceholder: true, imageSource: "envelope", containerPadding: padding);

            EmailCell.Entry.ReturnType = Enums.ReturnType.Go;
            EmailCell.Entry.Completed += Entry_Completed;

            var table = new ExtendedTableView
            {
                Intent          = TableIntent.Settings,
                EnableScrolling = false,
                HasUnevenRows   = true,
                EnableSelection = true,
                NoFooter        = true,
                VerticalOptions = LayoutOptions.Start,
                Root            = new TableRoot
                {
                    new TableSection()
                    {
                        EmailCell
                    }
                }
            };

            var hintLabel = new Label
            {
                Text          = "Enter your account email address to receive your master password hint.",
                LineBreakMode = LineBreakMode.WordWrap,
                FontSize      = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                Style         = (Style)Application.Current.Resources["text-muted"],
                Margin        = new Thickness(15, (this.IsLandscape() ? 5 : 0), 15, 25)
            };

            var layout = new StackLayout
            {
                Children = { table, hintLabel },
                Spacing  = 0
            };

            var scrollView = new ScrollView {
                Content = layout
            };

            if (Device.OS == TargetPlatform.iOS)
            {
                table.RowHeight          = -1;
                table.EstimatedRowHeight = 70;
            }

            var submitToolbarItem = new ToolbarItem("Submit", null, async() =>
            {
                await SubmitAsync();
            }, ToolbarItemOrder.Default, 0);

            ToolbarItems.Add(submitToolbarItem);
            Title   = "Password Hint";
            Content = scrollView;
        }
Ejemplo n.º 42
0
        /// <summary>
        /// Adds an item in the Editing Toolbar.
        /// </summary>
        /// <param name="item">The item to add.</param>
        /// <param name="text">The text of the item.</param>
        /// <param name="value">The value of the item.</param>
        /// <exception cref="ArgumentNullException">If <b>text</b> or <b>value</b> are <c>null</c>.</exception>
        /// <exception cref="ArgumentException">If <b>text</b> or <b>value</b> are empty, or if they contain single or double quotes, 
        /// or if <b>value</b> does not contain a pipe when <b>item</b> is <b>SpecialTagWrap</b>.</exception>
        public void AddToolbarItem(ToolbarItem item, string text, string value)
        {
            if(text == null) throw new ArgumentNullException("text");
            if(text.Length == 0) throw new ArgumentException("Text cannot be empty", "text");
            if(text.Contains("\"") || text.Contains("'")) throw new ArgumentException("Text cannot contain single or double quotes", "text");
            if(value == null) throw new ArgumentNullException("value");
            if(value.Length == 0) throw new ArgumentException("Value cannot be empty", "value");
            if(value.Contains("\"") || value.Contains("'")) throw new ArgumentException("Value cannot contain single or double quotes", "value");

            if(item == ToolbarItem.SpecialTagWrap && !value.Contains("|")) throw new ArgumentException("Invalid value for a SpecialTagWrap (pipe not found)", "value");

            lock(customSpecialTags) {
                if(customSpecialTags.ContainsKey(text)) {
                    customSpecialTags[text].Value = value;
                    customSpecialTags[text].Item = item;
                }
                else customSpecialTags.Add(text, new CustomToolbarItem(item, text, value));
            }
        }
Ejemplo n.º 43
0
        internal static void UpdateMenuItemIcon(this IMauiContext mauiContext, IMenuItem menuItem, ToolbarItem toolBarItem, Color?tintColor)
        {
            toolBarItem.IconImageSource.LoadImage(mauiContext, result =>
            {
                var baseDrawable = result?.Value;
                if (menuItem == null || !menuItem.IsAlive())
                {
                    return;
                }

                if (baseDrawable != null)
                {
                    using (var constant = baseDrawable.GetConstantState())
                        using (var newDrawable = constant !.NewDrawable())
                            using (var iconDrawable = newDrawable.Mutate())
                            {
                                if (tintColor != null)
                                {
                                    iconDrawable.SetColorFilter(tintColor.ToPlatform(Colors.White), FilterMode.SrcAtop);
                                }

                                if (!menuItem.IsEnabled)
                                {
                                    iconDrawable.Mutate().SetAlpha(DefaultDisabledToolbarAlpha);
                                }

                                menuItem.SetIcon(iconDrawable);
                            }
                }
Ejemplo n.º 44
0
 private UIView CreateToolbarView(ToolbarItem item)
 {
     Type itemViewType;
     if (!ItemMappings.TryGetValue(item.GetType(), out itemViewType))
     {
         throw new InvalidOperationException(String.Format("Toolbar item type {0} has no matching view registration", item.GetType().Name));
     }
     UIView view = (UIView)Activator.CreateInstance(itemViewType, item);
     IToolbarView toolbarView = view as IToolbarView;
     if (toolbarView != null)
     {
         toolbarView.ToolbarItemTapped += ToolbarItemTapped;
     }
     return view;
 }
        protected override void UpdateMenuItemIcon(Context context, IMenuItem menuItem, ToolbarItem toolBarItem)
        {
            if (toolBarItem.Text == "BAD")
            {
                toolBarItem = new ToolbarItem
                {
                    Text            = "OK",
                    IconImageSource = ImageSource.FromFile("heart.xml"),
                    Order           = toolBarItem.Order,
                    Priority        = toolBarItem.Priority
                };

                if (toolBarItem.IconImageSource is FileImageSource fileImageSource)
                {
                    var name = Path.GetFileNameWithoutExtension(fileImageSource.File);
                    var id   = Xamarin.Forms.Platform.Android.ResourceManager.GetDrawableByName(name);
                    if (id != 0)
                    {
                        if ((int)Build.VERSION.SdkInt >= 21)
                        {
                            var drawable = context.GetDrawable(id);
                            menuItem.SetIcon(drawable);
                        }
                        else
                        {
                            var drawable = Context.GetDrawable(name);
                            menuItem.SetIcon(drawable);
                        }
                        AMenuItemCompat.SetContentDescription(menuItem, new Java.Lang.String("HEART"));
                        return;
                    }
                }
            }

            base.UpdateMenuItemIcon(context, menuItem, toolBarItem);
        }
Ejemplo n.º 46
0
		public async Task PopAfterTrackingStarted ()
		{
			var tracker = new ToolbarTracker ();

			var toolbarItem1 = new ToolbarItem ("Foo", "Foo.png", () => { });
			var toolbarItem2 = new ToolbarItem ("Foo", "Foo.png", () => { });

			var page = new NavigationPage (new ContentPage ()) {
				ToolbarItems = {
					toolbarItem1
				}
			};

			var firstPage = new ContentPage {
				ToolbarItems = { toolbarItem2 }
			};

			tracker.Target = page;

			await page.Navigation.PushAsync (firstPage);

			Assert.True (tracker.ToolbarItems.Contains (toolbarItem1));
			Assert.True (tracker.ToolbarItems.Contains (toolbarItem2));

			await page.Navigation.PopAsync ();

			Assert.True (tracker.ToolbarItems.Contains (toolbarItem1));
			Assert.False (tracker.ToolbarItems.Contains (toolbarItem2));
		}
        private void Menu()
        {
            if (Model.IsEditMode)
            {
                if (searchbutton is ToolbarItem)
                {
                    ToolbarItems.Remove(searchbutton);
                }

                if (udcsbutton is ToolbarItem)
                {
                    ToolbarItems.Remove(udcsbutton);
                }

                if (addbutton is null)
                {
                    addbutton = new ToolbarItem()
                    {
                        Order    = ToolbarItemOrder.Primary,
                        Priority = 10,
                        Text     = AppResources.RackSchemePage_Toolbar_New,
                        Icon     = new FileImageSource()
                    };
                    addbutton.Icon.File = Global.GetPlatformPath("ic_action_add_circle.png");
                    addbutton.SetBinding(MenuItem.CommandProperty, new Binding("NewRackCommand"));
                }
                ToolbarItems.Add(addbutton);

                if (removebutton is null)
                {
                    removebutton = new ToolbarItem()
                    {
                        Order    = ToolbarItemOrder.Primary,
                        Priority = 20,
                        Text     = AppResources.LocationsSchemePage_Toolbar_Delete,
                        Icon     = new FileImageSource()
                    };
                    removebutton.Icon.File = Global.GetPlatformPath("ic_action_remove_circle.png");
                    removebutton.SetBinding(MenuItem.CommandProperty, new Binding("DeleteRackCommand"));
                    removebutton.SetBinding(MenuItem.CommandParameterProperty, new Binding("SelectedRackViewModel"));
                }
                ToolbarItems.Add(removebutton);


                if (editbutton is null)
                {
                    editbutton = new ToolbarItem()
                    {
                        Order    = ToolbarItemOrder.Primary,
                        Priority = 20,
                        Text     = AppResources.LocationsSchemePage_Toolbar_Edit,
                        Icon     = new FileImageSource()
                    };
                    editbutton.Icon.File = Global.GetPlatformPath("ic_action_create.png");
                    editbutton.SetBinding(MenuItem.CommandProperty, new Binding("EditRackCommand"));
                    editbutton.SetBinding(MenuItem.CommandParameterProperty, new Binding("SelectedRackViewModel"));
                }
                ToolbarItems.Add(editbutton);

                if (listbutton is null)
                {
                    listbutton = new ToolbarItem()
                    {
                        Order    = ToolbarItemOrder.Primary,
                        Priority = 30,
                        Text     = AppResources.RackSchemePage_Toolbar_List,
                        Icon     = new FileImageSource()
                    };
                    listbutton.Icon.File = Global.GetPlatformPath("ic_action_dehaze.png");
                    listbutton.SetBinding(MenuItem.CommandProperty, new Binding("RackListCommand"));
                }
                ToolbarItems.Add(listbutton);
            }
            else
            {
                if (addbutton is ToolbarItem)
                {
                    ToolbarItems.Remove(addbutton);
                }

                if (removebutton is ToolbarItem)
                {
                    ToolbarItems.Remove(removebutton);
                }

                if (editbutton is ToolbarItem)
                {
                    ToolbarItems.Remove(editbutton);
                }

                if (listbutton is ToolbarItem)
                {
                    ToolbarItems.Remove(listbutton);
                }

                if (searchbutton is null)
                {
                    searchbutton = new ToolbarItem()
                    {
                        Order    = ToolbarItemOrder.Primary,
                        Priority = 30,
                        Text     = AppResources.RackSchemePage_Toolbar_Search,
                        Icon     = new FileImageSource()
                    };
                    searchbutton.Icon.File = Global.GetPlatformPath("ic_action_search.png");
                    searchbutton.Clicked  += ToolbarItem_Search;
                }
                ToolbarItems.Add(searchbutton);

                if (udcsbutton is null)
                {
                    udcsbutton = new ToolbarItem()
                    {
                        Order    = ToolbarItemOrder.Primary,
                        Priority = 40,
                        Text     = AppResources.RackSchemePage_Toolbar_UDSF,
                        Icon     = new FileImageSource()
                    };
                    udcsbutton.Icon.File = Global.GetPlatformPath("ic_action_widgets.png");
                    udcsbutton.Clicked  += ToolbarItem_UDS;
                }
                ToolbarItems.Add(udcsbutton);
            }
        }
Ejemplo n.º 48
0
        public ContactDetailPage(ContactModel selectedContact, bool isNewContact)
        {
            _isNewContact     = isNewContact;
            ViewModel.Contact = selectedContact;

            var phoneNumberDataEntry = new ContactDetailEntry
            {
                ReturnType    = ReturnType.Go,
                AutomationId  = AutomationIdConstants.PhoneNumberEntry,
                ReturnCommand = new Command(Unfocus)
            };

            phoneNumberDataEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.PhoneNumberText));

            var lastNameDataEntry = new ContactDetailEntry
            {
                ReturnType    = ReturnType.Next,
                ReturnCommand = new Command(() => phoneNumberDataEntry.Focus()),
                AutomationId  = AutomationIdConstants.LastNameEntry
            };

            lastNameDataEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.LastNameText));

            var firstNameDataEntry = new ContactDetailEntry
            {
                ReturnType    = ReturnType.Next,
                ReturnCommand = new Command(() => lastNameDataEntry.Focus()),
                AutomationId  = AutomationIdConstants.FirstNameEntry
            };

            firstNameDataEntry.SetBinding(Entry.TextProperty, nameof(ViewModel.FirstNameText));

            var phoneNumberTextLabel = new ContactDetailLabel {
                Text = "Phone Number"
            };
            var lastNameTextLabel = new ContactDetailLabel {
                Text = "Last Name"
            };
            var firstNameTextLabel = new ContactDetailLabel {
                Text = "First Name"
            };

            _saveToobarItem = new ToolbarItem
            {
                Text             = "Save",
                Priority         = 0,
                AutomationId     = AutomationIdConstants.SaveContactButton,
                CommandParameter = _isNewContact
            };
            _saveToobarItem.SetBinding(MenuItem.CommandProperty, nameof(ViewModel.SaveButtonTappedCommand));

            _cancelToolbarItem = new ToolbarItem
            {
                Text         = "Cancel",
                Priority     = 1,
                AutomationId = AutomationIdConstants.CancelContactButton
            };

            ToolbarItems.Add(_saveToobarItem);

            switch (isNewContact)
            {
            case true:
                ToolbarItems.Add(_cancelToolbarItem);
                break;
            }

            Title = PageTitleConstants.ContactDetailsPage;

            Padding = new Thickness(20, 0, 20, 0);

            Content = new StackLayout
            {
                Margin   = new Thickness(0, 10, 0, 0),
                Children =
                {
                    firstNameTextLabel,
                    firstNameDataEntry,
                    lastNameTextLabel,
                    lastNameDataEntry,
                    phoneNumberTextLabel,
                    phoneNumberDataEntry
                }
            };
        }
Ejemplo n.º 49
0
		static Page CreateDetailPage(string text)
		{
			var page = new ContentPage {
				Title = text,
				Content = new StackLayout {
					Children = {
						new Label { 
							Text = text,
							VerticalOptions = LayoutOptions.CenterAndExpand,
							HorizontalOptions = LayoutOptions.CenterAndExpand,
						}
					}
				}
			};

			var tbiBank = new ToolbarItem { Command = new Command (() => { }), Icon = "bank.png" };
			var tbiCalc = new ToolbarItem { Command = new Command (() => { }), Icon = "calculator.png" };

			page.ToolbarItems.Add (tbiBank);
			page.ToolbarItems.Add (tbiCalc);

			return new NavigationPage (page);
		}
        public NotePage(Note note, bool isNoteEdit = false)
        {
            // Initialize Note object
            this.note       = note;
            this.isNoteEdit = isNoteEdit;
            Title           = isNoteEdit ? "Edit Note" : "New Note";

            // Create Entry and Editor views.
            Entry entry = new Entry
            {
                Placeholder = "Title (optional)"
            };

            Editor editor = new Editor
            {
                Keyboard        = Keyboard.Create(KeyboardFlags.All),
                BackgroundColor = Device.OnPlatform(Color.Default,
                                                    Color.Default,
                                                    Color.White),
                VerticalOptions = LayoutOptions.FillAndExpand
            };

            // Set data bindings.
            this.BindingContext = note;
            entry.SetBinding(Entry.TextProperty, "Title");
            editor.SetBinding(Editor.TextProperty, "Text");

            // Assemble page.
            StackLayout stackLayout = new StackLayout
            {
                Children =
                {
                    new Label {
                        Text = "Title:"
                    },
                    entry,
                    new Label {
                        Text = "Note:"
                    },
                    editor,
                }
            };

            if (isNoteEdit)
            {
                // Cancel toolbar item.
                ToolbarItem cancelItem = new ToolbarItem
                {
                    Name = "Cancel",
                    Icon = Device.OnPlatform("cancel.png",
                                             "ic_action_cancel.png",
                                             "Images/cancel.png"),
                    Order = ToolbarItemOrder.Primary
                };

                cancelItem.Activated += async(sender, args) =>
                {
                    bool confirm = await this.DisplayAlert("Note Taker",
                                                           "Cancel note edit?",
                                                           "Yes", "No");

                    if (confirm)
                    {
                        // Reload note.
                        await note.LoadAsync();

                        // Return to home page.
                        await this.Navigation.PopAsync();
                    }
                };

                this.ToolbarItems.Add(cancelItem);

                // Delete toolbar item.
                ToolbarItem deleteItem = new ToolbarItem
                {
                    Name = "Delete",
                    Icon = Device.OnPlatform("discard.png",
                                             "ic_action_discard.png",
                                             "Images/delete.png"),
                    Order = ToolbarItemOrder.Primary
                };

                deleteItem.Activated += async(sender, args) =>
                {
                    bool confirm = await this.DisplayAlert("Note Taker",
                                                           "Delete this note?",
                                                           "Yes", "No");

                    if (confirm)
                    {
                        // Delete Note file and remove from collection.
                        await note.DeleteAsync();

                        App.NoteFolder.Notes.Remove(note);

                        // Return to home page.
                        await this.Navigation.PopAsync();
                    }
                };

                this.ToolbarItems.Add(deleteItem);
            }

            this.Content = stackLayout;
        }
Ejemplo n.º 51
0
 /// <summary>
 /// Initializes a new instance of the <b>ToolbarItem</b> class.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="text">The text.</param>
 /// <param name="value">The value.</param>
 public CustomToolbarItem(ToolbarItem item, string text, string value)
 {
     this.item = item;
     this.text = text;
     this.value = value;
 }
Ejemplo n.º 52
0
			public SecondaryToolbarItem(ToolbarItem item) : base(new SecondaryToolbarItemContent())
			{
				_item = item;
				UpdateText();
				UpdateIcon();
				UpdateIsEnabled();

				((SecondaryToolbarItemContent)CustomView).TouchUpInside += (sender, e) => item.Activate();
				item.PropertyChanged += OnPropertyChanged;

				if (item != null && !string.IsNullOrEmpty(item.AutomationId))
					AccessibilityIdentifier = item.AutomationId;
			}