chore: add setting view

dev_settings^2
DESKTOP-3BO4HSG\ksat 2 years ago
parent 41422a0f83
commit 999ed5c459

@ -106,9 +106,13 @@
<Compile Include="Util\Util.cs" /> <Compile Include="Util\Util.cs" />
<Compile Include="ViewModel\MainVM.cs" /> <Compile Include="ViewModel\MainVM.cs" />
<Compile Include="ViewModel\ScreenShotVM.cs" /> <Compile Include="ViewModel\ScreenShotVM.cs" />
<Compile Include="ViewModel\SettingsVM.cs" />
<Compile Include="View\ScreenShotWindow.xaml.cs"> <Compile Include="View\ScreenShotWindow.xaml.cs">
<DependentUpon>ScreenShotWindow.xaml</DependentUpon> <DependentUpon>ScreenShotWindow.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="View\SettingsWindow.xaml.cs">
<DependentUpon>SettingsWindow.xaml</DependentUpon>
</Compile>
<Page Include="View\MainWindow.xaml"> <Page Include="View\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
@ -157,6 +161,10 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="View\SettingsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Model\BaiduModel.cs" /> <Compile Include="Model\BaiduModel.cs" />

@ -3,10 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tb="http://www.hardcodet.net/taskbar"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:vm="clr-namespace:STranslate.ViewModel"
xmlns:local="clr-namespace:STranslate.View"
mc:Ignorable="d" mc:Ignorable="d"
x:Name="Mwin" x:Name="Mwin"
Background="Transparent" Background="Transparent"

@ -101,6 +101,9 @@ namespace STranslate.View
var autoStartBtn = new MenuItem("开机自启"); var autoStartBtn = new MenuItem("开机自启");
autoStartBtn.Click += AutoStart_Click; autoStartBtn.Click += AutoStart_Click;
var preferenceBtn = new MenuItem("首选项");
preferenceBtn.Click += Preference_Click;
autoStartBtn.Checked = StartupHelper.IsStartup(); autoStartBtn.Checked = StartupHelper.IsStartup();
var exitBtn = new MenuItem("退出"); var exitBtn = new MenuItem("退出");
@ -113,11 +116,24 @@ namespace STranslate.View
openMainWinBtn, openMainWinBtn,
checkUpdateBtn, checkUpdateBtn,
autoStartBtn, autoStartBtn,
preferenceBtn,
exitBtn, exitBtn,
}; };
NotifyIcon.ContextMenu = new ContextMenu(items); NotifyIcon.ContextMenu = new ContextMenu(items);
} }
/// <summary>
/// 设置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Preference_Click(object sender, EventArgs e)
{
var setting = new SettingsWindow();
setting.Show();
setting.Activate();
}
/// <summary> /// <summary>
/// 同步Github版本命名 /// 同步Github版本命名
/// </summary> /// </summary>

@ -0,0 +1,29 @@
<Window x:Class="STranslate.View.SettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:vm="clr-namespace:STranslate.ViewModel"
xmlns:local="clr-namespace:STranslate.View"
mc:Ignorable="d"
SizeToContent="Height"
Icon="/Images/translate.ico"
Title="设置" Height="450" Width="400">
<Window.DataContext>
<vm:SettingsVM/>
</Window.DataContext>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<i:InvokeCommandAction Command="{Binding}"/>
</i:EventTrigger>
<i:EventTrigger EventName="Closed">
<i:InvokeCommandAction Command="{Binding}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Grid>
<TabControl>
</TabControl>
</Grid>
</Window>

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
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.Imaging;
using System.Windows.Shapes;
namespace STranslate.View
{
/// <summary>
/// SettingsWindow.xaml 的交互逻辑
/// </summary>
public partial class SettingsWindow : Window
{
public SettingsWindow()
{
InitializeComponent();
}
}
}

@ -0,0 +1,27 @@
using STranslate.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace STranslate.ViewModel
{
public class SettingsVM : BaseVM
{
public SettingsVM()
{
LoadedCmd = new RelayCommand((_) => true, (_) =>
{
Console.WriteLine("123");
});
ClosedCmd = new RelayCommand((_) => true, (_) =>
{
Console.WriteLine("123");
});
}
public ICommand LoadedCmd { get; private set; }
public ICommand ClosedCmd { get; private set; }
}
}
Loading…
Cancel
Save