private void AdjustToolbar() { if (Device.RuntimePlatform != Device.Android || _vm.Cipher == null) { return; } 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); } } }
public void AddContinueButton() { if (!ToolbarItems.Contains(_continueItem)) { ToolbarItems.Add(_continueItem); } }
public void RemoveContinueButton() { if (ToolbarItems.Contains(_continueItem)) { ToolbarItems.Remove(_continueItem); } }
private void Event_ItemTapped(object sender, ItemTappedEventArgs e) { if (e == null) { return; // has been set to null, do not 'process' tapped event } if (e.Item is LoadMore) { this.ViewModel.ShowAll = true; if (!ToolbarItems.Contains(filterToolbarItem)) { ToolbarItems.Add(filterToolbarItem); } if (!ToolbarItems.Contains(resetToolbarItem)) { ToolbarItems.Add(resetToolbarItem); } } else if (e.Item is Event) { Navigation.PushAsync(new EventDetails(((Event)e.Item))); } Debug.WriteLine("Tapped: " + e.Item); ((ListView)sender).SelectedItem = null; // de-select the row }
protected override async void OnAppearing() { base.OnAppearing(); await LoadOnAppearedAsync(_scrollView, true, () => _vm.LoadAsync(_appOptions)); if (_vm.EditMode && Device.RuntimePlatform == Device.Android) { if (_vm.Cipher.OrganizationId == null) { if (ToolbarItems.Contains(_collectionsItem)) { ToolbarItems.Remove(_collectionsItem); } if (!ToolbarItems.Contains(_shareItem)) { ToolbarItems.Insert(2, _shareItem); } } else { if (ToolbarItems.Contains(_shareItem)) { ToolbarItems.Remove(_shareItem); } if (!ToolbarItems.Contains(_collectionsItem)) { ToolbarItems.Insert(2, _collectionsItem); } } } }
void startStopButtonOnClick(object sender, EventArgs e) { // If the start button was pressed, start the timer make the start button the stop button // Additionally, make the time label visible if (startStopButton.BackgroundColor == Color.Lime) { startStopButton.BackgroundColor = Color.Red; startStopButton.Text = "Stop"; timeLabel.IsVisible = true; timeLabel.BindingContext = stopwatch; Device.OnPlatform(() => timeLabel.FontFamily = "Menlo", () => timeLabel.FontFamily = "Droid Sans Mono"); stopwatch.start(); // If the "Save" button is visible, delete it if (ToolbarItems.Contains(tbItem)) { ToolbarItems.Remove(tbItem); } } else if (startStopButton.BackgroundColor == Color.Red) { startStopButton.BackgroundColor = Color.Lime; startStopButton.Text = "Start"; stopwatch.stop(); ToolbarItems.Add(tbItem); } }
/// <summary> /// On Appearing of this screen /// </summary> protected override void OnAppearing() { base.OnAppearing(); if (_settingsOpened) { _settingsOpened = false; BreakingSettingsChanged(); } else { _viewModel.RefreshPlansCommand.Execute(null); } if (!App.AppSettings.QRCodeEnabled) { ToolbarItems.Remove(tiQRCode); } else if (!ToolbarItems.Contains(tiQRCode)) { ToolbarItems.Insert(1, tiQRCode); } if (!App.AppSettings.SpeechEnabled) { ToolbarItems.Remove(tiSpeechCode); } else if (!ToolbarItems.Contains(tiSpeechCode)) { ToolbarItems.Insert(1, tiSpeechCode); } }
private void PageModel_ToolbarItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { foreach (ToolbarItem toolBarItem in e.NewItems) { if (!ToolbarItems.Contains(toolBarItem)) { ToolbarItems.Add(toolBarItem); } } if (e.Action != NotifyCollectionChangedAction.Remove && e.Action != NotifyCollectionChangedAction.Replace) { return; } { foreach (ToolbarItem toolBarItem in e.OldItems) { if (!ToolbarItems.Contains(toolBarItem)) { ToolbarItems.Add(toolBarItem); } } } }
private void AdjustToolbar() { if ((_vm.EditMode || _vm.CloneMode) && Device.RuntimePlatform == Device.Android) { if (_vm.Cipher == null) { return; } if (_vm.Cipher.OrganizationId == null) { if (ToolbarItems.Contains(_collectionsItem)) { ToolbarItems.Remove(_collectionsItem); } if (!ToolbarItems.Contains(_shareItem) && !_vm.CloneMode) { ToolbarItems.Insert(2, _shareItem); } } else { if (ToolbarItems.Contains(_shareItem)) { ToolbarItems.Remove(_shareItem); } if (!ToolbarItems.Contains(_collectionsItem)) { ToolbarItems.Insert(2, _collectionsItem); } } } }
protected override void OnAppearing() { base.OnAppearing(); if (!ToolbarItems.Contains(_showHiddenOpsToolbarItem)) { ToolbarItems.Add(_showHiddenOpsToolbarItem); } }
private void RoutesListView_Refreshing(object sender, EventArgs e) { searchBar.Text = ""; if (ToolbarItems.Contains(reservationsButton)) { ToolbarItems.Remove(reservationsButton); } LoadRoutesList(); }
public void HideLogOutButton() { if (!ToolbarItems.Contains(_logoutToolbarItem)) { return; } ToolbarItems.Remove(_logoutToolbarItem); }
public void ShowLogOutButton() { if (ToolbarItems.Contains(_logoutToolbarItem)) { return; } ToolbarItems.Add(_logoutToolbarItem); }
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); } } } }
private void DecoUpdate() { if (!Sauvegarde.IsConnected()) { ToolbarItems.Remove(ButtonDeco); } else if (!ToolbarItems.Contains(ButtonDeco)) { ToolbarItems.Add(ButtonDeco); } }
private void ErreursUpdate() { if (Equipe.Errors.Count == 0) { ToolbarItems.Remove(Erreurs); } else if (!ToolbarItems.Contains(Erreurs)) { ToolbarItems.Add(Erreurs); } }
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); } }
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); } }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (BindingContext is ITabbedViewModel viewModel && viewModel.ToolbarItems != null && viewModel.ToolbarItems.Count > 0) { foreach (var toolBarItem in viewModel.ToolbarItems) { if (!(ToolbarItems.Contains(toolBarItem))) { ToolbarItems.Add(toolBarItem); } } } }
private void OnPropertyWindowChanged() { if (IsPropertyWindowVisible) { if (!ToolbarItems.Contains(settingsButton)) { ToolbarItems.Add(settingsButton); } } else { ToolbarItems.Remove(settingsButton); } }
private void UpdateToobarButtons() { if (!ToolbarItems.Contains(codeViewerButton)) { ToolbarItems.Add(codeViewerButton); } if (!ToolbarItems.Contains(settingsButton)) { ToolbarItems.Add(settingsButton); } UpdateTypeTabBoxView(); }
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); } } }
void RefreshMenuButtons() { if (GetMoreMenuOptions().Count > 0) { if (!ToolbarItems.Contains(btnMore)) { ToolbarItems.Add(btnMore); } } else { ToolbarItems.Remove(btnMore); } }
private void MainPage_Appearing(object sender, EventArgs e) { if (!_config.ShowServiceMenu && ToolbarItems.Contains(ToolServicePage)) { ToolbarItems.Remove(ToolServicePage); } if (_config.ShowServiceMenu && !ToolbarItems.Contains(ToolServicePage)) { // adding before settings ToolbarItems.Remove(ToolSettingsPage); ToolbarItems.Add(ToolServicePage); ToolbarItems.Add(ToolSettingsPage); } }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (BindingContext is BaseViewModel pageModel && pageModel.ToolbarItems != null && pageModel.ToolbarItems.Count > 0) { pageModel.ToolbarItems.CollectionChanged += PageModel_ToolbarItems_CollectionChanged; foreach (var toolBarItem in pageModel.ToolbarItems) { if (!ToolbarItems.Contains(toolBarItem)) { ToolbarItems.Add(toolBarItem); } } } }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (BindingContext is TinyViewModel viewModel && viewModel.ToolbarItems != null && viewModel.ToolbarItems.Count > 0) { viewModel.ToolbarItems.CollectionChanged += ViewModel_ToolbarItems_CollectionChanged; foreach (var toolBarItem in viewModel.ToolbarItems) { if (!(ToolbarItems.Contains(toolBarItem))) { ToolbarItems.Add(toolBarItem); } } } }
protected override void OnViewModelSet() { base.OnViewModelSet(); ViewModel.PropertyChanged += ViewModelOnPropertyChanged; if (ViewModel.IsOwner) { if (!ToolbarItems.Contains(_addAgenToolbarItem)) { ToolbarItems.Add(_addAgenToolbarItem); } if (!ToolbarItems.Contains(_editTeamNameToolbarItem)) { ToolbarItems.Add(_editTeamNameToolbarItem); } } }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (!(BindingContext is BaseViewModel pageModel) || pageModel.ToolbarItems == null || pageModel.ToolbarItems.Count <= 0) { return; } pageModel.ToolbarItems.CollectionChanged += PageModel_ToolbarItems_CollectionChanged; foreach (ToolbarItem toolBarItem in pageModel.ToolbarItems) { if (!ToolbarItems.Contains(toolBarItem)) { ToolbarItems.Add(toolBarItem); } } }
public async void RefreshAddressList() { ServerAddressList.IsRefreshing = true; await Task.Delay(100); var AddressesList = App.AllServerAddresses.Value.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries) .Select(a => new ServerAddressModel() { _Address = a.Split('_')[0], Activated = Convert.ToBoolean(a.Split('_')[1]), Selected = false }).ToList(); Addresses = new ObservableCollection <ServerAddressModel>(AddressesList); ServerAddressList.ItemsSource = null; ServerAddressList.ItemsSource = Addresses; if (!ToolbarItems.Contains(ToolbarItem_Add)) { ToolbarItems.Add(ToolbarItem_Add); } if (ToolbarItems.Contains(ToolbarItem_Edit)) { ToolbarItems.Remove(ToolbarItem_Edit); } if (ToolbarItems.Contains(ToolbarItem_Remove)) { ToolbarItems.Remove(ToolbarItem_Remove); } if (ToolbarItems.Contains(ToolbarItem_Activate)) { ToolbarItems.Remove(ToolbarItem_Activate); } ServerAddressList.IsRefreshing = false; await Task.Delay(100); ServerAddressList.IsRefreshing = false; SettingsForm.ServerAddressLabel2.Text = App.ServerAddress.ReplaceLatinDigits(); }
void Handle_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "IsSelected") { if (((PublicationsListPageModel)BindingContext).IsSelected) { if (!ToolbarItems.Contains(toolbar)) { ToolbarItems.Add(toolbar); } } else { if (ToolbarItems.Contains(toolbar)) { ToolbarItems.Remove(toolbar); } } } }