首次提交:添加src文件夹代码
This commit is contained in:
56
Cowain.Bake.UI/Helper/ViewModels/AboutWindowViewModel.cs
Normal file
56
Cowain.Bake.UI/Helper/ViewModels/AboutWindowViewModel.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Cowain.Bake.Common.Core;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.Helper.ViewModels
|
||||
{
|
||||
public class AboutWindowViewModel : ViewModelBase
|
||||
{
|
||||
private string windowTitle = $"About - {Global.VS}";
|
||||
public string WindowTitle
|
||||
{
|
||||
get => windowTitle;
|
||||
set => SetProperty(ref windowTitle, value);
|
||||
}
|
||||
|
||||
private string heading = $"{SettingProvider.Instance.ProductionLineName}";
|
||||
public string Heading
|
||||
{
|
||||
get => heading;
|
||||
set => SetProperty(ref heading, value);
|
||||
}
|
||||
private string notes ;
|
||||
public string Notes
|
||||
{
|
||||
get => notes;
|
||||
set => SetProperty(ref notes, value);
|
||||
}
|
||||
|
||||
public AboutWindowViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "文件版本";
|
||||
LoadData();
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
string content = File.ReadAllText("Notes.txt");
|
||||
if (content != null)
|
||||
{
|
||||
Notes = content;
|
||||
}
|
||||
else
|
||||
{
|
||||
Notes = "No release notes available.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
21
Cowain.Bake.UI/Helper/ViewModels/HelpWindowViewModel.cs
Normal file
21
Cowain.Bake.UI/Helper/ViewModels/HelpWindowViewModel.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Cowain.Bake.Common;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Unity;
|
||||
|
||||
namespace Cowain.Bake.UI.Helper.ViewModels
|
||||
{
|
||||
public class HelpWindowViewModel : ViewModelBase
|
||||
{
|
||||
public HelpWindowViewModel(IUnityContainer unityContainer, IRegionManager regionManager) : base(unityContainer, regionManager)
|
||||
{
|
||||
this.PageTitle = "帮助手册";
|
||||
_unityContainer = unityContainer;
|
||||
_regionManager = regionManager;
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Cowain.Bake.UI/Helper/Views/AboutWindowView.xaml
Normal file
26
Cowain.Bake.UI/Helper/Views/AboutWindowView.xaml
Normal file
@@ -0,0 +1,26 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.Helper.Views.AboutWindowView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.Helper.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<DockPanel Margin="0">
|
||||
<!-- 标题 & 版本 -->
|
||||
<TextBlock DockPanel.Dock="Top" FontSize="18" FontWeight="SemiBold"
|
||||
Text="{Binding Heading}" Margin="0 0 0 10"/>
|
||||
|
||||
<TextBlock DockPanel.Dock="Top" FontSize="18" FontWeight="SemiBold"
|
||||
Text="{Binding WindowTitle}" Margin="0 0 0 10"/>
|
||||
<!-- Release Notes -->
|
||||
<ScrollViewer VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto">
|
||||
|
||||
<TextBlock Text="{Binding Notes}"
|
||||
TextWrapping="Wrap"
|
||||
FontFamily="Consolas" FontSize="16"/>
|
||||
</ScrollViewer>
|
||||
|
||||
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
28
Cowain.Bake.UI/Helper/Views/AboutWindowView.xaml.cs
Normal file
28
Cowain.Bake.UI/Helper/Views/AboutWindowView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Cowain.Bake.UI.Helper.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// AboutWindowView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class AboutWindowView : UserControl
|
||||
{
|
||||
public AboutWindowView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml
Normal file
14
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<UserControl x:Class="Cowain.Bake.UI.Helper.Views.HelpWindowView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Cowain.Bake.UI.Helper.Views"
|
||||
xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
<Grid>
|
||||
<WebBrowser x:Name="webBrowser"/>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
31
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml.cs
Normal file
31
Cowain.Bake.UI/Helper/Views/HelpWindowView.xaml.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Spire.Doc;
|
||||
using System.IO;
|
||||
|
||||
|
||||
namespace Cowain.Bake.UI.Helper.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// HelpWindowView.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class HelpWindowView : System.Windows.Controls.UserControl
|
||||
{
|
||||
public HelpWindowView()
|
||||
{
|
||||
InitializeComponent();
|
||||
LoadWordAsHtml(".\\doc.docx");
|
||||
}
|
||||
|
||||
private void LoadWordAsHtml(string filePath)
|
||||
{
|
||||
Document doc = new Document();
|
||||
doc.LoadFromFile(filePath);
|
||||
|
||||
// 转换为HTML
|
||||
string tempHtml = Path.Combine(Path.GetTempPath(), "temp.html");
|
||||
doc.SaveToFile(tempHtml, FileFormat.Html);
|
||||
|
||||
// 显示在WebBrowser
|
||||
webBrowser.Navigate(tempHtml);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user