🐛 修复无法修改菜单名称的问题

This commit is contained in:
liufei
2022-05-27 11:19:54 +08:00
parent 9cbbd6cf45
commit f56991410b
3 changed files with 12 additions and 4 deletions

View File

@@ -25,7 +25,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
//是否正在修改菜单
private static bool IS_EDIT = false;
public bool IS_EDIT = false;
public LeftCardControl()
{
@@ -205,9 +205,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
/// <param name="e"></param>
private void RenameMenu(object sender, RoutedEventArgs e)
{
IS_EDIT = true;
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
menuInfo.MenuEdit = (int)Visibility.Visible;
IS_EDIT = true;
}
/// <summary>
@@ -276,6 +276,8 @@ namespace GeekDesk.Control.UserControls.PannelCard
menuInfo.MenuEdit = Visibility.Collapsed;
}
IS_EDIT = false;
//为了解决无法修改菜单的问题
MainWindow.mainWindow.SearchBox.Focus();
MenuListBox.SelectedIndex = menuSelectIndexTemp;
}
}
@@ -309,6 +311,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
private void Menu_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (IS_EDIT) return;
//设置对应菜单的图标列表
if (MenuListBox.SelectedIndex == -1)
{

View File

@@ -125,7 +125,7 @@
</DockPanel>
<uc:LeftCardControl Grid.Row="1" Grid.Column="0"/>
<uc:LeftCardControl x:Name="LeftCard" Grid.Row="1" Grid.Column="0"/>
<!--分割线-->
<GridSplitter Opacity="0" Grid.Row="1" Grid.Column="0" Width="1" VerticalAlignment="Stretch" HorizontalAlignment="Right"/>

View File

@@ -1,5 +1,6 @@
using GeekDesk.Constant;
using GeekDesk.Control.UserControls.Config;
using GeekDesk.Control.UserControls.PannelCard;
using GeekDesk.Control.Windows;
using GeekDesk.Interface;
using GeekDesk.MyThread;
@@ -725,7 +726,11 @@ namespace GeekDesk
private void Window_GotFocus(object sender, RoutedEventArgs e)
{
Keyboard.Focus(SearchBox);
if (!LeftCard.IS_EDIT)
{
//if判断是为了能够使修改菜单时 菜单能够获得焦点
Keyboard.Focus(SearchBox);
}
}
private void AppWindow_Deactivated(object sender, EventArgs e)