1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
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
{
/// <summary>
/// Interaction logic for LayoutView.xaml
/// </summary>
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;
}
}
}
|