diff --git "a/SuperCom.Test/\346\265\213\350\257\225\347\224\250\344\276\213/SuperCom-3.3.xlsx" "b/SuperCom.Test/\346\265\213\350\257\225\347\224\250\344\276\213/SuperCom-3.3.xlsx" new file mode 100644 index 0000000..b7c5b9f Binary files /dev/null and "b/SuperCom.Test/\346\265\213\350\257\225\347\224\250\344\276\213/SuperCom-3.3.xlsx" differ diff --git "a/SuperCom.Test/\346\265\213\350\257\225\347\224\250\344\276\213/\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" "b/SuperCom.Test/\346\265\213\350\257\225\347\224\250\344\276\213/\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" index 8b2a9c9..021485f 100644 Binary files "a/SuperCom.Test/\346\265\213\350\257\225\347\224\250\344\276\213/\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" and "b/SuperCom.Test/\346\265\213\350\257\225\347\224\250\344\276\213/\346\265\213\350\257\225\347\224\250\344\276\213.xlsx" differ diff --git a/SuperCom/Config/ConfigManager.cs b/SuperCom/Config/ConfigManager.cs index ff45122..c291d02 100644 --- a/SuperCom/Config/ConfigManager.cs +++ b/SuperCom/Config/ConfigManager.cs @@ -8,7 +8,7 @@ public static class ConfigManager { public const string SQLITE_DATA_PATH = "user_data.sqlite"; - public const string RELEASE_DATE = "2023-03-26"; + public const string RELEASE_DATE = "2023-04-11"; public static Main Main { get; set; } public static CommonSettings CommonSettings { get; set; } public static Settings Settings { get; set; } diff --git a/SuperCom/Config/UrlManager.cs b/SuperCom/Config/UrlManager.cs index 95ffca6..6d6b483 100644 --- a/SuperCom/Config/UrlManager.cs +++ b/SuperCom/Config/UrlManager.cs @@ -28,6 +28,7 @@ public static class UrlManager private static string PluginBasePath = "SuperPlugins"; public static string FeedbackUrl = "https://github.com/SuperStudio/SuperCom/issues"; public static string HelpUrl = "https://github.com/SuperStudio/SuperCom/wiki"; + public const string NOTICE_URL = "https://superstudio.github.io/SuperCom-Upgrade/notice.json"; public static int GetRemoteIndex() { diff --git a/SuperCom/Config/WindowConfig/Main.cs b/SuperCom/Config/WindowConfig/Main.cs index 0293e61..db9fb63 100644 --- a/SuperCom/Config/WindowConfig/Main.cs +++ b/SuperCom/Config/WindowConfig/Main.cs @@ -45,6 +45,7 @@ public static Main CreateInstance() public string OpeningPorts { get; set; } public string CustomBaudRates { get; set; } + public string LatestNotice { get; set; } public bool UseDefaultBaudRate { get; set; } public long CommandsSelectIndex { get; set; } diff --git a/SuperCom/CustomWindows/About.xaml b/SuperCom/CustomWindows/About.xaml deleted file mode 100644 index cbf1a3d..0000000 --- a/SuperCom/CustomWindows/About.xaml +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SuperCom/CustomWindows/About.xaml.cs b/SuperCom/CustomWindows/About.xaml.cs deleted file mode 100644 index cb74539..0000000 --- a/SuperCom/CustomWindows/About.xaml.cs +++ /dev/null @@ -1,61 +0,0 @@ -using SuperControls.Style; -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; -using SuperUtils.IO; -using SuperUtils.Common; -using SuperUtils.NetWork; - -namespace SuperCom.CustomWindows -{ - /// - /// Interaction logic for About.xaml - /// - public partial class About : SuperControls.Style.BaseDialog - { - public About(Window owner) : base(owner, false) - { - InitializeComponent(); - - // 读取本地配置 - string configPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "publishconfig"); - string value = FileHelper.TryReadFile(configPath); - Dictionary dict = JsonUtils.TryDeserializeObject>(value); - if (dict != null) - { - if (dict.ContainsKey("author") && dict["author"] is string author) - authorText.Text = $"By {author}"; - if (dict.ContainsKey("url") && dict["url"] is string url) - hyperLink.NavigateUri = NetUtils.TryGetUri(url); - if (dict.ContainsKey("urltext") && dict["urltext"] is string urltext) - { - runText.Text = urltext; - if (urltext.ToLower().IndexOf("github") < 0) - githubImage.Visibility = Visibility.Collapsed; - } - } - string local = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); - local = local.Substring(0, local.Length - ".0.0".Length); - VersionTextBlock.Text = $"版本:{local}"; - } - - private void OpenUrl(object sender, RoutedEventArgs e) - { - Hyperlink hyperlink = sender as Hyperlink; - FileHelper.TryOpenUrl(hyperlink.NavigateUri?.ToString(), (err) => - { - MessageNotify.Error(err); - }); - } - } -} diff --git a/SuperCom/Logger/Logger.cs b/SuperCom/Logger/Logger.cs new file mode 100644 index 0000000..db3a483 --- /dev/null +++ b/SuperCom/Logger/Logger.cs @@ -0,0 +1,29 @@ +using SuperUtils.Framework.Logger; +using SuperUtils.IO; +using System; +using System.IO; + +namespace SuperCom +{ + public class Logger : AbstractLogger + { + public static string FilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "app.log"); + private Logger() { } + + public static Logger Instance { get; } + + + + static Logger() + { + Instance = new Logger(); + Instance.LogLevel = Level.Debug; + } + + public override void LogPrint(string str) + { + Console.Write(str); + FileHelper.TryAppendToFile(FilePath, str); + } + } +} diff --git a/SuperCom/MainWindow.xaml b/SuperCom/MainWindow.xaml index f251319..afd4a35 100644 --- a/SuperCom/MainWindow.xaml +++ b/SuperCom/MainWindow.xaml @@ -20,6 +20,8 @@ ContentRendered="mainWindow_ContentRendered" Foreground="{DynamicResource Window.Foreground}" Icon="pack://application:,,,/Resources/Ico/Icon_64.png" + MenuAlign="Left" + MenuMargin="200 0 0 0" ShowThemeSelector="True" TitleHeight="30" TitleMargin="5 0" @@ -1346,12 +1348,15 @@ + + + @@ -1576,7 +1581,7 @@ @@ -2596,6 +2601,7 @@ VerticalAlignment="Stretch" AcceptsReturn="False" Background="Transparent" + TextWrapping="Wrap" BorderThickness="0" CaretBrush="{DynamicResource Window.Foreground}" ContextMenu="{StaticResource TextBoxContextMenu}" @@ -2605,14 +2611,15 @@ Text="{Binding WriteData, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextChanged="SendTextBox_TextChanged" /> - + Style="{StaticResource FlatToggleButton}" + ToolTip="文本框过长时换行显示"> - + --> @@ -2731,7 +2738,7 @@ Background="Transparent" IsChecked="{Binding AddNewLineWhenWrite, Mode=TwoWay}" Style="{StaticResource FlatToggleButton}" - ToolTip="加回车换行"> + ToolTip="发送时加回车换行"> - { - App.Logger.Error(e.Message); - }; + SuperControls.Style.Handler.LogHandler.Logger = App.Logger; vieModel = new VieModel_Main(); this.DataContext = vieModel; @@ -930,7 +925,7 @@ private void OpenPath(object sender, RoutedEventArgs e) string fileName = portTabItem.SaveFileName; if (File.Exists(fileName)) { - FileHelper.TryOpenSelectPathEx(fileName); + FileHelper.TryOpenSelectPath(fileName); if (portTabItem.FragCount > 0) MessageNotify.Info($"当前日志已分 {portTabItem.FragCount} 片"); } @@ -1489,6 +1484,28 @@ private async void mainWindow_ContentRendered(object sender, EventArgs e) //CommonSettings.InitLogDir(); OpenBeforePorts(); SetBaudRateAction(); + InitNotice(); + } + + public void InitNotice() + { + noticeViewer.SetConfig(UrlManager.NOTICE_URL, ConfigManager.Main.LatestNotice); + noticeViewer.onError += (error) => + { + App.Logger?.Error(error); + }; + + noticeViewer.onShowMarkdown += (markdown) => + { + //MessageCard.Info(markdown); + }; + noticeViewer.onNewNotice += (newNotice) => + { + ConfigManager.Main.LatestNotice = newNotice; + ConfigManager.Main.Save(); + }; + + noticeViewer.BeginCheckNotice(); } public void SetBaudRateAction() @@ -1602,33 +1619,33 @@ private void LoadDonateConfig() public void InitThemeSelector() { - DefaultThemeSelector.AddTransParentColor("TabItem.Background"); - DefaultThemeSelector.AddTransParentColor("Window.Title.Background"); - DefaultThemeSelector.AddTransParentColor("Window.Side.Background"); - DefaultThemeSelector.AddTransParentColor("Window.Side.Hover.Background"); - DefaultThemeSelector.AddTransParentColor("ListBoxItem.Background"); - DefaultThemeSelector.SetThemeConfig(ConfigManager.Settings.ThemeIdx, ConfigManager.Settings.ThemeID); - DefaultThemeSelector.onThemeChanged += (ThemeIdx, ThemeID) => + ThemeSelectorDefault.AddTransParentColor("TabItem.Background"); + ThemeSelectorDefault.AddTransParentColor("Window.Title.Background"); + ThemeSelectorDefault.AddTransParentColor("Window.Side.Background"); + ThemeSelectorDefault.AddTransParentColor("Window.Side.Hover.Background"); + ThemeSelectorDefault.AddTransParentColor("ListBoxItem.Background"); + ThemeSelectorDefault.SetThemeConfig(ConfigManager.Settings.ThemeIdx, ConfigManager.Settings.ThemeID); + ThemeSelectorDefault.onThemeChanged += (ThemeIdx, ThemeID) => { ConfigManager.Settings.ThemeIdx = ThemeIdx; ConfigManager.Settings.ThemeID = ThemeID; ConfigManager.Settings.Save(); }; - DefaultThemeSelector.onBackGroundImageChanged += (image) => + ThemeSelectorDefault.onBackGroundImageChanged += (image) => { - DefaultBgImage.Source = image; + ImageBackground.Source = image; }; - DefaultThemeSelector.onSetBgColorTransparent += () => + ThemeSelectorDefault.onSetBgColorTransparent += () => { - DefaultTitleBorder.Background = Brushes.Transparent; + BorderTitle.Background = Brushes.Transparent; }; - DefaultThemeSelector.onReSetBgColorBinding += () => + ThemeSelectorDefault.onReSetBgColorBinding += () => { - DefaultTitleBorder.SetResourceReference(Control.BackgroundProperty, "Window.Title.Background"); + BorderTitle.SetResourceReference(Control.BackgroundProperty, "Window.Title.Background"); }; - DefaultThemeSelector.InitThemes(); + ThemeSelectorDefault.InitThemes(); } @@ -2454,10 +2471,9 @@ private async void CheckUpgrade() local = local.Substring(0, local.Length - ".0.0".Length); if (local.CompareTo(remote) < 0) { - bool opened = (bool)new MsgBox(this, - $"存在新版本\n版本:{remote}\n日期:{ReleaseDate}").ShowDialog(); + bool opened = (bool)new MsgBox($"存在新版本\n版本:{remote}\n日期:{ReleaseDate}").ShowDialog(this); if (opened) - UpgradeHelper.OpenWindow(); + UpgradeHelper.OpenWindow(this); } } } @@ -2895,7 +2911,7 @@ private void JoinLine(object sender, RoutedEventArgs e) private void ShowUpgradeWindow(object sender, RoutedEventArgs e) { - UpgradeHelper.OpenWindow(); + UpgradeHelper.OpenWindow(this); } private void CopyCommand(object sender, RoutedEventArgs e) @@ -3529,7 +3545,7 @@ private void SaveLog(object sender, RoutedEventArgs e) { // 复制到该目录 FileHelper.TryCopyFile(fileName, path, true); - FileHelper.TryOpenSelectPathEx(path); + FileHelper.TryOpenSelectPath(path); } } else diff --git a/SuperCom/Properties/AssemblyInfo.cs b/SuperCom/Properties/AssemblyInfo.cs index c1615a0..268ac1e 100644 --- a/SuperCom/Properties/AssemblyInfo.cs +++ b/SuperCom/Properties/AssemblyInfo.cs @@ -51,5 +51,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.2.0.0")] -[assembly: AssemblyFileVersion("3.2.0.0")] +[assembly: AssemblyVersion("3.3.0.0")] +[assembly: AssemblyFileVersion("3.3.0.0")] diff --git a/SuperCom/References/SuperControls.Style.dll b/SuperCom/References/SuperControls.Style.dll index a1adf95..1a9fbed 100644 Binary files a/SuperCom/References/SuperControls.Style.dll and b/SuperCom/References/SuperControls.Style.dll differ diff --git a/SuperCom/References/SuperUtils.dll b/SuperCom/References/SuperUtils.dll index e41cef4..b7a0174 100644 Binary files a/SuperCom/References/SuperUtils.dll and b/SuperCom/References/SuperUtils.dll differ diff --git a/SuperCom/SuperCom.csproj b/SuperCom/SuperCom.csproj index 9544919..d9272e4 100644 --- a/SuperCom/SuperCom.csproj +++ b/SuperCom/SuperCom.csproj @@ -123,9 +123,6 @@ - - About.xaml - @@ -139,6 +136,7 @@ + @@ -166,10 +164,6 @@ Designer MSBuild:Compile - - Designer - MSBuild:Compile - MSBuild:Compile Designer diff --git a/SuperCom/Upgrade/UpgradeHelper.cs b/SuperCom/Upgrade/UpgradeHelper.cs index 65cb60a..a16237e 100644 --- a/SuperCom/Upgrade/UpgradeHelper.cs +++ b/SuperCom/Upgrade/UpgradeHelper.cs @@ -33,7 +33,7 @@ public static void Init(Window parent) public static void CreateDialog_Upgrade() { - dialog_Upgrade = new Dialog_Upgrade(Window, Upgrader); + dialog_Upgrade = new Dialog_Upgrade(Upgrader); dialog_Upgrade.LocalVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); dialog_Upgrade.OnSourceChanged += (s, e) => { @@ -47,7 +47,7 @@ public static void CreateDialog_Upgrade() { WindowClosed = true; }; - dialog_Upgrade.OnCloseApp += () => + dialog_Upgrade.OnExitApp += () => { OnBeforeCopyFile?.Invoke(); }; @@ -57,11 +57,11 @@ public static void CreateDialog_Upgrade() private static bool WindowClosed { get; set; } private static Window Window { get; set; } - public static void OpenWindow() + public static void OpenWindow(Window window = null) { if (WindowClosed) CreateDialog_Upgrade(); - dialog_Upgrade?.ShowDialog(); + dialog_Upgrade?.ShowDialog(window); } diff --git a/SuperCom/Windows/Window_AdvancedSend.xaml b/SuperCom/Windows/Window_AdvancedSend.xaml index 0a64048..4513d61 100644 --- a/SuperCom/Windows/Window_AdvancedSend.xaml +++ b/SuperCom/Windows/Window_AdvancedSend.xaml @@ -14,7 +14,6 @@ ContentRendered="BaseWindow_ContentRendered" Foreground="{DynamicResource Window.Foreground}" Loaded="BaseWindow_Loaded" - RestoreSize="False" WindowStartupLocation="CenterScreen" WindowStyle="None" mc:Ignorable="d"> @@ -149,9 +148,10 @@ Grid.Row="1" Margin="0,5,0,10" Background="{DynamicResource Window.Title.Background}" + PlaceHolder="" Search="SearchProjectByName" SearchOnTextChanged="True" - ShowSearchButton="False" + ShowSearchButton="True" Style="{StaticResource SearchBoxStyle}" /> -