예제 #1
0
 public override void OnNavigatedFrom(NavigationParameters parameters)
 {
     if (parameters.TryGetValue <string>("id", out string id))
     {
         _currentId = id;
     }
 }
예제 #2
0
 public override void OnNavigatingTo(NavigationParameters parameters)
 {
     base.OnNavigatingTo(parameters);
     if (parameters.TryGetValue("Preset", out PresetModel presetModel))
     {
         PresetModel = presetModel;
     }
 }
예제 #3
0
 public override void OnNavigatingTo(NavigationParameters parameters)
 {
     base.OnNavigatingTo(parameters);
     if (parameters.TryGetValue("DeviceModel", out DeviceModel deviceModel))
     {
         DeviceModel = deviceModel;
     }
 }
예제 #4
0
        public void TryGetValueReturnsDefaultWhenGivenInvalidKey()
        {
            var parameters = new NavigationParameters();
            var result     = parameters.TryGetValue("id", out int value);

            Assert.False(result);
            Assert.Equal(default(int), value);
        }
 public override void OnNavigatedTo(NavigationParameters parameters)
 {
     base.OnNavigatedTo(parameters);
     if (parameters.TryGetValue <List <ImageNews> >("ImgLibrary", out List <ImageNews> listImg))
     {
         listImg = parameters["ImgLibrary"] as List <ImageNews>;
         ShowImgExe(listImg);
     }
 }
예제 #6
0
 public override void OnNavigatedTo(NavigationParameters parameters)
 {
     base.OnNavigatedTo(parameters);
     if (parameters.TryGetValue("Path", out String newPath))
     {
         this.path = newPath;
     }
     OnReadCommand(null);
 }
        public void TryGetValueReturnsTypedParameterWhenParametersParsedFromQuery()
        {
            var parameters = new NavigationParameters(_uri);
            int value;
            var result = parameters.TryGetValue("id", out value);

            Assert.AreEqual(true, result);
            Assert.AreEqual(3, value);
        }
예제 #8
0
        public void TryGetValueReturnsDefaultWhenParameterValueIsNull()
        {
            var parameters = new NavigationParameters();

            parameters.Add("value", null);
            var result = parameters.TryGetValue("value", out int value);

            Assert.True(result);
            Assert.Equal(0, value);
        }
 public void OnNavigatingTo(NavigationParameters parameters)
 {
     // if we're given a page to navigate to, select that page
     if (parameters.TryGetValue("page", out string pageName))
     {
         var pageToView = Children.FirstOrDefault(p => p.GetType().Name == pageName);
         if (pageToView != null)
         {
             SelectedItem = pageToView;
         }
     }
 }
        public void TryGetValueUseParentClassAsTypeParameter()
        {
            var parameters = new NavigationParameters();

            parameters.Add("id", new Child());

            Person value;
            var    result = parameters.TryGetValue <Person>("id", out value);

            Assert.IsTrue(result);
            Assert.IsInstanceOfType(value, typeof(Child));
        }
        public override void OnNavigatedTo(NavigationParameters parameters)
        {
            TaskModel model;

            if (parameters.TryGetValue(Events.EditTaskEvent, out model))
            {
                Model = model;
            }
            else
            {
                Model = new TaskModel();
            }
        }
        public static bool TryGetParam <T>(this NavigationParameters parameters, string paramKey, out T paramValue)
        {
            if (parameters.TryGetValue <object>(paramKey, out var paramObject))
            {
                if (paramObject is T paramCastToType)
                {
                    paramValue = paramCastToType;
                    return(true);
                }
            }

            paramValue = default(T);
            return(false);
        }
예제 #13
0
 public override void OnNavigatedTo(NavigationParameters parameters)
 {
     base.OnNavigatedTo(parameters);
     LoadSites();
     if (parameters.TryGetValue("Preset", out PresetModel presetModel))
     {
         this.PresetModel.FirstPanel  = presetModel.FirstPanel;
         this.PresetModel.SecondPanel = presetModel.SecondPanel;
         this.PresetModel.ThirdPanel  = presetModel.ThirdPanel;
         this.PresetModel.Name        = presetModel.Name;
         OnSendCommand(null);
     }
     Debug.WriteLine("OnNavigatingTo to");
 }
예제 #14
0
        public async void OnNavigatedTo(NavigationParameters parameters)
        {
            IsLoading = true;

            ShowControls = false;

            if (parameters.TryGetValue(NavigationParametersKey.SelectedMovieId, out int selectedMovieId))
            {
                SelectedMovie = await _movieService.GetMovieByIdAsync(selectedMovieId);
            }

            IsLoading = false;

            ShowControls = true;
        }
 protected override void ReadNavigationParameters()
 {
     if (NavigationParameters.ContainsKey("SearchTerm"))
     {
         object searchTerm;
         NavigationParameters.TryGetValue("SearchTerm", out searchTerm);
         if (searchTerm != null)
         {
             DoLaunchSearchForBand(searchTerm.ToString());
         }
         else
         {
             DoLaunchSearch(String.Empty);
         }
     }
 }
예제 #16
0
        public async void OnNavigatedTo(NavigationParameters parameters)
        {
            Title = "Leona Store";

            BackgroundColor = Color.FromHex("F5F5F5");

            if (Articles == null)
            {
                await OnRefreshListing();
            }

            object productId;

            if (parameters.TryGetValue(ScreensNavigationParameters.ProductId, out productId))
            {
                await _navigationService.NavigateAsync($"{Screens.ListingDetail}",
                                                       new NavigationParameters($"{ScreensNavigationParameters.ProductId}={productId}"));
            }
        }
예제 #17
0
        public async void OnNavigatedTo(NavigationParameters parameters)
        {
            if (parameters == null)
            {
                return;
            }

            if (parameters.TryGetValue("partyId", out var partyId))
            {
                this.PartyId = int.Parse((string)partyId);
            }

            var sheets = await this.StaffService.GetSheetsByStatus(SheetStatus.Empty);

            this.Sheets.Clear();
            foreach (var sheet in sheets)
            {
                this.Sheets.Add(sheet);
            }
        }
예제 #18
0
        public async void OnNavigatedTo(NavigationParameters parameters)
        {
            IsLoading = true;

            if (parameters.TryGetValue(NavigationParametersKey.SelectedCategoryId, out string selectedCategoryId))
            {
                Movies = await _movieService.GetMoviesByCategory(selectedCategoryId);

                IsDoingSearch = true;

                var howManyMoviesFound = Movies.Count();

                IfNoResult = howManyMoviesFound == 0;

                Title = (howManyMoviesFound == 0 ? "No" : howManyMoviesFound.ToString()) + " Results";

                SearchResult = $"Showing results for “{selectedCategoryId}” movies.";
            }
            IsLoading = false;
        }
예제 #19
0
        public async void OnNavigatedTo(NavigationParameters parameters)
        {
            IsLoading = true;

            ShowContent = !IsLoading;

            object productId = null;

            if (parameters.TryGetValue(ScreensNavigationParameters.ProductId, out productId))
            {
                SelectedListingItem = await _listingService.GetListing(productId as string);

                ChangeColorText = $"Change {SelectedListingItem.ListingModels.ModelType}";

                SelectedColor = SelectedListingItem.ListingModels?.ListingModels.FirstOrDefault();
            }

            IsLoading = false;

            ShowContent = !IsLoading;
        }
예제 #20
0
        public async override void OnNavigatedTo(NavigationParameters parameters)
        {
            base.OnNavigatedTo(parameters);
            var op = null as object;

            parameters.TryGetValue("operation", out op);
            var operation = Convert.ToString(op);

            if (operation == "red")
            {
                Color   = "Maroon";
                _prefix = 'a';
            }
            if (operation == "blue")
            {
                Color   = "#456CD1";
                _prefix = 'b';
            }
            if (operation == "purple")
            {
                Color   = "#9A4EAE";
                _prefix = 'c';
            }
            if (operation == "disconnect")
            {
                await _bleService.SendAsync("ff");

                await _bleService.Disconnect();

                Color = "Gray";
                Info  = "Status: Disconnected";
                return;
            }
            if (operation == "rest")
            {
                await _bleService.SendAsync("ff");
            }
            Info = "Status: " + await _bleService.GetInfo();
        }
예제 #21
0
        public async void OnNavigatedTo(NavigationParameters parameters)
        {
            object id;

            if (parameters.TryGetValue("id", out id))
            {
                this.PartyInfo.Id = (string)id;
                await this.PartyInfo.UpdateAsync();

                if (this.PartyInfo.PartyCount != -1)
                {
                    Device.StartTimer(TimeSpan.FromSeconds(5), () =>
                    {
                        this.PartyInfo.UpdateAsync().Wait();
                        if (this.PartyInfo.PartyCount == 1)
                        {
                            this.PageDialogService.DisplayAlertAsync("Info", "お客様の番が来ました。いらっしゃいませ。", "OK");
                            return(false);
                        }
                        return(true);
                    });
                }
            }
        }