示例#1
0
        private async void ListViewBase_OnItemClick(object sender, ItemClickEventArgs e)
        {
            var packageData = e.ClickedItem as PackageData;

            if (packageData == null)
            {
                return;
            }

            if (AddNewPackageTemplateSelector.IsAddItem(packageData))
            {
                LoginDialog.IsOpen = true;

                //No idea why this works, but I can't get it to focus any other way...
                //I think it just needs to be invoked out of the event handler
                await Task.Delay(1);

                NewTrackingNumber.Focus(FocusState.Programmatic);
            }
            else
            {
                var json = JsonConvert.SerializeObject(packageData);
                this.Frame.Navigate(typeof(PackageDetail), json);
            }
        }
示例#2
0
        private async void TrackingNumberEntered(object sender, RoutedEventArgs e)
        {
            LoginDialog.IsOpen = false;

            var trackingNumber = NewTrackingNumber.Text.Trim();

            var package = new PackageData {
                TrackingNumber = trackingNumber
            };

            //Insert the package before the "add" item
            Packages.Insert(Packages.Count - 1, package);

            //Remember the tracking number for app restarts
            ApplicationData.Current.RoamingSettings.Values[TrackingNumbersRoamingKey] =
                Packages.Where(x => !AddNewPackageTemplateSelector.IsAddItem(x))
                .Select(x => x.TrackingNumber).ToArray();

            await RefreshPackage(package);
        }