private RadAnimation GetMovingAnimation(bool isFromLeft) { var transformAnimation = new RadMoveXAnimation { Duration = new Duration(TimeSpan.FromSeconds(DurationInSecond)) }; if (isFromLeft) { transformAnimation.StartX = -BarWidth; transformAnimation.EndX = ScreenWidth + BarWidth; } else { transformAnimation.StartX = ScreenWidth + BarWidth; transformAnimation.EndX = -BarWidth; } return transformAnimation; }
private void AppendFullImageNews() { List<string> ctgyFileList = FileHelper.GetFiles("fbd-ctgy-"); DataModel.ChannelItem targetChannel = null; string targetCategory = null; string targetFile = null; if (ctgyFileList != null && ctgyFileList.Count > 0) { Random random = new Random(); int targetIndex = random.Next(0, ctgyFileList.Count); string targetCategoryFile = ctgyFileList[targetIndex]; targetFile = targetCategoryFile.Replace(".xml", ""); targetCategory = targetCategoryFile.Replace("fbd-ctgy-", "").Replace(".xml", ""); var categoryItem = MiscHelpers.GetCatergoryItemFromIsolatedStorage(targetCategoryFile); if (categoryItem != null && categoryItem.ChannelItems != null && categoryItem.ChannelItems.Count > 0) { targetIndex = random.Next(0, categoryItem.ChannelItems.Count); var targetChannel2 = categoryItem.ChannelItems[targetIndex]; if (targetChannel2 != null && targetChannel2.NewsItems != null && targetChannel2.NewsItems.Count > 0) { targetChannel = targetChannel2; } } } else { List<string> channelFileList = FileHelper.GetFiles("fbd-channel-"); if (channelFileList != null && channelFileList.Count > 0) { Random random = new Random(); int targetIndex = random.Next(0, channelFileList.Count); string targetChannelFile = channelFileList[targetIndex]; targetFile = targetChannelFile.Replace(".xml", ""); var targetChannel2 = MiscHelpers.GetChannelItemFromIsolatedStorage(targetChannelFile); if (targetChannel2 != null && targetChannel2.NewsItems != null && targetChannel2.NewsItems.Count > 0) { targetChannel = targetChannel2; } } } if (targetChannel == null) return; var targetNewsItem = targetChannel.NewsItems[0]; FullImageNewsTitle.Text = targetNewsItem.NewsTitle; FullImageNewsFeedUrl.Text = targetNewsItem.FeedTitle + " " + MiscHelpers.GetNewsDateInfo(targetNewsItem.NewsPublishedDate); if (targetCategory != null) { string defaultPhoto = CategoryConfigA.Config[targetCategory]["photo_home"]; FullImageNewsImage.Source = new BitmapImage(new Uri(defaultPhoto, UriKind.RelativeOrAbsolute)); } var targetItemGuid = targetNewsItem.Tag.ToString(); ContentPanel3.Tap += delegate { Analytics.GetInstance().TrackHomeButtonPressed("fullimage"); Dispatcher.BeginInvoke( () => NavigationService.Navigate(new Uri("/NewsItemFullPage.xaml?category=" + targetCategory + "&storage=" + targetFile + "&viewtype=" + PinType.SubCategory + "&itemguid=" + targetItemGuid , UriKind.Relative))); }; var scaleFadeAnimation = new RadScaleAndFadeAnimation { Duration = new Duration(TimeSpan.FromSeconds(7)) }; scaleFadeAnimation.FadeAnimation.StartOpacity = 0.9; scaleFadeAnimation.FadeAnimation.EndOpacity = 1.0; scaleFadeAnimation.FadeAnimation.Duration = new Duration(TimeSpan.FromSeconds(10)); scaleFadeAnimation.ScaleAnimation.StartScaleX = 1.15; scaleFadeAnimation.ScaleAnimation.EndScaleX = 1.0; scaleFadeAnimation.ScaleAnimation.StartScaleY = 1.15; scaleFadeAnimation.ScaleAnimation.EndScaleY = 1.0; scaleFadeAnimation.ScaleAnimation.Duration = new Duration(TimeSpan.FromSeconds(10)); var moveXAnimation = new RadMoveXAnimation { StartX = 0, EndX = 40, Duration = new Duration(TimeSpan.FromSeconds(10)) }; var moveXAnimation2 = new RadMoveXAnimation { StartX = 40, EndX = 0, Duration = new Duration(TimeSpan.FromSeconds(10)) }; RadAnimationManager.Play(ContentPanel3, scaleFadeAnimation, () => RadAnimationManager.Play(FullImageNewsImage, moveXAnimation, () => RadAnimationManager.Play(FullImageNewsImage, moveXAnimation2, () => RadAnimationManager.Play(FullImageNewsImage, moveXAnimation, () => RadAnimationManager.Play(FullImageNewsImage, moveXAnimation2))))); }