コード例 #1
0
 private void ShowSettingsView()
 {
     ToolbarItems.Remove(sampleListToolbarItem);
     IsPropertyViewVisible = true;
     Content          = propertyLayout;
     toolbarItem.Text = "Apply";
     toolbarItem.Icon = "Apply.png";
     HideSampleList();
 }
コード例 #2
0
ファイル: PopupHomePage.cs プロジェクト: TMTCUHD/PerfectPopup
        public HomePage(string title)
        {
            BackgroundColor = Color.Gray.WithLuminosity(.9);
            Title = title;
            Padding = 0;
            PopupButton = new ToolbarItem
            {
                Text = "Show Popup",
                Priority = 0
            };

            ToolbarItems.Add(PopupButton);
            PopupButton.Clicked += ((object sender, EventArgs e) =>
            {
                if (!PopupContent.PopupVisible)
                {
                    #region popup content

                    //optional remove popup toolbaritem from navigation bar
                    ToolbarItems.Remove(PopupButton);

                    TableRoot = new TableRoot();
                    TableView = new TableView(TableRoot)
                    {
                        Intent = TableIntent.Data,
                        HasUnevenRows = false
                    };
                    TableSection = new TableSection("");
                    TableRoot.Add(TableSection);
                    for (var i = 0; i < 20; i++)
                    {
                        TableSection.Add(new SwitchCell { Text = "Switch Cell #" + i });
                    }

                    //scale the size of the modal popup min=.25 max=1 default=.80 optional title
                    //if the size=1 the dialog will fill the content area like a sheet window

                    PopupContent.ShowPopup(TableView, 1, modal: true, title: "Perfect Popup ");
                    foreach (var cell1 in TableSection)
                    {
                        var cell = (SwitchCell)cell1;
                        cell.OnChanged += ((cellsender, cellevent) =>
                        {
                            PopupContent.PopupChanged = true;

                        });
                    }

                    #endregion
                }
                else
                {
                    PopupContent.DismisPopup();
                }
            });
        }
コード例 #3
0
ファイル: ViewPage.xaml.cs プロジェクト: phaufe/mobile
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            _broadcasterService.Subscribe(nameof(ViewPage), (message) =>
            {
                if (message.Command == "syncCompleted")
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        var data = message.Data as Dictionary <string, object>;
                        if (data.ContainsKey("successfully"))
                        {
                            var success = data["successfully"] as bool?;
                            if (success.HasValue && success.Value)
                            {
                                var task = _vm.LoadAsync();
                            }
                        }
                    });
                }
            });
            await LoadOnAppearedAsync(_scrollView, true, async() =>
            {
                var success = await _vm.LoadAsync();
                if (!success)
                {
                    await Navigation.PopModalAsync();
                }
            }, _mainContent);

            if (Device.RuntimePlatform == Device.Android)
            {
                if (_vm.Cipher.OrganizationId == null)
                {
                    if (ToolbarItems.Contains(_collectionsItem))
                    {
                        ToolbarItems.Remove(_collectionsItem);
                    }
                    if (!ToolbarItems.Contains(_shareItem))
                    {
                        ToolbarItems.Insert(1, _shareItem);
                    }
                }
                else
                {
                    if (ToolbarItems.Contains(_shareItem))
                    {
                        ToolbarItems.Remove(_shareItem);
                    }
                    if (!ToolbarItems.Contains(_collectionsItem))
                    {
                        ToolbarItems.Insert(1, _collectionsItem);
                    }
                }
            }
        }
コード例 #4
0
 private void AdjustToolbar()
 {
     _saveItem.IsEnabled = _vm.SendEnabled;
     if (!_vm.SendEnabled && _vm.EditMode && Device.RuntimePlatform == Device.Android)
     {
         ToolbarItems.Remove(_removePassword);
         ToolbarItems.Remove(_copyLink);
         ToolbarItems.Remove(_shareLink);
     }
 }
コード例 #5
0
        public ContactListTabPage()
        {
            InitializeComponent();

            if (Device.RuntimePlatform == Device.Android)
            {
                ToolbarItems.Remove(btFilter);
                imgFilter.IsVisible = true;
            }
        }
コード例 #6
0
        internal void SwitchFloatingTools()
        {
            var createAction = this.FindByName <ToolbarItem>("CreateAction");

            if (createAction != null)
            {
                ToolbarItems.Remove(createAction);
            }
            MainList.EnableCreateFloatingButton(createAction.Command);
        }
コード例 #7
0
 private void DecoUpdate()
 {
     if (!Sauvegarde.IsConnected())
     {
         ToolbarItems.Remove(ButtonDeco);
     }
     else if (!ToolbarItems.Contains(ButtonDeco))
     {
         ToolbarItems.Add(ButtonDeco);
     }
 }
コード例 #8
0
        public HomePage()
        {
            InitializeComponent();

            this.mainScrollView.Scrolled += ScrollView_Scrolled;

            if (Device.OS == TargetPlatform.Android || Device.OS == TargetPlatform.Windows)
            {
                ToolbarItems.Remove(ShowCustomRideToolbarItem);
            }
        }
コード例 #9
0
 private void ErreursUpdate()
 {
     if (Equipe.Errors.Count == 0)
     {
         ToolbarItems.Remove(Erreurs);
     }
     else if (!ToolbarItems.Contains(Erreurs))
     {
         ToolbarItems.Add(Erreurs);
     }
 }
コード例 #10
0
 public void MakeOptionsVisible()
 {
     if (mode == GalleryMode.Normal)
     {
         ToolbarItems.Remove(deleteOption);
     }
     else if (mode == GalleryMode.Selection)
     {
         ToolbarItems.Add(deleteOption);
     }
 }
コード例 #11
0
        public LunchLocationsPage()
        {
            InitializeComponent();

            this.Map.MoveToRegion(MapSpan.FromCenterAndRadius(
                                      new Position(44.523411, -89.583897),
                                      Distance.FromMiles(0.25)));

            ToolbarItem showList = null;
            ToolbarItem showMap  = null;

            showList = new ToolbarItem("Show List", "ic_view_list.png", () =>
            {
                ListViewLocations.IsVisible = true;
                MapWrapper.IsVisible        = false;

                ToolbarItems.Remove(showList);
                ToolbarItems.Add(showMap);
            });

            showMap = new ToolbarItem("Show Map", "ic_map.png", () =>
            {
                ListViewLocations.IsVisible = false;
                MapWrapper.IsVisible        = true;

                ToolbarItems.Remove(showMap);
                ToolbarItems.Add(showList);
            });

            ToolbarItems.Add(showMap);

            BindingContext = new LunchLocationsViewModel(this.Navigation);

            ListViewLocations.ItemTapped   += (sender, e) => ListViewLocations.SelectedItem = null;
            ListViewLocations.ItemSelected += (sender, e) =>
            {
                var ev = ListViewLocations.SelectedItem as LunchLocation;
                if (ev == null)
                {
                    return;
                }

                ShowDetail(ev);

                ListViewLocations.SelectedItem = null;
            };

            MapBehavior.ShowDetailCommand = new Command <ILocationViewModel>((x) =>
            {
                var ev = (x as LunchLocationsViewModel.LunchLocationPinViewModel);

                ShowDetail(ev.Location);
            });
        }
コード例 #12
0
ファイル: LoginPage.xaml.cs プロジェクト: turlodales/mobile
        public LoginPage(string email = null, AppOptions appOptions = null)
        {
            _appOptions = appOptions;
            InitializeComponent();
            _vm      = BindingContext as LoginPageViewModel;
            _vm.Page = this;
            _vm.StartTwoFactorAction     = () => Device.BeginInvokeOnMainThread(async() => await StartTwoFactorAsync());
            _vm.LogInSuccessAction       = () => Device.BeginInvokeOnMainThread(async() => await LogInSuccessAsync());
            _vm.UpdateTempPasswordAction =
                () => Device.BeginInvokeOnMainThread(async() => await UpdateTempPasswordAsync());
            _vm.CloseAction = async() =>
            {
                await _accountListOverlay.HideAsync();

                await Navigation.PopModalAsync();
            };
            if (!string.IsNullOrWhiteSpace(email))
            {
                _email.IsEnabled = false;
            }
            else
            {
                _vm.ShowCancelButton = true;
            }
            _vm.Email           = email;
            MasterPasswordEntry = _masterPassword;

            _email.ReturnType    = ReturnType.Next;
            _email.ReturnCommand = new Command(() => _masterPassword.Focus());

            if (Device.RuntimePlatform == Device.iOS)
            {
                ToolbarItems.Add(_moreItem);
            }
            else
            {
                ToolbarItems.Add(_getPasswordHint);
            }

            if (Device.RuntimePlatform == Device.Android && !_email.IsEnabled)
            {
                ToolbarItems.Add(_removeAccount);
            }

            if (_appOptions?.IosExtension ?? false)
            {
                _vm.ShowCancelButton = true;
            }

            if (_appOptions?.HideAccountSwitcher ?? false)
            {
                ToolbarItems.Remove(_accountAvatar);
            }
        }
コード例 #13
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            await viewModel.RefreshAsync();

            // Hide controls if photo is not owned by current user
            if (!viewModel.IsCurrentUsersPhoto)
            {
                ToolbarItems.Remove(DeleteToolbarItem);
                ToolbarItems.Remove(SetAsProfilePictureToolbarItem);
            }
        }
コード例 #14
0
        public FeaturePage()
        {
            InitializeComponent();

            //TODO: Populate the Settings.Role from the Login Response from the service and then remove the below block
            //Remove for other users than admin
            if (Settings.Role.ToLower() != "admin")
            {
                ToolbarItem AddUserToolbarItem = ToolbarItems.First(i => i.Name.Equals("AddUserToolbarItem"));
                ToolbarItems.Remove(AddUserToolbarItem);
            }
        }
コード例 #15
0
        public ContributionFormPage(IAnalyticsService analyticsService)
            : base(analyticsService)
        {
            InitializeComponent();

            if (Device.RuntimePlatform == Device.Android &&
                ToolbarItems.Any(x => x.Priority < 0))
            {
                var toolbarItems = ToolbarItems.FirstOrDefault(x => x.Priority < 0);
                ToolbarItems.Remove(toolbarItems);
            }
        }
コード例 #16
0
ファイル: GeneratorPage.xaml.cs プロジェクト: kiranvsr/mobile
 public GeneratorPage(bool fromTabPage, Action <string> selectAction = null)
 {
     InitializeComponent();
     _vm           = BindingContext as GeneratorPageViewModel;
     _vm.Page      = this;
     _fromTabPage  = fromTabPage;
     _selectAction = selectAction;
     if (selectAction == null)
     {
         ToolbarItems.Remove(_selectItem);
     }
 }
コード例 #17
0
 private void UpdateAlert(bool active, Item item)
 {
     ItemsEnabled[item] = active;
     if (active)
     {
         RefreshToolbar();
     }
     else
     {
         ToolbarItems.Remove(AllToolbarItems[item]);
     }
 }
コード例 #18
0
 public void HideToolAdd(bool show)
 {
     if (show && !ToolbarItems.Contains(_toolDel))
     {
         ToolbarItems.Insert(1, _toolDel);
         //Device.BeginInvokeOnMainThread(() => { ToolbarItems.Insert(0, _toolDel); });
     }
     else if (!show && ToolbarItems.Contains(_toolDel))
     {
         ToolbarItems.Remove(_toolDel);
     }
 }
コード例 #19
0
        private async void GetPermissionsUWP()
        {
            Xamarin.Essentials.Location location = await InternalGetLocation();

            if (location != null)
            {
                if (requestLocationItem != null)
                {
                    ToolbarItems.Remove(requestLocationItem);
                    (mainGrid.Children[0] as StackLayout).Children.Remove(lblLocError);
                    IsBusy = true;
                    LoadingFragment();
                }
                App.Latitude  = location.Latitude;
                App.Longitude = location.Longitude;
                ShowInfo();
            }
            else
            {
                ReqLocationToolbarItem();
            }

            #region code

            /*
             * await Permissions.RequireAsync(PermissionType.LocationWhenInUse);
             *
             * var geolocator = new Geolocator
             * {
             *  DesiredAccuracyInMeters = request.PlatformDesiredAccuracy
             * };
             *
             * CheckStatus(geolocator.LocationStatus);
             *
             * cancellationToken = Utils.TimeoutToken(cancellationToken, request.Timeout);
             *
             * var location = await geolocator.GetGeopositionAsync().AsTask(cancellationToken);
             *
             * return location?.Coordinate?.ToLocation();
             *
             * void CheckStatus(PositionStatus status)
             * {
             *  switch (status)
             *  {
             *      case PositionStatus.Disabled:
             *      case PositionStatus.NotAvailable:
             *          throw new FeatureNotEnabledException("Location services are not enabled on device.");
             *  }
             * }
             */
            #endregion
        }
コード例 #20
0
        public GroupingsPage(bool mainPage, CipherType?type = null, string folderId  = null,
                             string collectionId            = null, string pageTitle = null, string vaultFilterSelection = null,
                             PreviousPageInfo previousPage  = null, bool deleted     = false)
        {
            _pageName = string.Concat(nameof(GroupingsPage), "_", DateTime.UtcNow.Ticks);
            InitializeComponent();
            SetActivityIndicator(_mainContent);
            _broadcasterService      = ServiceContainer.Resolve <IBroadcasterService>("broadcasterService");
            _syncService             = ServiceContainer.Resolve <ISyncService>("syncService");
            _pushNotificationService = ServiceContainer.Resolve <IPushNotificationService>("pushNotificationService");
            _stateService            = ServiceContainer.Resolve <IStateService>("stateService");
            _vaultTimeoutService     = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
            _cipherService           = ServiceContainer.Resolve <ICipherService>("cipherService");
            _deviceActionService     = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
            _vm              = BindingContext as GroupingsPageViewModel;
            _vm.Page         = this;
            _vm.MainPage     = mainPage;
            _vm.Type         = type;
            _vm.FolderId     = folderId;
            _vm.CollectionId = collectionId;
            _vm.Deleted      = deleted;
            _previousPage    = previousPage;
            if (pageTitle != null)
            {
                _vm.PageTitle = pageTitle;
            }
            if (vaultFilterSelection != null)
            {
                _vm.VaultFilterDescription = vaultFilterSelection;
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                _absLayout.Children.Remove(_fab);
                ToolbarItems.Add(_addItem);
            }
            else
            {
                ToolbarItems.Add(_syncItem);
                ToolbarItems.Add(_lockItem);
                ToolbarItems.Add(_exitItem);
            }
            if (deleted)
            {
                _absLayout.Children.Remove(_fab);
                ToolbarItems.Remove(_addItem);
            }
            if (!mainPage)
            {
                ToolbarItems.Remove(_accountAvatar);
            }
        }
コード例 #21
0
        public OverviewTabbedPage()
        {
            InitializeComponent();

            BindingContext = _viewModel = new OverviewViewModel();
            _viewModel.PlansLoadedMethod += () =>
            {
                if (_viewModel.Plans == null || _viewModel.Plans.Count <= 0)
                {
                    ToolbarItems.Remove(tiPlans);
                }
            };
        }
コード例 #22
0
        public EmployeeListPage()
        {
            InitializeComponent();
            listView.IsVisible = App.IsLoggedIn;

            string iconName = Device.RuntimePlatform == Device.UWP ? "/Toolkit.Content/ApplicationBar.Add.png" : null;

            _loginToolbarItem = new ToolbarItem("Login", iconName, async() =>
            {
                ToolbarItems.Remove(_loginToolbarItem);
                await Navigation.PushAsync(new LoginPage());
            });
        }
コード例 #23
0
        public Weather(WeatherViewModel weatherViewModel, object parameter = null)
        {
            InitializeComponent();

            _weatherViewModel = weatherViewModel;

            if (Device.RuntimePlatform == Device.UWP)
            {
                ToolbarItems.Remove(Exit);
            }

            BindingContext = _weatherViewModel;
        }
コード例 #24
0
        /// <summary>
        /// Method to open the selected recipe in the browser
        /// </summary>
        private void OpenInBrowser()
        {
            // Remove the toolbar button
            ToolbarItems.Remove(ToolbarItems.First(item => item.Text == "Open in Browser"));

            // Deselect the item
            var recipe = (Recipe)RecipeListView.SelectedItem;

            RecipeListView.SelectedItem = null;

            // Open the recipe in the browser
            Device.OpenUri(new Uri(recipe.Url));
        }
コード例 #25
0
 private void AdjustToolbar()
 {
     if (_vm.Cipher == null)
     {
         return;
     }
     _editItem.Text = _vm.Cipher.IsDeleted ? AppResources.Restore :
                      AppResources.Edit;
     if (_vm.Cipher.IsDeleted)
     {
         _absLayout.Children.Remove(_fab);
     }
     if (Device.RuntimePlatform != Device.Android)
     {
         return;
     }
     if (_vm.Cipher.OrganizationId == null)
     {
         if (ToolbarItems.Contains(_collectionsItem))
         {
             ToolbarItems.Remove(_collectionsItem);
         }
         if (!ToolbarItems.Contains(_cloneItem))
         {
             ToolbarItems.Insert(1, _cloneItem);
         }
         if (!ToolbarItems.Contains(_shareItem))
         {
             ToolbarItems.Insert(2, _shareItem);
         }
     }
     else
     {
         if (ToolbarItems.Contains(_cloneItem))
         {
             ToolbarItems.Remove(_cloneItem);
         }
         if (ToolbarItems.Contains(_shareItem))
         {
             ToolbarItems.Remove(_shareItem);
         }
         if (!ToolbarItems.Contains(_collectionsItem))
         {
             ToolbarItems.Insert(1, _collectionsItem);
         }
     }
     if (_vm.Cipher.IsDeleted && !ToolbarItems.Contains(_editItem))
     {
         ToolbarItems.Insert(1, _editItem);
     }
 }
コード例 #26
0
 void RefreshMenuButtons()
 {
     if (GetMoreMenuOptions().Count > 0)
     {
         if (!ToolbarItems.Contains(btnMore))
         {
             ToolbarItems.Add(btnMore);
         }
     }
     else
     {
         ToolbarItems.Remove(btnMore);
     }
 }
コード例 #27
0
        public CategoryDetailsPage(int categoryId, string categoryName, string btnName)
        {
            try
            {
                InitializeComponent();
                btnname = btnName;
                ToolbarItems.Remove(saveButton);
                ToolbarItems.Remove(UpdateButton);
                ToolbarItems.Remove(DeleteButton);
                if (btnname == "delete")
                {
                    ToolbarItems.Remove(saveButton);
                    ToolbarItems.Remove(UpdateButton);
                    ToolbarItems.Add(DeleteButton);
                }
                else if (btnname == "update")
                {
                    ToolbarItems.Remove(saveButton);
                    ToolbarItems.Add(UpdateButton);
                    ToolbarItems.Remove(DeleteButton);
                }
                else
                {
                    ToolbarItems.Add(saveButton);
                    ToolbarItems.Remove(UpdateButton);
                    ToolbarItems.Remove(DeleteButton);
                }
                CategoryID     = categoryId;
                NameofCategory = categoryName;
                var provider      = GetSelectedService();
                var ServiceString = "";
                foreach (var item in provider)
                {
                    if (item.isAssigned == true)
                    {
                        ServiceString = ServiceString + item.Name + " , ";
                    }
                }
                if (ServiceString.Length > 0)
                {
                    CategoryServices.Text = ServiceString.Remove(ServiceString.Length - 2);
                }
                CategoryName.Text = NameofCategory;
            }

            catch (Exception e)
            {
                e.ToString();
            }
        }
コード例 #28
0
 private void UpdateToolbar()
 {
     foreach (var item in CustomToolbar)
     {
         if (item.IsVisible)
         {
             ToolbarItems.Add(item);
         }
         else
         {
             ToolbarItems.Remove(item);
         }
     }
 }
コード例 #29
0
ファイル: HomeView.xaml.cs プロジェクト: sxvljxh/SpotifyForms
        void mainScrollView_Scrolled(object sender, ScrolledEventArgs e)
        {
            if (gradientView.Height <= 0)
            {
                return;
            }

            if (Device.RuntimePlatform == Device.Android)
            {
                if (e.ScrollY <= 90)
                {
                    if (!ToolbarItems.Contains(tbiSettings))
                    {
                        ToolbarItems.Add(tbiSettings);
                    }

                    gradientView.FadeTo(1.0, 400);
                }
                else
                {
                    if (ToolbarItems.Contains(tbiSettings))
                    {
                        ToolbarItems.Remove(tbiSettings);
                    }

                    gradientView.FadeTo(-(int)((float)e.ScrollY / 5.5F), 400);
                }
            }
            else
            {
                if (e.ScrollY <= 20)
                {
                    if (!ToolbarItems.Contains(tbiSettings))
                    {
                        ToolbarItems.Add(tbiSettings);
                    }

                    gradientView.FadeTo(1.0, 400);
                }
                else
                {
                    if (ToolbarItems.Contains(tbiSettings))
                    {
                        ToolbarItems.Remove(tbiSettings);
                    }

                    gradientView.FadeTo(-(int)((float)e.ScrollY / 5.5F), 400);
                }
            }
        }
コード例 #30
0
 /// <summary>
 /// Handle the tapping of a recipe in the ListView
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void HandleRecipeTapped(object sender, EventArgs args)
 {
     if (RecipeListView.SelectedItem != null && RecipeListView.SelectedItem != currentlySelected)
     {
         currentlySelected = RecipeListView.SelectedItem;
         ToolbarItems.Add(new ToolbarItem("Open in Browser", null, async() => OpenInBrowser()));
     }
     else
     {
         RecipeListView.SelectedItem = null;
         currentlySelected           = null;
         ToolbarItems.Remove(ToolbarItems.First(item => item.Text == "Open in Browser"));
     }
 }