Пример #1
0
        private static void SelectedItemPlaceholderPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker     customListPicker1 = (CustomListPicker)sender;
            string               str = (string)e.NewValue;
            CustomListPicker     customListPicker2    = customListPicker1;
            CustomListPickerItem customListPickerItem = new CustomListPickerItem();

            customListPickerItem.Name = str;
            int num = customListPicker1.Placeholder == str ? 1 : (str == null ? 1 : 0);

            customListPickerItem.IsUnknown = num != 0;
            customListPicker2.SelectedItem = customListPickerItem;
        }
Пример #2
0
        private static void SelectedItemPlaceholderPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker customListPicker1 = (CustomListPicker)sender;
            // ISSUE: explicit reference operation
            string               newValue             = (string)e.NewValue;
            CustomListPicker     customListPicker2    = customListPicker1;
            CustomListPickerItem customListPickerItem = new CustomListPickerItem();

            customListPickerItem.Name = newValue;
            int num = customListPicker1.Placeholder == newValue ? 1 : (newValue == null ? 1 : 0);

            customListPickerItem.IsUnknown = num != 0;
            customListPicker2.SelectedItem = customListPickerItem;
        }
Пример #3
0
        private static void SelectedItemPropertyChangedCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            CustomListPicker     customListPicker     = (CustomListPicker)sender;
            CustomListPickerItem customListPickerItem = (CustomListPickerItem)e.NewValue;

            if (customListPickerItem != null && !customListPickerItem.IsUnknown)
            {
                customListPicker.SelectedItemTitleBlock.Text       = customListPickerItem.Name;
                customListPicker.SelectedItemTitleBlock.Foreground = (Brush)Application.Current.Resources["PhoneContrastTitleBrush"];
            }
            else
            {
                customListPicker.SelectedItemTitleBlock.Text       = customListPicker.Placeholder;
                customListPicker.SelectedItemTitleBlock.Foreground = (Brush)Application.Current.Resources["PhoneCommunityManagementSectionIconBrush"];
            }
        }
Пример #4
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);
            }
        }
Пример #5
0
 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);
     }
 }