private void SetsScrollViewer_Loaded(object sender, RoutedEventArgs e) { _setsScroller.Loaded -= SetsScrollViewer_Loaded; if (_setsScrollBackButton != null) { _setsScrollBackButton.Click -= ScrollSetBackButton_Click; } if (_setsScrollForwardButton != null) { _setsScrollForwardButton.Click -= ScrollSetForwardButton_Click; } _setsScrollBackButton = _setsScroller.FindDescendantByName(SetsScrollBackButtonName) as ButtonBase; _setsScrollForwardButton = _setsScroller.FindDescendantByName(SetsScrollForwardButtonName) as ButtonBase; _setsItemsScrollViewerLeftSideShadow = _setsScroller.FindDescendantByName(SetsItemsScrollViewerLeftSideShadowName) as DropShadowPanel; _setsItemsScrollViewerRightSideShadow = _setsScroller.FindDescendantByName(SetsItemsScrollViewerRightSideShadowName) as DropShadowPanel; if (_setsScrollBackButton != null) { _setsScrollBackButton.Click += ScrollSetBackButton_Click; } if (_setsScrollForwardButton != null) { _setsScrollForwardButton.Click += ScrollSetForwardButton_Click; } }
public MainView() { this.InitializeComponent(); HeaderD = HeaderDirect; MainFrame = StoryFr; MainViewPivot = PivotView; }
private Grid CreateControlShadow(DanmakuModel model) { //创建基础控件 TextBlock tx = new TextBlock(); DropShadowPanel dropShadowPanel = new DropShadowPanel() { BlurRadius = 6, ShadowOpacity = 1, OffsetX = 0, OffsetY = 0, Color = SetBorder(model.color) }; Grid grid = new Grid(); tx.Text = model.text; tx.FontWeight = FontWeights.Bold; tx.Foreground = new SolidColorBrush(model.color); //弹幕大小 double size = model.size * sizeZoom; tx.FontSize = size; dropShadowPanel.Content = tx; grid.Children.Add(dropShadowPanel); grid.Tag = model; return(grid); }
/// <summary> /// Add minor update notification row /// </summary> /// <param name="moduleMenu">Module menu panel</param> private void AddMinorUpdateRow(Panel moduleMenu) { RelativePanel MinorUpdatePanel = new RelativePanel(); Grid.SetRow(MinorUpdatePanel, 1); DropShadowPanel MinorUpdateShadow = new DropShadowPanel { Style = ApplicationBase.Current.Resources["ShadowContent"] as Style, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch }; RelativePanel.SetAlignTopWithPanel(MinorUpdateShadow, true); RelativePanel.SetAlignBottomWithPanel(MinorUpdateShadow, true); RelativePanel.SetAlignRightWithPanel(MinorUpdateShadow, true); RelativePanel.SetAlignLeftWithPanel(MinorUpdateShadow, true); Grid MinorUpdateContent = new Grid { Style = ApplicationBase.Current.Resources["ContentGrid"] as Style, HorizontalAlignment = HorizontalAlignment.Stretch }; Button MinorUpdateClose = new Button { Background = new SolidColorBrush(Windows.UI.Colors.Transparent), Content = "", Height = 40, Width = 40, FontFamily = new FontFamily("Segoe MDL2 Assets"), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Right, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Center, Margin = new Thickness(0, 0, 10, 0) }; Binding minorUpdateCloseBinding = new Binding { Source = (DataContext as MainPageVMBase).CloseMinor }; BindingOperations.SetBinding(MinorUpdateClose, Button.CommandProperty, minorUpdateCloseBinding); TextBlock MinorUpdateText = new TextBlock { Text = "Your app has been udpated to version " + (DataContext as MainPageVMBase).CurrentVersion, Margin = new Thickness(10, 10, 50, 10), VerticalAlignment = VerticalAlignment.Center }; MinorUpdateContent.Children.Add(MinorUpdateClose); MinorUpdateContent.Children.Add(MinorUpdateText); MinorUpdateShadow.Content = MinorUpdateContent; MinorUpdatePanel.Children.Add(MinorUpdateShadow); moduleMenu.Children.Add(MinorUpdatePanel); }
/// <summary> /// Add module menu into page /// </summary> /// <param name="container">COntainer</param> public virtual void AddModuleMenu(Panel container) { if (container == null) { throw new ArgumentNullException("Parameter container is null."); } var pageHeader = container.Children.FirstOrDefault(x => (x as FrameworkElement).Name == "PageHeader"); DropShadowPanel ShadowPanel = new DropShadowPanel { Style = ApplicationBase.Current.Resources["ShadowContent"] as Style, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch }; RelativePanel.SetBelow(ShadowPanel, pageHeader); RelativePanel.SetAlignBottomWithPanel(ShadowPanel, true); RelativePanel.SetAlignRightWithPanel(ShadowPanel, true); RelativePanel.SetAlignLeftWithPanel(ShadowPanel, true); Grid ContentGrid = new Grid { Style = ApplicationBase.Current.Resources["ContentGrid"] as Style }; RowDefinition RowMain = new RowDefinition(); RowDefinition MinorUpdateRow = new RowDefinition(); ValueWhenConverter boolToGridLength = new ValueWhenConverter { When = true, Value = new GridLength(50), Otherwise = new GridLength(0) }; Binding minorUpdateRowBinding = new Binding { Source = (DataContext as MainPageVMBase).ShowMinorUpdate, Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged, Converter = boolToGridLength }; BindingOperations.SetBinding(MinorUpdateRow, RowDefinition.HeightProperty, minorUpdateRowBinding); var MPVMB = DataContext as MainPageVMBase; ApplicationBase.Current.PropertyChangedNotifier.RegisterProperty(MinorUpdateRow, RowDefinition.HeightProperty, nameof(MPVMB.ShowMinorUpdate), viewModelType, converter: boolToGridLength); ContentGrid.RowDefinitions.Add(RowMain); ContentGrid.RowDefinitions.Add(MinorUpdateRow); AddMenuList(ContentGrid); AddMinorUpdateRow(ContentGrid); ShadowPanel.Content = ContentGrid; container.Children.Add(ShadowPanel); }
public MainView() { this.InitializeComponent(); //StoryFr.Navigate(typeof(Page)); HeaderD = HeaderDirect; MainFrame = StoryFr; MainViewPivot = PivotView; }
public static void HideHoverAnimation(DropShadowPanel shadowPanel, Border hoverArea) { shadowPanel.DropShadow.StartAnimation("Offset.Y", shadowPanel.DropShadow.Compositor.CreateScalarKeyFrameAnimation(null, 3.0f, TimeSpan.FromMilliseconds(250), null)); shadowPanel.DropShadow.StartAnimation("BlurRadius", shadowPanel.DropShadow.Compositor.CreateScalarKeyFrameAnimation(null, 8.0f, TimeSpan.FromMilliseconds(250), null)); shadowPanel.DropShadow.StartAnimation("Opacity", shadowPanel.DropShadow.Compositor.CreateScalarKeyFrameAnimation(null, 0.6f, TimeSpan.FromMilliseconds(250), null)); shadowPanel.Offset(0, 0, 250, 0).Start(); hoverArea.Fade(0.3f, 200).Start(); }
private Grid CreateControlShadow(DanMuModel model) { //创建基础控件 TextBlock tx = new TextBlock(); DropShadowPanel dropShadowPanel = new DropShadowPanel() { BlurRadius = 6, ShadowOpacity = 1, OffsetX = 0, OffsetY = 0, Color = SetBorder(model.DanColor.Color) }; Grid grid = new Grid(); //设置控件相关信息 grid.Margin = new Thickness(0, 0, 20, 0); grid.VerticalAlignment = VerticalAlignment.Center; grid.HorizontalAlignment = HorizontalAlignment.Left; if (fontFamily != "默认") { tx.FontFamily = new FontFamily(fontFamily); } tx.Text = model.DanText; tx.FontWeight = FontWeights.Bold; tx.Foreground = model.DanColor; //弹幕大小 double size = double.Parse(model.DanSize); if (size == 25) { tx.FontSize = fontSize; } else { tx.FontSize = fontSize - 2; } dropShadowPanel.Content = tx; grid.Children.Add(dropShadowPanel); return(grid); }
public async Task Init() { await App.Dispatcher.EnqueueAsync(() => { _dropShadowPanel = new DropShadowPanel { BlurRadius = 8, ShadowOpacity = 1, OffsetX = 2, OffsetY = 2, Color = Colors.Black, VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, IsMasked = true }; TestsPage.Instance.SetMainTestContent(_dropShadowPanel); }); }
/// <summary> /// 创建阴影弹幕 /// </summary> /// <param name="sizeZoom"></param> /// <param name="bold"></param> /// <param name="fontFamily"></param> /// <param name="model"></param> /// <returns></returns> public static Grid CreateControlShadow(float sizeZoom, bool bold, string fontFamily, DanmakuModel model) { //创建基础控件 TextBlock tx = new TextBlock(); DropShadowPanel dropShadowPanel = new DropShadowPanel() { BlurRadius = 6, ShadowOpacity = 1, OffsetX = 0, OffsetY = 0, Color = GetBorderColor(model.color) }; Grid grid = new Grid(); tx.Text = model.text; if (bold) { tx.FontWeight = FontWeights.Bold; } if (fontFamily != "") { tx.FontFamily = new FontFamily(fontFamily); } tx.Foreground = new SolidColorBrush(model.color); //弹幕大小 double size = model.size * sizeZoom; tx.FontSize = size; dropShadowPanel.Content = tx; grid.Children.Add(dropShadowPanel); grid.Tag = model; return(grid); }
private void NoteItem_Grid_PointerCanceled(object sender, PointerRoutedEventArgs e) { ScaleAnimation animation = new ScaleAnimation() { To = "1", Duration = TimeSpan.FromMilliseconds(600) }; animation.StartAnimation(sender as UIElement); DropShadowPanel shadowPanel = (sender as UIElement).GetFirstDescendantOfType <DropShadowPanel>(); Button delBtn = (sender as UIElement).GetFirstDescendantOfType <Button>(); OpacityAnimation opacityAnimation = new OpacityAnimation() { To = 0, Duration = TimeSpan.FromMilliseconds(600) }; OpacityAnimation buttonOpacityAnimation = new OpacityAnimation() { To = 0, Duration = TimeSpan.FromMilliseconds(200) }; opacityAnimation.StartAnimation(shadowPanel); buttonOpacityAnimation.StartAnimation(delBtn); }
public ChaosControl(int largeSize, int tinySize, SolidColorBrush foregroundColor, SolidColorBrush backgroundColor, string title = "", string xLabel = "", string yLabel = "") { // -------- Parameters -------- InstanceNumber = NumberOfControls; NumberOfControls++; // -------- UI Elements -------- ChaosForegroundColor = foregroundColor; ChaosBackgroundColor = backgroundColor; ChaosCanvas = new Canvas(); ChaosCanvas.Width = largeSize; ChaosCanvas.Height = largeSize; ChaosCanvas.Visibility = Visibility.Collapsed; ChaosBorder = new Border(); ChaosBorder.Width = largeSize; ChaosBorder.Height = largeSize; ChaosBorder.Background = backgroundColor; ChaosBorder.CornerRadius = new CornerRadius(15); ChaosShadow = new DropShadowPanel(); ChaosShadow.Color = Windows.UI.Colors.Black; ChaosShadow.BlurRadius = 7; ChaosShadow.ShadowOpacity = 1; ChaosShadow.OffsetX = 0; ChaosShadow.OffsetY = 0; ChaosEllipse = new Ellipse(); ChaosEllipse.Fill = foregroundColor; ChaosEllipse.Height = 30; ChaosEllipse.Width = 30; ChaosEllipse.Stroke = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); ChaosEllipse.StrokeThickness = 4; TargetEllipse = new Ellipse(); TargetEllipse.Fill = new SolidColorBrush(Colors.Transparent); TargetEllipse.Height = 30; TargetEllipse.Width = 30; TargetEllipse.Stroke = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); TargetEllipse.StrokeThickness = 4; TargetEllipse.Opacity = 0; InnerNotifier = new TextBlock(); InnerNotifier.Margin = new Thickness(0, TargetEllipse.Height, 0, 0); InnerNotifier.Text = "recording"; InnerNotifier.Foreground = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); InnerNotifier.Style = (Style)Application.Current.Resources["SubtitleTextBlockStyle"]; InnerNotifier.Opacity = 0; ChaosButton = new Button(); ChaosButton.Width = largeSize; ChaosButton.Height = largeSize; ChaosButton.Background = new SolidColorBrush(Windows.UI.Colors.Transparent); XLabel = new TextBlock(); Canvas.SetTop(XLabel, ChaosCanvas.Height); XLabel.Text = xLabel; XLabel.Style = (Style)Application.Current.Resources["SubheaderTextBlockStyle"]; YLabel = new TextBlock(); Canvas.SetTop(YLabel, ChaosCanvas.Height); YLabel.Text = yLabel; YLabel.Style = (Style)Application.Current.Resources["SubheaderTextBlockStyle"]; Canvas.SetLeft(YLabel, -50); YLabel.Rotate(-90, 0, 0, 0).Start(); ChaosCanvas.Children.Add(ChaosBorder); ChaosCanvas.Children.Add(XLabel); ChaosCanvas.Children.Add(YLabel); ChaosCanvas.Children.Add(TargetEllipse); ChaosCanvas.Children.Add(InnerNotifier); ChaosCanvas.Children.Add(ChaosShadow); ChaosShadow.Content = ChaosEllipse; ChaosCanvas.Children.Add(ChaosButton); // -------- The Ghosts -------- GhostCanvas = new Canvas(); GhostCanvas.Width = ChaosCanvas.Width; GhostCanvas.Height = ChaosCanvas.Height; GhostCanvas.Background = new SolidColorBrush(Windows.UI.Colors.Transparent); GhostCanvas.Visibility = Visibility.Visible; GhostShadow = new DropShadowPanel(); GhostShadow.Color = foregroundColor.Color; GhostShadow.BlurRadius = ChaosShadow.BlurRadius; GhostShadow.ShadowOpacity = ChaosShadow.ShadowOpacity; GhostShadow.OffsetX = ChaosShadow.OffsetX; GhostShadow.OffsetY = ChaosShadow.OffsetY; GhostEllipse = new Ellipse(); GhostEllipse.Fill = ChaosEllipse.Fill; GhostEllipse.Height = ChaosEllipse.Height; GhostEllipse.Width = ChaosEllipse.Width; GhostEllipse.Stroke = ChaosEllipse.Stroke; GhostEllipse.StrokeThickness = ChaosEllipse.StrokeThickness; GhostEllipse.Fade((float)0.6, 0).Start(); GhostShadow.Content = GhostEllipse; GhostCanvas.Children.Add(GhostShadow); // -------- Now the Tiny stuff -------- ChaosButtonsNoLabel = new StackPanel(); ChaosButtonsNoLabel.Orientation = Orientation.Horizontal; ChaosButtons = new StackPanel(); ChaosButtons.Margin = new Thickness(10); ChaosTitle = new TextBlock(); ChaosTitle.Style = (Style)Application.Current.Resources["SubtitleTextBlockStyle"]; ChaosTitle.Margin = new Thickness(10, 0, 10, 0); ChaosTitle.Text = title; TinyCanvas = new Canvas(); TinyCanvas.Width = tinySize; TinyCanvas.Height = tinySize; TinyCanvas.Margin = new Thickness(10); TinyBorder = new Border(); TinyBorder.Width = tinySize; TinyBorder.Height = tinySize; TinyBorder.Background = backgroundColor; TinyBorder.CornerRadius = new CornerRadius(10); TinyEllipse = new Ellipse(); TinyEllipse.Fill = foregroundColor; TinyEllipse.Height = 15; TinyEllipse.Width = 15; TinyEllipse.Stroke = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); TinyEllipse.StrokeThickness = 2; TinyButton = new Button(); TinyButton.Width = tinySize; TinyButton.Height = tinySize; TinyButton.Background = new SolidColorBrush(Windows.UI.Colors.Transparent); TinyCanvas.Children.Add(TinyBorder); TinyCanvas.Children.Add(TinyEllipse); TinyCanvas.Children.Add(TinyButton); SnapshotButton = new ToggleButton(); SnapshotButton.Width = tinySize; SnapshotButton.Height = tinySize; SnapshotButton.Margin = new Thickness(10); SnapshotButton.FontFamily = new FontFamily("Segoe MDL2 Assets"); SnapshotButton.Content = "\uEA3A"; SnapshotButton.FontWeight = FontWeights.Medium; ChaosNotifier = new InAppNotification(); ChaosNotifier.Background = foregroundColor; ChaosNotifier.Foreground = new SolidColorBrush((Color)Application.Current.Resources["SystemAltHighColor"]); ChaosNotifier.ShowDismissButton = false; ChaosNotifier.HorizontalAlignment = HorizontalAlignment.Left; ChaosNotifier.VerticalOffset = 0; ChaosNotifier.HorizontalOffset = -200; ChaosNotifier.FontFamily = new FontFamily("Segoe MDL2 Assets"); ChaosNotifier.HorizontalContentAlignment = HorizontalAlignment.Center; ChaosNotifier.FontSize = 32; ChaosNotifier.Margin = new Thickness(0, 0, 25, 25); ChaosButtonsNoLabel.Children.Add(SnapshotButton); ChaosButtonsNoLabel.Children.Add(TinyCanvas); ChaosButtons.Children.Add(ChaosButtonsNoLabel); ChaosButtons.Children.Add(ChaosTitle); TinyCanvas.Children.Add(ChaosNotifier); // -------- Now the events -------- TinyButton.Click += TinyButton_Click; GazeElement chaosButtonControl = new GazeElement(); GazeInput.SetGazeElement(ChaosButton, chaosButtonControl); chaosButtonControl.DwellProgressFeedback += GazeElement_DwellProgressFeedback; chaosButtonControl.StateChanged += ChaosButtonControl_StateChanged; GazeElement snapshotButtonControl = new GazeElement(); GazeInput.SetGazeElement(SnapshotButton, snapshotButtonControl); snapshotButtonControl.StateChanged += SnapshotButtonControl_StateChanged; SnapshotButton.Click += SnapshotButton_Click; // All automation is hardcoded at one second now // Faster times make it harder to move off the grid and accidentally trigger the ellipse // However, possibly in the future we will want to change this timing and/or sync it to the beat SnapshotPlayer = new DispatcherTimer(); SnapshotPlayer.Tick += MoveEllipse; SnapshotPlayer.Interval = new TimeSpan(0, 0, 1); // -------- Finally add to our list -------- AllControls.Add(this); }
/// <summary> /// Add content into page /// </summary> /// <param name="container">Container</param> protected virtual void AddContent(Panel container) { if (container == null) { throw new ArgumentNullException("Parameter container is null."); } var pageHeader = container.Children.FirstOrDefault(x => (x as FrameworkElement).Name == "PageHeader"); DropShadowPanel ShadowPanel = new DropShadowPanel() { Style = ApplicationBase.Current.Resources["ShadowContent"] as Style, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch, }; RelativePanel.SetBelow(ShadowPanel, pageHeader); RelativePanel.SetAlignBottomWithPanel(ShadowPanel, true); RelativePanel.SetAlignRightWithPanel(ShadowPanel, true); RelativePanel.SetAlignLeftWithPanel(ShadowPanel, true); Grid ContentGrid = new Grid { Style = ApplicationBase.Current.Resources["ContentGrid"] as Style }; ColumnDefinition MasterFrame = new ColumnDefinition(); Binding masterFrameWidthBinding = new Binding() { Source = (GridLength)(DataContext as ViewModelBase).GetPropertyValue("MasterFrame"), Mode = BindingMode.OneWay }; BindingOperations.SetBinding(MasterFrame, ColumnDefinition.WidthProperty, masterFrameWidthBinding); ApplicationBase.Current.PropertyChangedNotifier.RegisterProperty(MasterFrame, ColumnDefinition.WidthProperty, "MasterFrame", viewModelType); slaveFrameCD = new ColumnDefinition(); slaveFrameCD.SetValue(FrameworkElement.NameProperty, "slaveFrameCD"); Binding slaveFrameCDWidthBinding = new Binding() { Source = (DataContext as ViewModelBase).GetPropertyValue("PaneVisibility"), Mode = BindingMode.OneWay, Converter = new BoolToGridVisibilityConverter() }; BindingOperations.SetBinding(slaveFrameCD, ColumnDefinition.WidthProperty, slaveFrameCDWidthBinding); ApplicationBase.Current.PropertyChangedNotifier.RegisterProperty(slaveFrameCD, ColumnDefinition.WidthProperty, "PaneVisibility", viewModelType, converter: new BoolToGridVisibilityConverter()); ContentGrid.ColumnDefinitions.Add(MasterFrame); ContentGrid.ColumnDefinitions.Add(slaveFrameCD); AddDataViewPart(ContentGrid); AddInAppNotify(ContentGrid); AddLoading(ContentGrid); AddSlavePane(ContentGrid); ShadowPanel.Content = ContentGrid; container.Children.Add(ShadowPanel); }