コード例 #1
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);
         }
     }
 }
コード例 #2
0
 public void AddContinueButton()
 {
     if (!ToolbarItems.Contains(_continueItem))
     {
         ToolbarItems.Add(_continueItem);
     }
 }
コード例 #3
0
 public void RemoveContinueButton()
 {
     if (ToolbarItems.Contains(_continueItem))
     {
         ToolbarItems.Remove(_continueItem);
     }
 }
コード例 #4
0
        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
        }
コード例 #5
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);
                    }
                }
            }
        }
コード例 #6
0
ファイル: StartPage.xaml.cs プロジェクト: max2dn/fitApp
        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);
            }
        }
コード例 #7
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);
            }
        }
コード例 #8
0
        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);
                    }
                }
            }
        }
コード例 #9
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);
             }
         }
     }
 }
コード例 #10
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            if (!ToolbarItems.Contains(_showHiddenOpsToolbarItem))
            {
                ToolbarItems.Add(_showHiddenOpsToolbarItem);
            }
        }
コード例 #11
0
 private void RoutesListView_Refreshing(object sender, EventArgs e)
 {
     searchBar.Text = "";
     if (ToolbarItems.Contains(reservationsButton))
     {
         ToolbarItems.Remove(reservationsButton);
     }
     LoadRoutesList();
 }
コード例 #12
0
        public void HideLogOutButton()
        {
            if (!ToolbarItems.Contains(_logoutToolbarItem))
            {
                return;
            }

            ToolbarItems.Remove(_logoutToolbarItem);
        }
コード例 #13
0
        public void ShowLogOutButton()
        {
            if (ToolbarItems.Contains(_logoutToolbarItem))
            {
                return;
            }

            ToolbarItems.Add(_logoutToolbarItem);
        }
コード例 #14
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);
                    }
                }
            }
        }
コード例 #15
0
 private void DecoUpdate()
 {
     if (!Sauvegarde.IsConnected())
     {
         ToolbarItems.Remove(ButtonDeco);
     }
     else if (!ToolbarItems.Contains(ButtonDeco))
     {
         ToolbarItems.Add(ButtonDeco);
     }
 }
コード例 #16
0
 private void ErreursUpdate()
 {
     if (Equipe.Errors.Count == 0)
     {
         ToolbarItems.Remove(Erreurs);
     }
     else if (!ToolbarItems.Contains(Erreurs))
     {
         ToolbarItems.Add(Erreurs);
     }
 }
コード例 #17
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);
     }
 }
コード例 #18
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);
     }
 }
コード例 #19
0
ファイル: BaseTabbedPage.cs プロジェクト: Hackavist/Limo
 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);
             }
         }
     }
 }
コード例 #20
0
 private void OnPropertyWindowChanged()
 {
     if (IsPropertyWindowVisible)
     {
         if (!ToolbarItems.Contains(settingsButton))
         {
             ToolbarItems.Add(settingsButton);
         }
     }
     else
     {
         ToolbarItems.Remove(settingsButton);
     }
 }
コード例 #21
0
        private void UpdateToobarButtons()
        {
            if (!ToolbarItems.Contains(codeViewerButton))
            {
                ToolbarItems.Add(codeViewerButton);
            }

            if (!ToolbarItems.Contains(settingsButton))
            {
                ToolbarItems.Add(settingsButton);
            }

            UpdateTypeTabBoxView();
        }
コード例 #22
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);
                }
            }
        }
コード例 #23
0
 void RefreshMenuButtons()
 {
     if (GetMoreMenuOptions().Count > 0)
     {
         if (!ToolbarItems.Contains(btnMore))
         {
             ToolbarItems.Add(btnMore);
         }
     }
     else
     {
         ToolbarItems.Remove(btnMore);
     }
 }
コード例 #24
0
ファイル: MainPage.xaml.cs プロジェクト: petrj/DVBTTelevizor
        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);
            }
        }
コード例 #25
0
        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);
                    }
                }
            }
        }
コード例 #26
0
        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);
                    }
                }
            }
        }
コード例 #27
0
        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);
                }
            }
        }
コード例 #28
0
        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);
                }
            }
        }
コード例 #29
0
        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();
        }
コード例 #30
0
 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);
             }
         }
     }
 }