using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Tango.FSE.UI.Contracts; using Tango.FSE.UI.ViewModels; namespace Tango.FSE.UI.Views { /// /// Interaction logic for LayoutView.xaml /// public partial class LayoutView : UserControl, ILayoutView { public static LayoutView Instance { get; set; } private GridLength gridLogsCheckedHeight = new GridLength(300,GridUnitType.Pixel); private GridLength gridLogsUncheckedHeight; private LayoutViewVM _vm; public LayoutView() { Instance = this; InitializeComponent(); Loaded += (_, __) => _vm = DataContext as LayoutViewVM; gridMask.Visibility = Visibility.Visible; gridMenu.MouseEnter += GridMenu_MouseEnter; gridMenu.MouseLeave += GridMenu_MouseLeave; } private void GridMenu_MouseLeave(object sender, MouseEventArgs e) { _vm.IsMenuOpened = false; StartPointAnimation(polyTopRight, new Point(70, 0)); StartPointAnimation(polyBottomRight, new Point(70, 300)); } private void GridMenu_MouseEnter(object sender, MouseEventArgs e) { _vm.IsMenuOpened = true; StartPointAnimation(polyTopRight, new Point(300, 0)); StartPointAnimation(polyBottomRight, new Point(300, 400)); } private void StartPointAnimation(LineSegment segment, Point to) { PointAnimation ani = new PointAnimation(); ani.Duration = TimeSpan.FromSeconds(0.2); ani.To = to; segment.BeginAnimation(LineSegment.PointProperty, ani); } private void OnLogsChecked(object sender, RoutedEventArgs e) { gridLogsUncheckedHeight = logsRowDefinition.Height; logsRowDefinition.Height = gridLogsCheckedHeight; logsRowDefinition.MinHeight = 200; gridLogsSplitter.Visibility = Visibility.Visible; } private void OnLogsUnChecked(object sender, RoutedEventArgs e) { gridLogsCheckedHeight = logsRowDefinition.Height; logsRowDefinition.MinHeight = 30; logsRowDefinition.Height = gridLogsUncheckedHeight; gridLogsSplitter.Visibility = Visibility.Collapsed; } private void BtnDetachLogViewer_Click(object sender, RoutedEventArgs e) { chkLogsViewer.IsChecked = false; } } }