diff --git a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj index 48bcbec0..df7e75e6 100644 --- a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj +++ b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj @@ -42,7 +42,15 @@ + + + + + + + + @@ -174,9 +182,33 @@ Always + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + Always + + Always + + + Always + Always diff --git a/BPASmartClient.SCADAControl/Images/右1.png b/BPASmartClient.SCADAControl/Images/右1.png new file mode 100644 index 00000000..ad0b2a90 Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/右1.png differ diff --git a/BPASmartClient.SCADAControl/Images/右2.png b/BPASmartClient.SCADAControl/Images/右2.png new file mode 100644 index 00000000..a56a7839 Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/右2.png differ diff --git a/BPASmartClient.SCADAControl/Images/左1.png b/BPASmartClient.SCADAControl/Images/左1.png new file mode 100644 index 00000000..73bc82ba Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/左1.png differ diff --git a/BPASmartClient.SCADAControl/Images/左2.png b/BPASmartClient.SCADAControl/Images/左2.png new file mode 100644 index 00000000..95c1e6bc Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/左2.png differ diff --git a/BPASmartClient.SCADAControl/Images/拉出 - 副本.png b/BPASmartClient.SCADAControl/Images/拉出 - 副本.png new file mode 100644 index 00000000..06a6baca Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/拉出 - 副本.png differ diff --git a/BPASmartClient.SCADAControl/Images/拉出.png b/BPASmartClient.SCADAControl/Images/拉出.png new file mode 100644 index 00000000..06a6baca Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/拉出.png differ diff --git a/BPASmartClient.SCADAControl/Images/收缩 - 副本.png b/BPASmartClient.SCADAControl/Images/收缩 - 副本.png new file mode 100644 index 00000000..d128d320 Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/收缩 - 副本.png differ diff --git a/BPASmartClient.SCADAControl/Images/收缩.png b/BPASmartClient.SCADAControl/Images/收缩.png new file mode 100644 index 00000000..d128d320 Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/收缩.png differ diff --git a/BPASmartClient.SCADAControl/Images/矩形边框.png b/BPASmartClient.SCADAControl/Images/矩形边框.png index c5b24170..6c1aadae 100644 Binary files a/BPASmartClient.SCADAControl/Images/矩形边框.png and b/BPASmartClient.SCADAControl/Images/矩形边框.png differ diff --git a/BPASmartClient.SCADAControl/Images/矩形边框1.png b/BPASmartClient.SCADAControl/Images/矩形边框1.png new file mode 100644 index 00000000..c5b24170 Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/矩形边框1.png differ diff --git a/BPASmartClient.SCADAControl/Images/系统名称.png b/BPASmartClient.SCADAControl/Images/系统名称.png new file mode 100644 index 00000000..240fb030 Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/系统名称.png differ diff --git a/BPASmartClient.SCADAControl/Themes/Generic.xaml b/BPASmartClient.SCADAControl/Themes/Generic.xaml index d8d24a76..24eacdb2 100644 --- a/BPASmartClient.SCADAControl/Themes/Generic.xaml +++ b/BPASmartClient.SCADAControl/Themes/Generic.xaml @@ -3064,7 +3064,7 @@ - @@ -3107,15 +3113,86 @@ + + + + + + + + + + + + + + + + + diff --git a/BeDesignerSCADA/Controls/MenuRunCanvas.xaml b/BeDesignerSCADA/Controls/MenuRunCanvas.xaml index cf1299e7..c428e98a 100644 --- a/BeDesignerSCADA/Controls/MenuRunCanvas.xaml +++ b/BeDesignerSCADA/Controls/MenuRunCanvas.xaml @@ -19,16 +19,21 @@ - - - + + + - - + + + + + + diff --git a/BeDesignerSCADA/Controls/MenuRunCanvas.xaml.cs b/BeDesignerSCADA/Controls/MenuRunCanvas.xaml.cs index 048fc307..4a3e325d 100644 --- a/BeDesignerSCADA/Controls/MenuRunCanvas.xaml.cs +++ b/BeDesignerSCADA/Controls/MenuRunCanvas.xaml.cs @@ -16,9 +16,11 @@ using System.Windows.Documents; using System.Windows.Input; using System.Windows.Markup; using System.Windows.Media; +using System.Windows.Media.Animation; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using System.Windows.Threading; namespace BeDesignerSCADA.Controls { @@ -28,12 +30,52 @@ namespace BeDesignerSCADA.Controls public partial class MenuRunCanvas : UserControl { MenuRunCanvasModel menuRunCanvasModel = null; + ResourceDictionary languageResDic = new ResourceDictionary(); + DispatcherTimer timer1;//控制菜单显示隐藏功能 public MenuRunCanvas() { InitializeComponent(); - menuRunCanvasModel=new MenuRunCanvasModel(); + + languageResDic.Source = new Uri(@"/BPASmartClient.SCADAControl;component/Themes/Generic.xaml", UriKind.RelativeOrAbsolute); + menuRunCanvasModel =new MenuRunCanvasModel(); this.DataContext=menuRunCanvasModel; + timer1 = new DispatcherTimer(); + timer1.Tick += new System.EventHandler(timer1_Tick); + timer1.Interval = new TimeSpan(0, 0, 0, 0, 1000); + timer1.Start(); + this.Loaded += MenuRunCanvas_Loaded; } + + private void MenuRunCanvas_Loaded(object sender, RoutedEventArgs e) + { + if (menuRunCanvasModel.MenuModel != null) + { + switch (menuRunCanvasModel.MenuModel.Alignment) + { + case MenuAlignment.左边: + menuWidth = wrapanl_main.ActualWidth; + break; + case MenuAlignment.顶部: + menuWidth = wrapanl_main.ActualHeight; + break; + case MenuAlignment.右边: + menuWidth = wrapanl_main.ActualWidth; + break; + case MenuAlignment.底部: + menuWidth = wrapanl_main.ActualHeight; + break; + default: + break; + } + MenuSmall(); + } + } + + private void timer1_Tick(object sender, EventArgs e) + { + times += 1; + } + /// /// 根据路径运行程序 /// @@ -59,7 +101,13 @@ namespace BeDesignerSCADA.Controls wrapanl_main.Orientation = Orientation.Vertical; wrapanl_main.HorizontalAlignment = HorizontalAlignment.Left; wrapanl_main.VerticalAlignment = VerticalAlignment.Stretch; + wrapanl_main.Margin = new Thickness(0, 0, 0, 25); TitleName.Margin = new Thickness(0, 10, 0, 10); + waibustack.Orientation = Orientation.Horizontal; + waibustack.HorizontalAlignment = HorizontalAlignment.Left; + lachu.HorizontalAlignment = HorizontalAlignment.Left; + lachu.VerticalAlignment = VerticalAlignment.Stretch; + lachu.BorderThickness = new Thickness(1, 0, 0, 0); break; case MenuAlignment.顶部: PageList.HorizontalAlignment = HorizontalAlignment.Left; @@ -68,8 +116,15 @@ namespace BeDesignerSCADA.Controls wrapanl_main.Orientation = Orientation.Horizontal; wrapanl_main.HorizontalAlignment = HorizontalAlignment.Stretch; wrapanl_main.VerticalAlignment = VerticalAlignment.Top; - TitleName.LayoutTransform = new RotateTransform(){ Angle = 270 }; + wrapanl_main.Margin = new Thickness(0, 0, 0, 0); + TitleName.LayoutTransform = new RotateTransform(){ Angle = 0 }; TitleName.Margin = new Thickness(10, 0,10, 0); + waibustack.Orientation = Orientation.Vertical; + waibustack.VerticalAlignment = VerticalAlignment.Top; + lachu.HorizontalAlignment = HorizontalAlignment.Stretch; + lachu.VerticalAlignment = VerticalAlignment.Top; + lachu.LayoutTransform = new RotateTransform() { Angle = 270 }; + lachu.BorderThickness = new Thickness(0, 0, 1, 0); break; case MenuAlignment.右边: PageList.HorizontalAlignment = HorizontalAlignment.Right; @@ -78,7 +133,14 @@ namespace BeDesignerSCADA.Controls wrapanl_main.Orientation = Orientation.Vertical; wrapanl_main.HorizontalAlignment = HorizontalAlignment.Right; wrapanl_main.VerticalAlignment = VerticalAlignment.Stretch; + wrapanl_main.Margin = new Thickness(0, 0, 0, 25); TitleName.Margin = new Thickness(0, 10, 0, 10); + menuWidth = wrapanl_main.ActualWidth; + waibustack.Orientation = Orientation.Horizontal; + waibustack.HorizontalAlignment = HorizontalAlignment.Right; + lachu.HorizontalAlignment = HorizontalAlignment.Right; + lachu.VerticalAlignment = VerticalAlignment.Stretch; + lachu.BorderThickness = new Thickness(0, 0,0, 0); break; case MenuAlignment.底部: PageList.HorizontalAlignment = HorizontalAlignment.Left; @@ -87,16 +149,24 @@ namespace BeDesignerSCADA.Controls wrapanl_main.Orientation = Orientation.Horizontal; wrapanl_main.HorizontalAlignment = HorizontalAlignment.Stretch; wrapanl_main.VerticalAlignment = VerticalAlignment.Bottom; - TitleName.LayoutTransform = new RotateTransform() { Angle = 270 }; + wrapanl_main.Margin = new Thickness(0, 0, 0, 0); + TitleName.LayoutTransform = new RotateTransform() { Angle = 0 }; TitleName.Margin = new Thickness(10, 0, 10, 0); + menuWidth = wrapanl_main.ActualHeight; + waibustack.Orientation = Orientation.Vertical; + waibustack.VerticalAlignment = VerticalAlignment.Bottom; + lachu.HorizontalAlignment = HorizontalAlignment.Stretch; + lachu.VerticalAlignment = VerticalAlignment.Bottom; + lachu.LayoutTransform = new RotateTransform() { Angle = 270 }; + lachu.BorderThickness= new Thickness(0, 0, 0, 0); break; default: break; } if(canvas.IsVisibility) - wrapanl_main.Visibility = Visibility.Visible; + waibustack.Visibility = Visibility.Visible; else - wrapanl_main.Visibility = Visibility.Collapsed; + waibustack.Visibility = Visibility.Collapsed; itemsPanelTemplate.VisualTree = _StackPanel; PageList.ItemsPanel = itemsPanelTemplate; menuRunCanvasModel.MenuModel = canvas; @@ -123,6 +193,89 @@ namespace BeDesignerSCADA.Controls menuRunCanvasModel.MenuModel.SelectPageModels.runCanvas.RunSelect(); } } + bool ismove = true; + int times = 0; + /// + /// 鼠标移动 + /// + /// + /// + private void wrapanl_main_MouseMove(object sender, MouseEventArgs e) + { + if (times < 1) + { + return; + } + if (ismove) + { + ismove = false; + MenuBig(); + + } + times = 0; + } + /// + /// 鼠标离开 + /// + /// + /// + private void wrapanl_main_MouseLeave(object sender, MouseEventArgs e) + { + menuWidthDefault = 0; + if (!ismove) + { + ismove = true; + MenuSmall(); + } + times = 0; + } + private int menuWidthDefault = 0; + private double menuWidth = 86; + private void MenuBig() + { + + DoubleAnimation da = new DoubleAnimation(); + da.From = menuWidthDefault; + da.To = menuWidth; + da.Duration = TimeSpan.FromSeconds(0.5); + if (menuRunCanvasModel.MenuModel.Alignment == MenuAlignment.左边 || menuRunCanvasModel.MenuModel.Alignment == MenuAlignment.右边) + { + wrapanl_main.BeginAnimation(WidthProperty, da); + if (languageResDic.Contains("image左1")) + lachuStyle.Style = languageResDic["image左1"] as Style; + } + else if (menuRunCanvasModel.MenuModel.Alignment == MenuAlignment.顶部 || menuRunCanvasModel.MenuModel.Alignment == MenuAlignment.底部) + { + wrapanl_main.BeginAnimation(HeightProperty, da); + if (languageResDic.Contains("image右1")) + lachuStyle.Style = languageResDic["image右1"] as Style; + } + + + } + private void MenuSmall() + { + + DoubleAnimation da = new DoubleAnimation(); + da.From = menuWidth; + da.To = menuWidthDefault; + da.Duration = TimeSpan.FromSeconds(0.5); + if (menuRunCanvasModel.MenuModel.Alignment == MenuAlignment.左边 || menuRunCanvasModel.MenuModel.Alignment == MenuAlignment.右边) + { + if (languageResDic.Contains("image右1")) + lachuStyle.Style = languageResDic["image右1"] as Style; + wrapanl_main.BeginAnimation(WidthProperty, da); + } + else if (menuRunCanvasModel.MenuModel.Alignment == MenuAlignment.顶部 || menuRunCanvasModel.MenuModel.Alignment == MenuAlignment.底部) + { + wrapanl_main.BeginAnimation(HeightProperty, da); + if (languageResDic.Contains("image左1")) + lachuStyle.Style = languageResDic["image左1"] as Style; + } + } + + + } public class MenuRunCanvasModel : ObservableObject