public static FadeInEffect CreateAndStart(Widget widget, float time, FadeInEffectInterpolator interpolator) { FadeInEffect fadeInEffect = new FadeInEffect(widget, time, interpolator); fadeInEffect.Start(); return(fadeInEffect); }
public BusyIndicator(bool autoStart) { base.Width = 48f; base.Height = 48f; this.image = new AnimationImageBox(); this.image.Image = new ImageAsset(SystemImageAsset.BusyIndicator); this.image.FrameWidth = 48; this.image.FrameHeight = 48; this.image.FrameCount = 8; this.image.FrameInterval = 66.7f; base.AddChildLast(this.image); this.fadeInEffect = new FadeInEffect(this.image, 200f, FadeInEffectInterpolator.Linear); this.fadeOutEffect = new FadeOutEffect(this.image, 200f, FadeOutEffectInterpolator.Linear); this.fadeOutEffect.EffectStopped += new EventHandler <EventArgs>(this.fadeOutEffect_EffectStopped); if (autoStart) { this.image.Visible = true; this.image.Start(); return; } this.image.Visible = false; this.image.Stop(); }
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(); } }
public NavigationScene() { base.Visible = false; this.navigationPanel = new Panel { Width = (float)UISystem.FramebufferWidth, Height = NavigationScene.navigationBarHeight, X = 0f, Y = -NavigationScene.navigationBarHeight, BackgroundColor = new UIColor(0f, 0f, 0f, 0f) }; base.RootWidget.AddChildLast(this.navigationPanel); this.backgroundImage = new ImageBox { Width = this.navigationPanel.Width, Height = this.navigationPanel.Height, X = 0f, Y = 0f, ImageScaleType = ImageScaleType.NinePatch, Image = new ImageAsset(SystemImageAsset.NavigationBarBackground), NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.NavigationBarBackground) }; this.navigationPanel.AddChildLast(this.backgroundImage); CustomButtonImageSettings customImage = new CustomButtonImageSettings { BackgroundNormalImage = new ImageAsset(SystemImageAsset.BackButtonBackgroundNormal), BackgroundPressedImage = new ImageAsset(SystemImageAsset.BackButtonBackgroundPressed), BackgroundDisabledImage = new ImageAsset(SystemImageAsset.BackButtonBackgroundDisabled), BackgroundNinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.BackButtonBackgroundNormal) }; float num = (NavigationScene.navigationBarHeight - NavigationScene.backButtonHeight) / 2f; Font font = new Font(0, NavigationScene.navigationBarFontSize, 0); this.backButtonCurrent = new Button { Width = NavigationScene.backButtonWidth, Height = NavigationScene.backButtonHeight, X = num, Y = num, TextFont = font, Style = ButtonStyle.Custom, CustomImage = customImage, Visible = false }; this.backButtonCurrent.ButtonAction += new EventHandler <TouchEventArgs>(NavigationScene.PopAction); this.navigationPanel.AddChildLast(this.backButtonCurrent); this.backButtonNext = new Button { Width = NavigationScene.backButtonWidth, Height = NavigationScene.backButtonHeight, X = num, Y = num, TextFont = font, Style = ButtonStyle.Custom, CustomImage = customImage, Visible = false }; this.backButtonNext.ButtonAction += new EventHandler <TouchEventArgs>(NavigationScene.PopAction); this.navigationPanel.AddChildLast(this.backButtonNext); float num2 = this.navigationPanel.Width - NavigationScene.backButtonWidth * 2f - num * 2f; this.leftLabelPosX = -num2; this.centerLabelPosX = NavigationScene.backButtonWidth + num; this.rightLabelPosX = (float)UISystem.FramebufferWidth; this.labelCurrent = new Label { Width = num2, Height = this.navigationPanel.Height, X = this.centerLabelPosX, Y = 0f, Font = font, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Middle }; this.navigationPanel.AddChildLast(this.labelCurrent); this.labelNext = new Label { Width = num2, Height = this.navigationPanel.Height, X = this.rightLabelPosX, Y = 0f, Font = font, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Middle, Visible = false }; this.navigationPanel.AddChildLast(this.labelNext); this.panelShowMoveEffect = new MoveEffect { Widget = this.navigationPanel, Interpolator = MoveEffectInterpolator.Custom, CustomInterpolator = new AnimationInterpolator(NavigationScene.EaseOutQuartInterpolator), Time = NavigationScene.showHideAnimationDuration, X = 0f, Y = 0f }; this.panelHideMoveEffect = new MoveEffect { Widget = this.navigationPanel, Interpolator = MoveEffectInterpolator.Custom, CustomInterpolator = new AnimationInterpolator(NavigationScene.EaseOutQuartInterpolator), Time = NavigationScene.showHideAnimationDuration, X = 0f, Y = -NavigationScene.navigationBarHeight }; this.panelHideMoveEffect.EffectStopped += new EventHandler <EventArgs>(this.OnPanelHideMoveEffectStopped); this.labelCurrentMoveEffect = new MoveEffect { Interpolator = MoveEffectInterpolator.Custom, CustomInterpolator = new AnimationInterpolator(NavigationScene.EaseOutQuartInterpolator), Time = NavigationScene.stackAnimationTime }; this.labelCurrentMoveEffect.EffectStopped += new EventHandler <EventArgs>(this.OnLabelMoveEffectStopped); this.labelCurrentFadeOutEffect = new FadeOutEffect { Interpolator = FadeOutEffectInterpolator.Linear, Time = NavigationScene.stackAnimationTime }; this.labelNextMoveEffect = new MoveEffect { Interpolator = MoveEffectInterpolator.Custom, CustomInterpolator = new AnimationInterpolator(NavigationScene.EaseOutQuartInterpolator), Time = NavigationScene.stackAnimationTime }; this.labelNextFadeInEffect = new FadeInEffect { Interpolator = FadeInEffectInterpolator.Linear, Time = NavigationScene.stackAnimationTime }; this.backButtonCurrentFadeOutEffect = new FadeOutEffect { Interpolator = FadeOutEffectInterpolator.Linear, Time = NavigationScene.stackAnimationTime }; this.backButtonNextFadeInEffect = new FadeInEffect { Interpolator = FadeInEffectInterpolator.Linear, Time = NavigationScene.stackAnimationTime }; }