コード例 #1
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();

            if (_instance.DatasetChars.Count == 0 || _instance.DatasetMons.Count == 0 ||
                _instance.DatasetItems.Count == 0)
            {
                _instance.LoadDataCommand.Execute(null);
            }
            else if (_instance.NeedsRefresh())
            {
                _instance.LoadDataCommand.Execute(null);
            }

            BindingContext = _instance;
        }
コード例 #2
0
        public EnvironmentPage()
        {
            _platformUtilsService = ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService");
            _messagingService     = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _messagingService.Send("showStatusBar", true);
            InitializeComponent();
            _vm      = BindingContext as EnvironmentPageViewModel;
            _vm.Page = this;
            if (Device.RuntimePlatform == Device.Android)
            {
                ToolbarItems.RemoveAt(0);
            }

            _webVaultEntry.ReturnType    = ReturnType.Next;
            _webVaultEntry.ReturnCommand = new Command(() => _apiEntry.Focus());
            _apiEntry.ReturnType         = ReturnType.Next;
            _apiEntry.ReturnCommand      = new Command(() => _identityEntry.Focus());
            _identityEntry.ReturnType    = ReturnType.Next;
            _identityEntry.ReturnCommand = new Command(() => _iconsEntry.Focus());
            _vm.SubmitSuccessAction      = () => Device.BeginInvokeOnMainThread(async() => await SubmitSuccessAsync());
            _vm.CloseAction = async() =>
            {
                _messagingService.Send("showStatusBar", false);
                await Navigation.PopModalAsync();
            };
        }
コード例 #3
0
        //on appearing, loads any new information from the view model
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            //removes the first toolbar item
            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();

            //if needed to refresh or dataset is empty, refresh from database
            if (_viewModel.Dataset.Count == 0)
            {
                _viewModel.LoadDataCommand.Execute(null);
            }
            else if (_viewModel.NeedsRefresh())
            {
                _viewModel.LoadDataCommand.Execute(null);
            }

            BindingContext = _viewModel;
        }
コード例 #4
0
        public PaginaTicket(Ticket ticket)
        {
            InitializeComponent();

            this.BindingContext = ticket;
            this.ticket         = ticket;

            if (ticket.PartitionKey == string.Empty)
            {
                ToolbarItems.RemoveAt(1);
                ToolbarItems.RemoveAt(1);
                ToolbarItems.RemoveAt(1);
            }
            else
            {
                if (ticket.TicketURL == string.Empty)
                {
                    ToolbarItems.RemoveAt(2);
                }

                if (ticket.ComprobanteURL == string.Empty)
                {
                    ToolbarItems.RemoveAt(1);
                }
            }
        }
コード例 #5
0
ファイル: MyJokes.xaml.cs プロジェクト: CornelSora/TMW_Client
 public MyJokes(int userID)
 {
     InitializeComponent();
     ToolbarItems.RemoveAt(0);
     BindingContext = secondViewModel = new ItemsViewModel(userID);
     this.UserID    = userID;
 }
コード例 #6
0
        public ItemsPage()
        {
            InitializeComponent();

            ToolbarItems.RemoveAt(1);
            BindingContext = firstViewModel = new ItemsViewModel();
        }
コード例 #7
0
        protected override void OnAppearing()
        {
            //base.OnAppearing();

            //if (viewModel.Characters.Count == 0)
            //  viewModel.LoadCharactersCommand.Execute(null);


            base.OnAppearing();

            BindingContext = null;

            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();

            if (viewModel.Characters.Count == 0)
            {
                viewModel.LoadCharactersCommand.Execute(null);
            }
            else if (viewModel.NeedsRefresh())
            {
                viewModel.LoadCharactersCommand.Execute(null);
            }

            BindingContext = viewModel;
        }
コード例 #8
0
        //____________________________________________________
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();

            //LOAD datasets
            if (_viewModel.getRound() == "1")
            {
                if (_viewModel.DatasetMonster.Count == 0 || _viewModel.DatasetCharacter.Count == 0)
                {
                    _viewModel.LoadDataCommand.Execute(null);
                }
                else if (_viewModel.NeedsRefresh())
                {
                    _viewModel.LoadDataCommand.Execute(null);
                }
            }
            BindingContext = _viewModel;
            RoundNum.Text  = _viewModel.getRound(); //text for round
            GridSetup();
        }
コード例 #9
0
ファイル: VaultAttachmentsPage.cs プロジェクト: pee/mobile
        protected async override void OnAppearing()
        {
            base.OnAppearing();
            ListView.ItemSelected += AttachmentSelected;
            await LoadAttachmentsAsync();

            // Prevent from adding multiple save buttons
            if (Device.RuntimePlatform == Device.iOS && ToolbarItems.Count > 1)
            {
                ToolbarItems.RemoveAt(1);
            }
            else if (Device.RuntimePlatform != Device.iOS && ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            if (_cipher != null && (_tokenService.TokenPremium || _cipher.OrganizationId != null))
            {
                ToolbarItems.Add(SaveToolbarItem);
                ListView.Footer = NewTable;

                if (!_canUseAttachments)
                {
                    await ShowUpdateKeyAsync();
                }
            }
            else
            {
                await DisplayAlert(null, AppResources.PremiumRequired, AppResources.Ok);
            }
        }
コード例 #10
0
        /// <summary>
        /// Constructor of StandByPage()
        /// </summary>
        public MainPage()
        {
            InitializeComponent();
            // Subscribe notification of locale changes to update text based on locale
            MessagingCenter.Subscribe <App>(this, MessageKeys.UpdateByLanguageChange, (obj) =>
            {
                // After Toolbar items are added, any properties of the toolbar item cannot be changed.
                // So, first of all, remove all toolbar items and update localized texts and then add items to Toolbar.
                var count = ToolbarItems.Count;
                for (int i = ToolbarItems.Count - 1; i >= 0; i--)
                {
                    ToolbarItems.RemoveAt(i);
                }

                // Update text that has been translated into the current language.
                recordsMenu.Text = AppResources.Recordings;
                sttOnOfMenu.Text = AppResources.SpeechToText;
                sttMenu.Text     = AppResources.Languages;

                // Add items to Toolbar
                ToolbarItems.Add(recordsMenu);
                ToolbarItems.Add(sttOnOfMenu);
                if (count == 3)
                {
                    ToolbarItems.Add(sttMenu);
                }

                // Update Main label's text
                ((MainPageModel)BindingContext).UpdateText();
            });
        }
コード例 #11
0
ファイル: RegisterPage.xaml.cs プロジェクト: dai640/mobile
        public RegisterPage(HomePage homePage)
        {
            InitializeComponent();
            _vm      = BindingContext as RegisterPageViewModel;
            _vm.Page = this;
            _vm.RegistrationSuccess = async() =>
            {
                if (homePage != null)
                {
                    await homePage.DismissRegisterPageAndLogInAsync(_vm.Email);
                }
            };
            MasterPasswordEntry        = _masterPassword;
            ConfirmMasterPasswordEntry = _confirmMasterPassword;
            if (Device.RuntimePlatform == Device.Android)
            {
                ToolbarItems.RemoveAt(0);
            }

            _email.ReturnType                    = ReturnType.Next;
            _email.ReturnCommand                 = new Command(() => _masterPassword.Focus());
            _masterPassword.ReturnType           = ReturnType.Next;
            _masterPassword.ReturnCommand        = new Command(() => _confirmMasterPassword.Focus());
            _confirmMasterPassword.ReturnType    = ReturnType.Next;
            _confirmMasterPassword.ReturnCommand = new Command(() => _hint.Focus());
        }
コード例 #12
0
        public ExpensesPage()
        {
            InitializeComponent();

            BindingContext = new ExpensesViewModel();

                        #if __ANDROID__
            ToolbarItems.RemoveAt(0);

            var fab = new FloatingActionButton(Forms.Context)
            {
                UseCompatPadding = true
            };

            fab.Click += (sender, e) =>
            {
                var viewModel = BindingContext as ExpensesViewModel;
                viewModel.AddExpenseCommand.Execute(null);
            };

            relativeLayout.Children.Add(fab.ToView(),
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.Width - 100);
            }),
                                        Constraint.RelativeToParent((parent) =>
            {
                return(parent.Height - 100);
            }),
                                        Constraint.Constant(75),
                                        Constraint.Constant(85));
                        #endif
        }
コード例 #13
0
        /// <summary>
        /// This method will replace the Log In / Log Out button
        /// </summary>
        private void LogInOutButton()
        {
            // Remove the Log in/out button
            ToolbarItems.RemoveAt(1);

            // If there is no current user signed in
            if (Settings.CurrentUserEmail.Length == 0)
            {
                // Create a new ToolBar Button
                ToolbarItem SignInButton = new ToolbarItem
                {   // Assign it the properties below
                    AutomationId = "SignIn",
                    Text         = "Sign In",
                    // Set the menu button to the sub-menu
                    Order = ToolbarItemOrder.Secondary
                };
                // Add the button to the menu
                ToolbarItems.Add(SignInButton);
            }
            else // A user is signed in
            {   // Create a new toolbar button caled Sign Out
                ToolbarItem SignOutButton = new ToolbarItem
                {   // Assign it the properties below
                    AutomationId = "SignOut",
                    Text         = "Sign Out",
                    // Set the menu button to the sub-menu
                    Order = ToolbarItemOrder.Secondary
                };
                // Add the button to the menu
                ToolbarItems.Add(SignOutButton);
            }
            // Add the click event handler to the button
            ToolbarItems.ElementAt(1).Clicked += SignInOut_Clicked;
        }
コード例 #14
0
        //Refreshes the page when called. This helps with refreshing page afte a play has happened
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;
            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();


            BindingContext = _viewModel;

            // Battle MEssage defined here
            BattleMessageName.Text = msg;
            BattleScore.Text       = score;
            BattleRound.Text       = round;
            var inventoryList = string.Empty;

            foreach (var item in battleObj.itemInventory)
            {
                inventoryList = inventoryList + item.Text + "\n";
            }
            if (battleObj.itemInventory.Count <= 0)
            {
                inventoryList = "No items in Inventory.";
            }
            //BattleInventory.Text = inventoryList;
        }
コード例 #15
0
        /// <summary>
        /// Standby > More options > Speech to text
        /// Invoked when "Speech to text" more option is selected to turn Speech to text feature on/off
        /// </summary>
        /// <param name="sender">sender object </param>
        /// <param name="e">EventArgs</param>
        void OnCircleToolbarItemClicked_OnOffStt(object sender, EventArgs e)
        {
            Console.WriteLine(" MainPage.OnCircleToolbarItemClicked_OnOffStt()");

            // As mentioned in API spec (https://developer.xamarin.com/api/type/Xamarin.Forms.ToolbarItem/),
            // Any changes made to the properties of the toolbar item after it has been added will be ignored.
            // So according to the circumstances, ToolbarItems are added or removed.
            if (ToolbarItems.Count == 3)
            {
                // When STT is off, "Language" more menu should be hidden.
                ToolbarItems.RemoveAt(2);
                ToolbarItems.RemoveAt(1);
                // When STT is off, Icon image & SubText should be changed.
                sttOnOfMenu.Icon    = "more_option_icon_stt_off.png";
                sttOnOfMenu.SubText = AppResources.SttOff;
                ToolbarItems.Add(sttOnOfMenu);
            }
            else
            {
                ToolbarItems.RemoveAt(1);
                // When STT is on, Icon image & SubText should be changed.
                sttOnOfMenu.Icon    = "more_option_icon_stt_on.png";
                sttOnOfMenu.SubText = AppResources.SttOn;
                ToolbarItems.Add(sttOnOfMenu);
                // When STT is on, "Language" more menu should be shown.
                ToolbarItems.Add(sttMenu);
            }
        }
コード例 #16
0
        public LoginPage(string email = null, AppOptions appOptions = null)
        {
            _storageService   = ServiceContainer.Resolve <IStorageService>("storageService");
            _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _messagingService.Send("showStatusBar", true);
            _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.CloseAction          = async() =>
            {
                _messagingService.Send("showStatusBar", false);
                await Navigation.PopModalAsync();
            };
            _vm.Email           = email;
            MasterPasswordEntry = _masterPassword;
            if (Device.RuntimePlatform == Device.Android)
            {
                ToolbarItems.RemoveAt(0);
            }

            _email.ReturnType    = ReturnType.Next;
            _email.ReturnCommand = new Command(() => _masterPassword.Focus());
        }
コード例 #17
0
ファイル: BattlePage.xaml.cs プロジェクト: loleeta/TRP
        // Before the page appears, remove anything that was there prior, and load data to view model
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();
            _viewModel.ClearCharacterLists();

            if (_viewModel.BattleEngine.CharacterList.Count == 0 || _viewModel.BattleEngine.MonsterList.Count == 0)
            {
                _viewModel.LoadDataCommand.Execute(null);
            }
            else if (_viewModel.NeedsRefresh())
            {
                _viewModel.LoadDataCommand.Execute(null);
            }

            BindingContext   = _viewModel;
            numRounds.Text   = Convert.ToString(_viewModel.BattleEngine.BattleScore.RoundCount);
            MessageText.Text = _viewModel.BattleEngine.BattleMessage.TimeWarpMessage;
        }
コード例 #18
0
        public SetPasswordPage(AppOptions appOptions = null, string orgIdentifier = null)
        {
            _appOptions = appOptions;
            InitializeComponent();
            _vm      = BindingContext as SetPasswordPageViewModel;
            _vm.Page = this;
            _vm.SetPasswordSuccessAction =
                () => Device.BeginInvokeOnMainThread(async() => await SetPasswordSuccessAsync());
            _vm.CloseAction = async() =>
            {
                await Navigation.PopModalAsync();
            };
            _vm.OrgIdentifier = orgIdentifier;
            if (Device.RuntimePlatform == Device.Android)
            {
                ToolbarItems.RemoveAt(0);
            }

            MasterPasswordEntry        = _masterPassword;
            ConfirmMasterPasswordEntry = _confirmMasterPassword;

            _masterPassword.ReturnType           = ReturnType.Next;
            _masterPassword.ReturnCommand        = new Command(() => _confirmMasterPassword.Focus());
            _confirmMasterPassword.ReturnType    = ReturnType.Next;
            _confirmMasterPassword.ReturnCommand = new Command(() => _hint.Focus());
        }
コード例 #19
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            InitializeComponent();

            //_viewModel.LoadDataCommand.Execute(null);

            if (_viewModel.Dataset.Count == 0)
            {
                _viewModel.LoadDataCommand.Execute(null);
            }
            else if (_viewModel.NeedsRefresh())
            {
                _viewModel.LoadDataCommand.Execute(null);
            }

            BindingContext = _viewModel;
        }
コード例 #20
0
ファイル: LoginSsoPage.xaml.cs プロジェクト: ebell451/mobile
 public LoginSsoPage(AppOptions appOptions = null)
 {
     _storageService      = ServiceContainer.Resolve <IStorageService>("storageService");
     _messagingService    = ServiceContainer.Resolve <IMessagingService>("messagingService");
     _vaultTimeoutService = ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService");
     _messagingService.Send("showStatusBar", true);
     _appOptions = appOptions;
     InitializeComponent();
     _vm      = BindingContext as LoginSsoPageViewModel;
     _vm.Page = this;
     _vm.StartTwoFactorAction   = () => Device.BeginInvokeOnMainThread(async() => await StartTwoFactorAsync());
     _vm.StartSetPasswordAction = () =>
                                  Device.BeginInvokeOnMainThread(async() => await StartSetPasswordAsync());
     _vm.SsoAuthSuccessAction     = () => Device.BeginInvokeOnMainThread(async() => await SsoAuthSuccessAsync());
     _vm.UpdateTempPasswordAction =
         () => Device.BeginInvokeOnMainThread(async() => await UpdateTempPasswordAsync());
     _vm.CloseAction = async() =>
     {
         _messagingService.Send("showStatusBar", false);
         await Navigation.PopModalAsync();
     };
     if (Device.RuntimePlatform == Device.Android)
     {
         ToolbarItems.RemoveAt(0);
     }
 }
コード例 #21
0
        public SetPasswordPage(AppOptions appOptions = null)
        {
            _messagingService = ServiceContainer.Resolve <IMessagingService>("messagingService");
            _messagingService.Send("showStatusBar", true);
            _appOptions = appOptions;
            InitializeComponent();
            _vm      = BindingContext as SetPasswordPageViewModel;
            _vm.Page = this;
            _vm.SetPasswordSuccessAction =
                () => Device.BeginInvokeOnMainThread(async() => await SetPasswordSuccessAsync());
            _vm.CloseAction = async() =>
            {
                _messagingService.Send("showStatusBar", false);
                await Navigation.PopModalAsync();
            };
            if (Device.RuntimePlatform == Device.Android)
            {
                ToolbarItems.RemoveAt(0);
            }

            MasterPasswordEntry        = _masterPassword;
            ConfirmMasterPasswordEntry = _confirmMasterPassword;

            _masterPassword.ReturnType           = ReturnType.Next;
            _masterPassword.ReturnCommand        = new Command(() => _confirmMasterPassword.Focus());
            _confirmMasterPassword.ReturnType    = ReturnType.Next;
            _confirmMasterPassword.ReturnCommand = new Command(() => _hint.Focus());
        }
コード例 #22
0
 //workaround to update CircleToolbarItem play/pause icon and text
 private void MainContext_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Playing")
     {
         string icon    = MainContext.Playing ? "images/pause.png" : "images/play.png";
         string text    = MainContext.Playing ? "Pause" : "Play";
         var    newItem = new CircleToolbarItem
         {
             Command = (ToolbarItems[2] as CircleToolbarItem).Command,
             Icon    = icon,
             Text    = text,
         };
         var th4 = ToolbarItems[3];
         var th5 = ToolbarItems[4];
         var th6 = ToolbarItems[5];
         ToolbarItems.RemoveAt(2);
         ToolbarItems.RemoveAt(2);
         ToolbarItems.RemoveAt(2);
         ToolbarItems.RemoveAt(2);
         ToolbarItems.Add(newItem);
         ToolbarItems.Add(th4);
         ToolbarItems.Add(th5);
         ToolbarItems.Add(th6);
     }
 }
コード例 #23
0
        async void CargarEmocion()
        {
            Loading(true);

            var bd = new ServicioBaseDatos();

            emocion = await bd.ObtenerEmocion();

            if (emocion == null)
            {
                emocion = new Emocion()
                {
                    Id = 0, Nombre = "", Score = 0, Foto = ""
                };
                ToolbarItems.RemoveAt(1);
            }
            else
            {
                btnAnalizar.IsEnabled = true;
            }

            BindingContext = emocion;

            Loading(false);
        }
コード例 #24
0
        // Before the page appears, remove anything that was there prior, and load data to view model
        protected override void OnAppearing()
        {
            base.OnAppearing();

            BindingContext = null;

            if (ToolbarItems.Count > 0)
            {
                ToolbarItems.RemoveAt(0);
            }

            _viewModel.ClearCharacterLists();
            InitializeComponent();

            if (_viewModel.AvailableCharacters.Count == 0)
            {
                _viewModel.LoadDataCommand.Execute(null);
            }
            else if (_viewModel.NeedsRefresh())
            {
                _viewModel.LoadDataCommand.Execute(null);
            }

            BindingContext = _viewModel;
        }
コード例 #25
0
        //using at history
        public MapResultPage(MapPreparedData newTreningData)
        {
            InitializeComponent();

            resultData = new MapPreparedData(newTreningData);
            ToolbarItems.RemoveAt(1);
            ToolbarItems.RemoveAt(0);
            ResultMap.IsVisible = false;
        }
コード例 #26
0
 public SyncPage()
 {
     InitializeComponent();
     _vm      = BindingContext as SyncPageViewModel;
     _vm.Page = this;
     if (Device.RuntimePlatform == Device.Android)
     {
         ToolbarItems.RemoveAt(0);
     }
 }
コード例 #27
0
        public ManageLessonsPage()
        {
            InitializeComponent();

            // Remove SyncDl button if no DL user
            if (SettingsRepository.Settings.DlNureUser == null)
            {
                ToolbarItems.RemoveAt(0);
            }
        }
コード例 #28
0
        void RemoveToolbarItem()
        {
            var id = ToolbarItems.Count - 1;

            if (id < 0)
            {
                return;
            }
            ToolbarItems.RemoveAt(id);
            cntLabel.Text = "# of items :" + ToolbarItems.Count;
        }
コード例 #29
0
        public MapResultPage(List <Plugin.Geolocator.Abstractions.Position> newTrening, MapPreparedData newTreningData)
        {
            InitializeComponent();

            resultRoad = new List <Plugin.Geolocator.Abstractions.Position>(newTrening);
            resultData = new MapPreparedData(newTreningData);
            ToolbarItems.RemoveAt(1);
            ToolbarItems.RemoveAt(0);
            ResultMap.DrawRoadAtStart(newTrening);
            ResultMap.MoveToRegion(MapSpan.FromCenterAndRadius(new Xamarin.Forms.Maps.Position(newTrening[(newTrening.Count / 2)].Latitude, newTrening[(newTrening.Count / 2)].Longitude), new Distance(1000)));
        }
コード例 #30
0
        public PaginaDetalleTarea(Tarea tarea)
        {
            InitializeComponent();

            this.tarea = tarea;

            if (tarea.Id <= 0 && ToolbarItems.Count > 1)
            {
                ToolbarItems.RemoveAt(1);
            }
        }