improve:启动台插件
This commit is contained in:
@@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
<!-- 操作按钮 -->
|
<!-- 操作按钮 -->
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
|
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
|
||||||
<Button x:Name="BtnAdd" Content="添加应用" Padding="10,5" Margin="0,5,5,5" Click="BtnAdd_Click"/>
|
<Button x:Name="BtnAdd" Content="添加" Padding="10,5" Margin="0,5,5,5" Click="BtnAdd_Click"/>
|
||||||
<Button x:Name="BtnEdit" Content="编辑" Padding="10,5" Margin="5" Click="BtnEdit_Click"/>
|
<Button x:Name="BtnEdit" Content="编辑" Padding="10,5" Margin="5" Click="BtnEdit_Click"/>
|
||||||
<Button x:Name="BtnDelete" Content="删除" Padding="10,5" Margin="5" Click="BtnDelete_Click"/>
|
<Button x:Name="BtnDelete" Content="删除" Padding="10,5" Margin="5" Click="BtnDelete_Click"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
@@ -88,34 +88,23 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加应用按钮点击事件
|
/// 添加按钮点击事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void BtnAdd_Click(object sender, RoutedEventArgs e)
|
private void BtnAdd_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 弹出文件选择对话框
|
// 创建新的启动项
|
||||||
OpenFileDialog dialog = new OpenFileDialog
|
LauncherItem item = new LauncherItem
|
||||||
{
|
{
|
||||||
Title = "选择应用程序",
|
Name = "",
|
||||||
Filter = "应用程序 (*.exe)|*.exe|所有文件 (*.*)|*.*",
|
Path = "",
|
||||||
Multiselect = false
|
IsVisible = true,
|
||||||
|
Position = -1 // 让插件管理器分配位置
|
||||||
};
|
};
|
||||||
|
|
||||||
if (dialog.ShowDialog() == true)
|
// 直接显示编辑对话框
|
||||||
{
|
EditLauncherItem(item, true);
|
||||||
// 创建新的启动项
|
|
||||||
LauncherItem item = new LauncherItem
|
|
||||||
{
|
|
||||||
Name = System.IO.Path.GetFileNameWithoutExtension(dialog.FileName),
|
|
||||||
Path = dialog.FileName,
|
|
||||||
IsVisible = true,
|
|
||||||
Position = -1 // 让插件管理器分配位置
|
|
||||||
};
|
|
||||||
|
|
||||||
// 显示编辑对话框
|
|
||||||
EditLauncherItem(item, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -217,7 +206,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
// 创建简单的编辑窗口
|
// 创建简单的编辑窗口
|
||||||
Window editWindow = new Window
|
Window editWindow = new Window
|
||||||
{
|
{
|
||||||
Title = isNew ? "添加应用" : "编辑应用",
|
Title = isNew ? "添加" : "编辑应用",
|
||||||
Width = 400,
|
Width = 400,
|
||||||
Height = 200,
|
Height = 200,
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen,
|
WindowStartupLocation = WindowStartupLocation.CenterScreen,
|
||||||
@@ -292,6 +281,17 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn.SuperLauncher
|
|||||||
if (dialog.ShowDialog() == true)
|
if (dialog.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
pathTextBox.Text = dialog.FileName;
|
pathTextBox.Text = dialog.FileName;
|
||||||
|
|
||||||
|
// 如果选择的是.exe文件,自动获取文件名填入名称字段
|
||||||
|
if (System.IO.Path.GetExtension(dialog.FileName).ToLower() == ".exe")
|
||||||
|
{
|
||||||
|
string fileName = System.IO.Path.GetFileNameWithoutExtension(dialog.FileName);
|
||||||
|
// 只有在名称字段为空或者是新建项目时才自动填入
|
||||||
|
if (string.IsNullOrWhiteSpace(nameTextBox.Text) || isNew)
|
||||||
|
{
|
||||||
|
nameTextBox.Text = fileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Ink_Canvas.Helpers.Plugins.BuiltIn
|
|||||||
|
|
||||||
public override string Description => "在浮动栏添加一个启动台按钮,可快速启动常用应用程序。";
|
public override string Description => "在浮动栏添加一个启动台按钮,可快速启动常用应用程序。";
|
||||||
|
|
||||||
public override Version Version => new Version(1, 0, 0);
|
public override Version Version => new Version(1, 0, 1);
|
||||||
|
|
||||||
public override string Author => "ICC CE 团队";
|
public override string Author => "ICC CE 团队";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user