コード例 #1
0
ファイル: AddEditPage.xaml.cs プロジェクト: xq2/mobile
 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);
             }
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Setups the toolbar items.
 /// </summary>
 internal void SetupToolbarItems()
 {
     if (TargetPlatform.iOS == Device.OS)
     {
         ToolbarItems.Insert(0, GetMyLocationToolbarItem());
     }
 }
コード例 #3
0
ファイル: ViewPage.xaml.cs プロジェクト: dai640/mobile
 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);
         }
     }
 }
コード例 #4
0
        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);
                    }
                }
            }
        }
コード例 #5
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = ViewModel;

            // set Text
            PlateWeightLabel.Text = string.Format(AppResources.PlateWeightLabel, L10n.GetWeightUnit());
            var dayNames = AppResources.Culture.DateTimeFormat.DayNames;

            MonLabel.Text = dayNames[1];
            TueLabel.Text = dayNames[2];
            WedLabel.Text = dayNames[3];
            ThuLabel.Text = dayNames[4];
            FriLabel.Text = dayNames[5];
            SatLabel.Text = dayNames[6];
            SunLabel.Text = dayNames[0];

            // setup delete toolbar item
            var deleteItem = ToolbarItems.FirstOrDefault(x => x.Icon == "ic_action_discard");

            if (ViewModel.ExerciseId > 0 && deleteItem == null)
            {
                deleteItem = new ToolbarItem {
                    Order = ToolbarItemOrder.Primary, Icon = "ic_action_discard"
                };
                deleteItem.SetBinding <ExerciseDetailsViewModel> (MenuItem.CommandProperty, x => x.DeleteCommand);
                ToolbarItems.Insert(0, deleteItem);
            }
        }
コード例 #6
0
        /// <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);
            }
        }
コード例 #7
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);
                    }
                }
            }
        }
コード例 #8
0
 private void HideSettingsView()
 {
     if (sampleListToolbarItem != null)
     {
         ToolbarItems.Insert(1, sampleListToolbarItem);
     }
     Content = contentLayout;
     IsPropertyViewVisible = false;
     toolbarItem.Text      = "Settings";
     toolbarItem.Icon      = "Setting.png";
 }
コード例 #9
0
 internal void HideSettingsView()
 {
     if (sampleListToolbarItem != null)
     {
         ToolbarItems.Insert(1, sampleListToolbarItem);
     }
     rootLayout.Children.Clear();
     rootLayout.Children.Add(contentLayout);
     IsPropertyViewVisible = false;
     toolbarItem.Text      = "Settings";
     toolbarItem.Icon      = "Setting.png";
 }
コード例 #10
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);
     }
 }
コード例 #11
0
 private void EditItem_Clicked(object sender, EventArgs e)
 {
     if (!exist)
     {
         var saveExistToolbarItem = new ToolbarItem()
         {
             Text = "Save"
         };
         saveExistToolbarItem.SetBinding(ToolbarItem.CommandProperty, new Binding("SaveExistEquipmentCommand"));
         ToolbarItems.Insert(0, saveExistToolbarItem);
         exist = true;
     }
 }
コード例 #12
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);
     }
 }
コード例 #13
0
        /// <summary>
        ///     Faults the icon click.
        /// </summary>
        public void FaultIconClick()
        {
            if (_viewModel.IsReviewAnswerVisible)
            {
                return;
            }

            if (ToolbarItems.Count == 1)
            {
                ToolbarItems.Insert(0, new ToolbarItem
                {
                    Icon    = "menu.png",
                    Order   = ToolbarItemOrder.Primary,
                    Command = _viewModel.ReviewListCommand
                });
            }
            else
            {
                ToolbarItems.RemoveAt(0);
            }
            _viewModel.FilterCommand.Execute(null);
        }
コード例 #14
0
        /// <summary>
        ///     Faults the icon click.
        /// </summary>
        public void FaultIconClick()
        {
            if (_viewModel.IsReviewItemVisible)
            {
                return;
            }


            searchLocationItem.Text = string.Empty;
            searchLocationItem.Unfocus();
            if (ToolbarItems.Count == 1)
            {
                ToolbarItems.Insert(0, new ToolbarItem {
                    Icon    = "menu.png",
                    Order   = ToolbarItemOrder.Primary,
                    Command = _viewModel.ReviewListCommand
                });
            }
            else
            {
                ToolbarItems.RemoveAt(0);
            }
            _viewModel.ItemsFilterCommand.Execute(null);
        }
コード例 #15
0
        private void ConfigurateToolBar()
        {
            if (ToolbarItems.Count == 1 && ListView.SelectedItems.Count > 0)
            {
                ToolbarItems.Insert(0, new ToolbarItem()
                {
                    IconImageSource = "ic_delete_white_18dp",
                    Command         = new Command(async() => {
                        if (ListView.SelectedItems.Count == 0)
                        {
                            await DisplayAlert("Información", "No existen elementos a Eliminar", "Ok");
                            return;
                        }
                        bool bRetbol = await DisplayAlert("Eliminacion", "Seguro de Eliminar las Imputaciones seleccionada(s)?", "Si", "No");
                        if (!bRetbol)
                        {
                            return;
                        }

                        ObservableCollection <ImputacionDTO> _aux = new ObservableCollection <ImputacionDTO>();
                        foreach (var item in ListView.SelectedItems)
                        {
                            _aux.Add((ImputacionDTO)item);
                        }
                        await _chargesListViewModel.DeleteImputacion(_aux);
                        //NOTE: Eliminar de la coleccion y no realizar llamada de API nuevamente.
                        _chargesListViewModel.Clear();
                        await _chargesListViewModel.FechData();
                    })
                });
            }

            if (ListView.SelectedItems.Count == 1)
            {
                bool bRetExisteEdit = ToolbarItems.Any(item => item.IconImageSource.ToString() == "ic_mode_edit_white_18dp");
                if (!bRetExisteEdit)
                {
                    ToolbarItems.Insert(0, new ToolbarItem()
                    {
                        IconImageSource = "ic_mode_edit_white_18dp",
                        Command         = new Command(async() =>
                        {
                            ImputacionDTO _aux = new ImputacionDTO();
                            _aux     = (ImputacionDTO)ListView.SelectedItems[0];
                            var page = new EditChargues.EditChargues(_aux);
                            await Navigation.PushModalAsync(page, true);
                        })
                    });
                }
            }


            if (ListView.SelectedItems.Count == 0)
            {
                foreach (ToolbarItem item in ToolbarItems)
                {
                    if (item.IconImageSource.ToString() == "ic_delete_white_18dp" || item.IconImageSource.ToString() == "ic_mode_edit_white_18dp")
                    {
                        ToolbarItems.Remove(item);
                        break;
                    }
                }
            }

            ////NOTE: Eliminar el boton EDITAR si existen mas de un Item Seleccionado.
            if (ListView.SelectedItems.Count > 1)
            {
                foreach (ToolbarItem item in ToolbarItems)
                {
                    if (item.IconImageSource.ToString() == "ic_mode_edit_white_18dp")
                    {
                        ToolbarItems.Remove(item);
                        break;
                    }
                }
            }
        }
コード例 #16
0
ファイル: AddEditPage.xaml.cs プロジェクト: phaufe/mobile
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            await LoadOnAppearedAsync(_scrollView, true, async() =>
            {
                var success = await _vm.LoadAsync(_appOptions);
                if (!success)
                {
                    await Navigation.PopModalAsync();
                }
                else if (!_vm.EditMode && string.IsNullOrWhiteSpace(_vm.Cipher.Name))
                {
                    RequestFocus(_nameEntry);
                }
            });

            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);
                    }
                }
            }
            if (!_vm.EditMode)
            {
                var addLoginShown = await _storageService.GetAsync <bool?>(Constants.AddSitePromptShownKey);

                if (_vm.Cipher.Type == CipherType.Login && !_fromAutofill && !addLoginShown.GetValueOrDefault())
                {
                    await _storageService.SaveAsync(Constants.AddSitePromptShownKey, true);

                    if (Device.RuntimePlatform == Device.iOS)
                    {
                        if (_deviceActionService.SystemMajorVersion() < 12)
                        {
                            await DisplayAlert(AppResources.BitwardenAppExtension,
                                               AppResources.BitwardenAppExtensionAlert2, AppResources.Ok);
                        }
                        else
                        {
                            await DisplayAlert(AppResources.PasswordAutofill,
                                               AppResources.BitwardenAutofillAlert2, AppResources.Ok);
                        }
                    }
                    else if (Device.RuntimePlatform == Device.Android &&
                             !_deviceActionService.AutofillAccessibilityServiceRunning() &&
                             !_deviceActionService.AutofillServiceEnabled())
                    {
                        await DisplayAlert(AppResources.BitwardenAutofillService,
                                           AppResources.BitwardenAutofillServiceAlert2, AppResources.Ok);
                    }
                }
            }
        }
コード例 #17
0
        private void InitializeSettings()
        {
            var addButton = new Button
            {
                Text = ViewModelConstants.CHECKPOINT_SYMBOL,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                WidthRequest      = Width
            };

            addButton.SetPrimaryButtonStyle();

            var addToolBarItem = new ToolbarItem {
                Icon = Device.OnPlatform(null, "check_bar.png", null)
            };

            addButton.Clicked      += AddToolBarItemSave_Clicked;
            addToolBarItem.Clicked += AddToolBarItemSave_Clicked;
            ToolbarItems.Add(addToolBarItem);

            nameEntryControl = new Entry {
                Keyboard = Keyboard.Text
            };
            notesEntryControl = new Editor {
                Keyboard = Keyboard.Default, HeightRequest = ViewElementCustomSetting.GetStandardEditorSize()
            };
            var sLayout = new StackLayout
            {
                Padding  = ViewElementCustomSetting.GetStandardThickness(),
                Spacing  = 10,
                Children =
                {
                    new Label {
                        Text = Strings.Label_Name
                    },
                    nameEntryControl,
                    new Label {
                        Text = Strings.Label_Notes
                    },
                    notesEntryControl,

                    addButton
                }
            };

            Content = sLayout;

            if (_pageModeType == ManagementPageModeType.Edit)
            {
                nameEntryControl.Text  = _editingEntity.Name;
                notesEntryControl.Text = _editingEntity.Notes;

                var removeToolBarItem = new ToolbarItem {
                    Icon = Device.OnPlatform(null, "clear.png", null)
                };
                removeToolBarItem.Clicked += (sender, args) =>
                {
                    MessagingCenter.Send(this, ViewModelConstants.REMOVE_ITEM_SUBSCRIPTION, _editingEntity);
                };
                ToolbarItems.Insert(0, removeToolBarItem);
            }
        }