private void ListBox_OnTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            foreach (ListPickerListItem listPickerListItem in (Collection <ListPickerListItem>) this.ItemsSource)
            {
                listPickerListItem.IsSelected = false;
            }
            ListPickerListItem selectedItem = this.listBox.SelectedItem as ListPickerListItem;

            if (selectedItem == null)
            {
                return;
            }
            selectedItem.IsSelected = true;
        }
Exemple #2
0
        private void OnClicked(object sender, System.Windows.Input.GestureEventArgs e)
        {
            if (!this.IsPopupSelection)
            {
                // ISSUE: reference to a compiler-generated field
                EventHandler <System.Windows.Input.GestureEventArgs> click = this.Click;
                if (click != null)
                {
                    object           sender1 = sender;
                    GestureEventArgs e1      = e;
                    click(sender1, e1);
                }
                if (e.Handled)
                {
                    return;
                }
                Navigator.Current.NavigateToCustomListPickerSelection(this);
            }
            else
            {
                FrameworkElement content = (FrameworkElement)((ContentControl)Application.Current.RootVisual).Content;
                GeneralTransform visual  = base.TransformToVisual((UIElement)content);
                Point            point1  = new Point();
                // ISSUE: explicit reference operation
                point1.X = (-16.0);
                // ISSUE: explicit reference operation
                point1.Y = 0.0;
                Point point3 = visual.Transform(point1);
                // ISSUE: explicit reference operation
                if (point3.X + this.PopupSelectionWidth > 480.0)
                {
                    // ISSUE: explicit reference operation
                    point3.X = (480.0 - this.PopupSelectionWidth);
                }
                ListPickerListItem listPickerListItem1 = null;
                ObservableCollection <ListPickerListItem> observableCollection = new ObservableCollection <ListPickerListItem>();
                foreach (CustomListPickerItem customListPickerItem in this.ItemsSource)
                {
                    ListPickerListItem listPickerListItem2 = new ListPickerListItem(customListPickerItem);
                    observableCollection.Add(listPickerListItem2);
                    CustomListPickerItem selectedItem = this.SelectedItem;
                    if (customListPickerItem == selectedItem)
                    {
                        listPickerListItem2.IsSelected = true;
                        listPickerListItem1            = listPickerListItem2;
                    }
                }
                ListPickerItemsUC listPickerItemsUc = new ListPickerItemsUC();
                listPickerItemsUc.ItemsSource     = observableCollection;
                listPickerItemsUc.SelectedItem    = listPickerListItem1;
                listPickerItemsUc.PickerMaxHeight = 480.0;
                double popupSelectionWidth = this.PopupSelectionWidth;
                listPickerItemsUc.PickerWidth = popupSelectionWidth;
                FrameworkElement frameworkElement = content;
                listPickerItemsUc.ParentElement = frameworkElement;
                Point point4 = point3;
                listPickerItemsUc.ShowPosition = point4;
                // ISSUE: variable of the null type

                listPickerItemsUc.ItemTemplate = null;
                ListPickerItemsUC picker = listPickerItemsUc;
                Grid grid1 = new Grid();
                int  num1  = 0;
                grid1.VerticalAlignment = ((VerticalAlignment)num1);
                int num2 = 0;
                grid1.HorizontalAlignment = ((HorizontalAlignment)num2);
                Grid grid2 = grid1;
                ((PresentationFrameworkCollection <UIElement>)((Panel)grid2).Children).Add((UIElement)picker);
                DialogService dialogService1 = new DialogService();
                dialogService1.AnimationType = DialogService.AnimationTypes.None;
                SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);
                dialogService1.BackgroundBrush = (Brush)solidColorBrush;
                Grid grid3 = grid2;
                dialogService1.Child = (FrameworkElement)grid3;
                DialogService dialogService = dialogService1;
                ((UIElement)picker.listBox).Tap += ((EventHandler <System.Windows.Input.GestureEventArgs>)((o, args) =>
                {
                    ListPickerListItem selectedItem = picker.listBox.SelectedItem as ListPickerListItem;
                    if (selectedItem != null)
                    {
                        this.SelectedItem = this.ItemsSource[picker.ItemsSource.IndexOf(selectedItem)];
                    }
                    ((Timeline)picker.AnimClipHide).Completed += ((EventHandler)((s, a) => dialogService.Hide()));
                    picker.AnimClipHide.Begin();
                }));
                dialogService.Opened += (EventHandler)((o, args) => picker.AnimClip.Begin());
                picker.Setup();
                dialogService.Show(null);
            }
        }
Exemple #3
0
        private void Picker_OnTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            FrameworkElement frameworkElement1 = this.ParentElement ?? (FrameworkElement)this.Page;
            Point            point1            = base.TransformToVisual((UIElement)frameworkElement1).Transform(new Point(0.0, 0.0));
            // ISSUE: explicit reference operation
            // ISSUE: variable of a reference type
            double num1 = point1.X - 16.0;

            point1.X = num1;
            // ISSUE: explicit reference operation
            if (point1.X + this.PickerWidth > 474.0)
            {
                // ISSUE: explicit reference operation
                point1.X = (474.0 - this.PickerWidth);
            }
            Grid grid1 = new Grid();
            int  num2  = 0;

            ((FrameworkElement)grid1).VerticalAlignment = ((VerticalAlignment)num2);
            int num3 = 0;

            ((FrameworkElement)grid1).HorizontalAlignment = ((HorizontalAlignment)num3);
            Grid grid2 = grid1;
            ObservableCollection <ListPickerListItem> observableCollection = new ObservableCollection <ListPickerListItem>();
            ListPickerListItem listPickerListItem1 = null;

            foreach (object fromObj in (IEnumerable)this.ItemsSource)
            {
                ListPickerListItem listPickerListItem2 = new ListPickerListItem(fromObj)
                {
                    Prefix = this.ItemPrefix
                };
                observableCollection.Add(listPickerListItem2);
                object selectedItem = this.SelectedItem;
                if (fromObj == selectedItem)
                {
                    listPickerListItem2.IsSelected = true;
                    listPickerListItem1            = listPickerListItem2;
                }
            }
            ListPickerItemsUC listPickerItemsUc = new ListPickerItemsUC();

            listPickerItemsUc.ItemsSource  = observableCollection;
            listPickerItemsUc.SelectedItem = listPickerListItem1;
            DataTemplate itemTemplate = this.ItemTemplate;

            listPickerItemsUc.ItemTemplate = itemTemplate;
            double pickerMaxHeight = this.PickerMaxHeight;

            listPickerItemsUc.PickerMaxHeight = pickerMaxHeight;
            double pickerWidth = this.PickerWidth;

            listPickerItemsUc.PickerWidth = pickerWidth;
            FrameworkElement frameworkElement2 = frameworkElement1;

            listPickerItemsUc.ParentElement = frameworkElement2;
            Point point2 = point1;

            listPickerItemsUc.ShowPosition = point2;
            ListPickerItemsUC picker = listPickerItemsUc;

            ((PresentationFrameworkCollection <UIElement>)((Panel)grid2).Children).Add((UIElement)picker);
            DialogService dialogService = new DialogService();

            dialogService.AnimationType = DialogService.AnimationTypes.None;
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);

            dialogService.BackgroundBrush = (Brush)solidColorBrush;
            Grid grid3 = grid2;

            dialogService.Child = (FrameworkElement)grid3;
            DialogService ds = dialogService;

            ((UIElement)picker.listBox).Tap += ((EventHandler <System.Windows.Input.GestureEventArgs>)((o, args) =>
            {
                ListPickerListItem selectedItem = picker.listBox.SelectedItem as ListPickerListItem;
                if (selectedItem != null)
                {
                    this.SelectedItem = this.ItemsSource[picker.ItemsSource.IndexOf(selectedItem)];
                }
                ((Timeline)picker.AnimClipHide).Completed += ((EventHandler)((sender1, eventArgs) => ds.Hide()));
                picker.AnimClipHide.Begin();
            }));
            picker.Setup();
            ds.Opened += (EventHandler)((o, args) => picker.AnimClip.Begin());
            ds.Show(null);
        }
 private void OnClicked(object sender, GestureEventArgs e)
 {
     if (!this.IsPopupSelection)
     {
         EventHandler <GestureEventArgs> eventHandler = this.Click;
         if (eventHandler != null)
         {
             object           sender1 = sender;
             GestureEventArgs e1      = e;
             eventHandler(sender1, e1);
         }
         if (e.Handled)
         {
             return;
         }
         Navigator.Current.NavigateToCustomListPickerSelection(this);
     }
     else
     {
         FrameworkElement frameworkElement1 = (FrameworkElement)((ContentControl)Application.Current.RootVisual).Content;
         Point            point1            = this.TransformToVisual((UIElement)frameworkElement1).Transform(new Point()
         {
             X = -16.0,
             Y = 0.0
         });
         if (point1.X + this.PopupSelectionWidth > 480.0)
         {
             point1.X = 480.0 - this.PopupSelectionWidth;
         }
         ListPickerListItem listPickerListItem1 = (ListPickerListItem)null;
         ObservableCollection <ListPickerListItem> observableCollection = new ObservableCollection <ListPickerListItem>();
         foreach (CustomListPickerItem customListPickerItem in this.ItemsSource)
         {
             ListPickerListItem listPickerListItem2 = new ListPickerListItem((object)customListPickerItem);
             observableCollection.Add(listPickerListItem2);
             CustomListPickerItem selectedItem = this.SelectedItem;
             if (customListPickerItem == selectedItem)
             {
                 listPickerListItem2.IsSelected = true;
                 listPickerListItem1            = listPickerListItem2;
             }
         }
         ListPickerItemsUC listPickerItemsUc = new ListPickerItemsUC();
         listPickerItemsUc.ItemsSource     = observableCollection;
         listPickerItemsUc.SelectedItem    = listPickerListItem1;
         listPickerItemsUc.PickerMaxHeight = 480.0;
         double popupSelectionWidth = this.PopupSelectionWidth;
         listPickerItemsUc.PickerWidth = popupSelectionWidth;
         FrameworkElement frameworkElement2 = frameworkElement1;
         listPickerItemsUc.ParentElement = frameworkElement2;
         Point point2 = point1;
         listPickerItemsUc.ShowPosition = point2;
         listPickerItemsUc.ItemTemplate = null;
         ListPickerItemsUC picker = listPickerItemsUc;
         Grid grid1 = new Grid();
         int  num1  = 0;
         grid1.VerticalAlignment = (VerticalAlignment)num1;
         int num2 = 0;
         grid1.HorizontalAlignment = (HorizontalAlignment)num2;
         Grid grid2 = grid1;
         grid2.Children.Add((UIElement)picker);
         DialogService dialogService1 = new DialogService();
         dialogService1.AnimationType = DialogService.AnimationTypes.None;
         SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.Transparent);
         dialogService1.BackgroundBrush = (Brush)solidColorBrush;
         Grid grid3 = grid2;
         dialogService1.Child = (FrameworkElement)grid3;
         DialogService dialogService = dialogService1;
         picker.listBox.Tap += (EventHandler <GestureEventArgs>)((o, args) =>
         {
             ListPickerListItem listPickerListItem = picker.listBox.SelectedItem as ListPickerListItem;
             if (listPickerListItem != null)
             {
                 this.SelectedItem = this.ItemsSource[picker.ItemsSource.IndexOf(listPickerListItem)];
             }
             picker.AnimClipHide.Completed += (EventHandler)((s, a) => dialogService.Hide());
             picker.AnimClipHide.Begin();
         });
         dialogService.Opened += (EventHandler)((o, args) => picker.AnimClip.Begin());
         picker.Setup();
         dialogService.Show((UIElement)null);
     }
 }