private void FadeOutEffectStopped(object sender, EventArgs e) { this.dialog.Dispose(); this.dialog = null; this.isHidingDialog = false; }
private void ShowDialog() { if (this.dialog == null) { this.previousSelectedIndex = this.SelectedIndex; this.listSelectedIndex = this.SelectedIndex; this.dialog = new PopupList.CancellableDialog(this); this.dialog.TouchEventReceived += new EventHandler <TouchEventArgs>(this.DialogTouchEventReceived); Label label = new Label(); label.X = 10f; label.Y = 0f; label.Text = this.ListTitle; label.HorizontalAlignment = HorizontalAlignment.Center; this.dialog.AddChildLast(label); int num = label.Font.GetTextWidth(this.ListTitle); foreach (string current in this.ListItems) { int textWidth = this.selectedLabel.Font.GetTextWidth(current); if (num < textWidth) { num = textWidth; } } this.dialog.Width = (float)num * 1.5f; if (this.dialog.Width < this.dialogMinWidth) { this.dialog.Width = this.dialogMinWidth; } if (this.dialogMaxWidth < this.dialog.Width) { this.dialog.Width = this.dialogMaxWidth; } this.dialog.Height = 50f * (float)(this.listItems.Count + 1) + 10f; if (this.dialog.Height < this.dialogMinHeight) { this.dialog.Height = this.dialogMinHeight; } if (this.dialogMaxHeight < this.dialog.Height) { this.dialog.Height = this.dialogMaxHeight; } label.Width = this.dialog.Width - 20f; label.Height = 50f; ListSectionCollection sections = new ListSectionCollection { new ListSection("", this.ListItems.Count) }; ListPanel listPanel = new ListPanel(); listPanel.X = label.X; listPanel.Y = label.Y + label.Height; listPanel.Width = label.Width; listPanel.Height = this.dialog.Height - (label.Y + label.Height) - 10f; listPanel.SetListItemCreator(new ListItemCreator(this.ListItemCreator)); listPanel.SetListItemUpdater(new ListItemUpdater(this.ListItemUpdater)); listPanel.ShowSection = false; listPanel.Sections = sections; DragGestureDetector dragGestureDetector = new DragGestureDetector(); dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.dragEventHandler); listPanel.AddGestureDetector(dragGestureDetector); listPanel.PriorityHit = this.PriorityHit; this.dialog.AddChildLast(listPanel); int num2 = (int)(listPanel.Height / 50f); float num3 = (float)(this.listSelectedIndex - num2 / 2); float num4 = -(num3 * 50f); if (num2 % 2 == 0) { num4 -= 25f; } listPanel.Move(num4); FadeInEffect fadeInEffect = new FadeInEffect(); fadeInEffect.Time = 300f; this.dialog.ShowEffect = fadeInEffect; this.dialog.Show(); } }