diff --git a/src/ClassTable/App.config b/src/ClassTable/App.config index d67f619..a4189a2 100644 --- a/src/ClassTable/App.config +++ b/src/ClassTable/App.config @@ -8,48 +8,11 @@ - - - - Wide - - - 0 - - - 96 - - - 96 - - - 122 - - - 255 - - - 255 - - - 255 - - - 255 - - - No - - - 0 - - - - + @@ -57,4 +20,41 @@ + + + + Wide + + + 0 + + + 96 + + + 96 + + + 122 + + + 255 + + + 255 + + + 255 + + + 255 + + + No + + + 0 + + + \ No newline at end of file diff --git a/src/ClassTable/Application.xaml b/src/ClassTable/Application.xaml index 121bf32..4f07095 100644 --- a/src/ClassTable/Application.xaml +++ b/src/ClassTable/Application.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ClassTable" - StartupUri="MainWindow.xaml"> + StartupUri="LegacySidebarWindow.xaml"> diff --git a/src/ClassTable/ClassTable.vbproj b/src/ClassTable/ClassTable.vbproj index 8488335..a687779 100644 --- a/src/ClassTable/ClassTable.vbproj +++ b/src/ClassTable/ClassTable.vbproj @@ -12,23 +12,6 @@ Custom true true - false - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - AnyCPU @@ -66,17 +49,14 @@ On - Resources\Icon.ico - - - My Project\app.manifest + Resource\Icons\AppIcon.ico ..\packages\ClosedXML.0.95.4\lib\net46\ClosedXML.dll - - ..\packages\DocumentFormat.OpenXml.2.13.0\lib\net46\DocumentFormat.OpenXml.dll + + ..\packages\DocumentFormat.OpenXml.2.13.1\lib\net46\DocumentFormat.OpenXml.dll ..\packages\ExcelNumberFormat.1.1.0\lib\net20\ExcelNumberFormat.dll @@ -117,16 +97,18 @@ MSBuild:Compile Designer - - - - SettingWindow.xaml - Code - - - UpdateWindow.xaml - Code - + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -135,19 +117,22 @@ Application.xaml Code - + + + + + LegacySettingWindow.xaml + + + LegacySidebarWindow.xaml + + + LegacyUpdateWindow.xaml + MainWindow.xaml Code - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - @@ -187,43 +172,30 @@ True - PublicVbMyResourcesResXFileCodeGenerator + VbMyResourcesResXFileCodeGenerator Resources.Designer.vb My.Resources + Designer - - PublicSettingsSingleFileGenerator + SettingsSingleFileGenerator Settings.Designer.vb - + - - False - Microsoft .NET Framework 4.7.2 %28x86 和 x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - - + - + - - Always - + + \ No newline at end of file diff --git a/src/ClassTable/Core.vb b/src/ClassTable/LegacyCore.vb similarity index 97% rename from src/ClassTable/Core.vb rename to src/ClassTable/LegacyCore.vb index 887d78a..9c4f1a8 100644 --- a/src/ClassTable/Core.vb +++ b/src/ClassTable/LegacyCore.vb @@ -1,4 +1,4 @@ -Public Class Core +Public Class LegacyCore '字符串转换 @@ -51,4 +51,4 @@ Dim WindowBrush As Brush = New SolidColorBrush(Color.FromArgb(A, R, G, B)) Return WindowBrush End Function -End Class +End Class \ No newline at end of file diff --git a/src/ClassTable/Excel.vb b/src/ClassTable/LegacyExcel.vb similarity index 98% rename from src/ClassTable/Excel.vb rename to src/ClassTable/LegacyExcel.vb index d2e3344..94940b4 100644 --- a/src/ClassTable/Excel.vb +++ b/src/ClassTable/LegacyExcel.vb @@ -1,7 +1,7 @@ Imports Newtonsoft.Json Imports ClosedXML.Excel Imports System.IO -Public Class Excel +Public Class LegacyExcel '读取表格部分 @@ -23,4 +23,4 @@ Public Class Excel Dim ClassName As String = GetName(ClassBlock) Return ClassName End Function -End Class +End Class \ No newline at end of file diff --git a/src/ClassTable/Network.vb b/src/ClassTable/LegacyNetwork.vb similarity index 98% rename from src/ClassTable/Network.vb rename to src/ClassTable/LegacyNetwork.vb index 13f6b36..cae4591 100644 --- a/src/ClassTable/Network.vb +++ b/src/ClassTable/LegacyNetwork.vb @@ -1,7 +1,7 @@ Imports System.IO Imports System.Net Imports Newtonsoft.Json -Public Class Network +Public Class LegacyNetwork '网络与更新部分 diff --git a/src/ClassTable/SettingWindow.xaml b/src/ClassTable/LegacySettingWindow.xaml similarity index 98% rename from src/ClassTable/SettingWindow.xaml rename to src/ClassTable/LegacySettingWindow.xaml index 4659161..4b02218 100644 --- a/src/ClassTable/SettingWindow.xaml +++ b/src/ClassTable/LegacySettingWindow.xaml @@ -1,9 +1,9 @@ - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ClassTable/LegacySidebarWindow.xaml.vb b/src/ClassTable/LegacySidebarWindow.xaml.vb new file mode 100644 index 0000000..54713ec --- /dev/null +++ b/src/ClassTable/LegacySidebarWindow.xaml.vb @@ -0,0 +1,194 @@ +Imports System.Windows.Forms +Imports System.Drawing +Public Class LegacySidebarWindow + ReadOnly Core As New ClassTable.LegacyCore + ReadOnly Excel As New ClassTable.LegacyExcel + ReadOnly Network As New ClassTable.LegacyNetwork + '读取配置文件 + Private Event ReadConfigInformation(ByVal sender As Object, ByVal e As EventArgs) + Private Sub MainWindow_ReadConfigInformation(sender As Object, e As EventArgs) Handles Me.ReadConfigInformation + '设置窗口大小 + Select Case My.Settings.WindowMode + Case "Wide" + Width = 96 + Left = Screen.PrimaryScreen.WorkingArea.Width / (ScreenDPI.dpix / 96) - 96 + Case "Narrow" + Width = 48 + Left = Screen.PrimaryScreen.WorkingArea.Width / (ScreenDPI.dpix / 96) - 48 + End Select + '设置颜色 + Background = Core.GetWindowBrush(My.Settings.BackgroundColor_Red, My.Settings.BackgroundColor_Green, My.Settings.BackgroundColor_Blue, My.Settings.BackgroundColor_Alpha) + MorWeekday.Foreground = Core.GetWindowBrush(My.Settings.ForegroundColor_Red, My.Settings.ForegroundColor_Green, My.Settings.ForegroundColor_Blue, My.Settings.ForegroundColor_Alpha) + End Sub + '显示设置窗口 + Private Event ShowSettingWindow(ByVal sender As Object, ByVal e As EventArgs) + ReadOnly MySettingWindow As New LegacySettingWindow + Private Sub MainWindow_ShowSettingWindow(sender As Object, e As EventArgs) Handles Me.ShowSettingWindow + MySettingWindow.ShowDialog() + End Sub + '显示更新窗口 + Private Event ShowUpdateWindow(ByVal sender As Object, ByVal e As EventArgs) + ReadOnly MyUpdateWindow As New LegacyUpdateWindow + Private Sub MainWindow_ShowUpdateWindow(sender As Object, e As EventArgs) Handles Me.ShowUpdateWindow + MyUpdateWindow.ShowDialog() + End Sub + ReadOnly ScreenDPI = Graphics.FromHwnd(IntPtr.Zero) + ReadOnly Apppart = AppDomain.CurrentDomain.BaseDirectory + Public Shared NowWeekday = Weekday(DateValue(DateString)) + Public Event LoadTable(ByVal sender As Object, ByVal e As EventArgs) + Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded + RaiseEvent InitializeNotifyIcon(Me, New EventArgs) + '载入课表 + RaiseEvent LoadTable(Me, New EventArgs) + RaiseEvent ReadConfigInformation(Me, New EventArgs) + LegacyUpdateWindow.ReleaseInformation = Network.GetReleaseInformation + LegacyUpdateWindow.LatestVersion = New Version(Network.GetLatestVersion(LegacyUpdateWindow.ReleaseInformation)) + If LegacyUpdateWindow.LatestVersion > LegacyUpdateWindow.LocalVersion Then + RaiseEvent ShowUpdateWindow(Me, New EventArgs) + End If + End Sub + Private Sub MainWindow_LoadTable(sender As Object, e As EventArgs) Handles Me.LoadTable + '设置日期 + If My.Settings.Mdate = "No" Then + Else + NowWeekday = My.Settings.Mdate + My.Settings.Mdate = "No" + My.Settings.Save() + End If + '判断文字长度 + Select Case My.Settings.WindowMode + Case "Wide" + MorWeekday.Text = Core.AddSpace(Core.GetChineseFullWeekName(NowWeekday), 1, 1) + Case "Narrow" + MorWeekday.Text = Core.AddSpace(Core.GetChineseWeekLiteName(NowWeekday), 1, 5) + End Select + '开始载入 + Dim WeekSheet = Core.GetChineseFullWeekName(NowWeekday) + Dim ClassJsonString As String = Excel.GetTableInformation(WeekSheet) + MorRead.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeA"), 1, 1) + MorA.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeB"), 1, 1) + MorB.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeC"), 1, 1) + MorC.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeD"), 1, 1) + MorD.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeE"), 1, 1) + MorE.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeF"), 1, 1) + MorF.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeG"), 1, 1) + MorG.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeH"), 1, 1) + MorH.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeI"), 1, 1) + MorI.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeJ"), 1, 1) + MorJ.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeK"), 1, 1) + MorStudy.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeL"), 1, 1) + End Sub + '调整窗口大小 + Private Sub MainWindow_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs) Handles Me.MouseDoubleClick + If Width = 48 Then + Width = 96 + Left = Screen.PrimaryScreen.WorkingArea.Width / (ScreenDPI.dpix / 96) - 96 + MorWeekday.Text = Core.AddSpace(Core.GetChineseFullWeekName(NowWeekday), 1, 1) + Else + Width = 48 + Left = Screen.PrimaryScreen.WorkingArea.Width / (ScreenDPI.dpix / 96) - 48 + MorWeekday.Text = Core.AddSpace(Core.GetChineseWeekLiteName(NowWeekday), 1, 5) + End If + End Sub + '设置/取消窗口置顶 + Private Sub MorWeekday_MouseDown(sender As Object, e As MouseButtonEventArgs) Handles MorWeekday.MouseDown + If Topmost = True Then + Topmost = False + NotifyIconToolStripMenuItemTop.Checked = False + Else + Topmost = True + NotifyIconToolStripMenuItemTop.Checked = True + End If + End Sub + '启动设置窗口 + Private Sub MorWeekday_MouseRightButtonDown(sender As Object, e As MouseButtonEventArgs) Handles MorWeekday.MouseRightButtonDown + RaiseEvent ShowSettingWindow(Me, New EventArgs) + End Sub + Private Sub MainWindow_Closed(sender As Object, e As EventArgs) Handles Me.Closed + '存储窗口大小设定 + If Width = 48 Then + My.Settings.WindowMode = "Narrow" + Else + My.Settings.WindowMode = "Wide" + End If + My.Settings.Save() + End Sub + '通知区域 + ReadOnly MyNotifyIcon As NotifyIcon = New NotifyIcon + Private Event InitializeNotifyIcon(ByVal sender As Object, ByVal e As EventArgs) + Dim WithEvents NotifyIconContextMenuStrip As ContextMenuStrip = New ContextMenuStrip + Dim WithEvents NotifyIconToolStripMenuItemQuickly As ToolStripMenuItem = New ToolStripMenuItem + Dim WithEvents NotifyIconToolStripMenuItemEdit As ToolStripMenuItem = New ToolStripMenuItem + Dim WithEvents NotifyIconToolStripMenuItemUp As ToolStripMenuItem = New ToolStripMenuItem + Dim WithEvents NotifyIconToolStripMenuItemAbout As ToolStripMenuItem = New ToolStripMenuItem + Dim WithEvents NotifyIconToolStripMenuItemSetting As ToolStripMenuItem = New ToolStripMenuItem + Dim WithEvents NotifyIconToolStripMenuItemHide As ToolStripMenuItem = New ToolStripMenuItem + Dim WithEvents NotifyIconToolStripMenuItemTop As ToolStripMenuItem = New ToolStripMenuItem + Dim WithEvents NotifyIconToolStripMenuItemExit As ToolStripMenuItem = New ToolStripMenuItem + Private Sub MainWindow_InitializeNotifyIcon(sender As Object, e As EventArgs) Handles Me.InitializeNotifyIcon + + '初始化通知图标 + MyNotifyIcon.Icon = My.Resources.AppIcon + MyNotifyIcon.Visible = True + MyNotifyIcon.Text = "ClassTable" + MyNotifyIcon.ContextMenuStrip = NotifyIconContextMenuStrip + + '初始化右键菜单 + NotifyIconToolStripMenuItemQuickly.Text = "快捷设置" + NotifyIconContextMenuStrip.Items.Add(NotifyIconToolStripMenuItemQuickly) + + NotifyIconToolStripMenuItemSetting.Text = "高级设置" + NotifyIconToolStripMenuItemQuickly.DropDown.Items.Add(NotifyIconToolStripMenuItemSetting) + NotifyIconToolStripMenuItemEdit.Text = "编辑" + NotifyIconToolStripMenuItemQuickly.DropDown.Items.Add(NotifyIconToolStripMenuItemEdit) + NotifyIconToolStripMenuItemUp.Text = "更新" + NotifyIconToolStripMenuItemQuickly.DropDown.Items.Add(NotifyIconToolStripMenuItemUp) + NotifyIconToolStripMenuItemAbout.Text = "关于" + NotifyIconToolStripMenuItemQuickly.DropDown.Items.Add(NotifyIconToolStripMenuItemAbout) + + NotifyIconToolStripMenuItemTop.Text = "置顶" + NotifyIconContextMenuStrip.Items.Add(NotifyIconToolStripMenuItemTop) + 'NotifyIconToolStripMenuItemHide.Text = "隐藏" + 'NotifyIconContextMenuStrip.Items.Add(NotifyIconToolStripMenuItemHide) + NotifyIconToolStripMenuItemExit.Text = "关闭" + NotifyIconContextMenuStrip.Items.Add(NotifyIconToolStripMenuItemExit) + + End Sub + Private Sub NotifyIconContextMenuStrip_Click(sender As Object, e As EventArgs) Handles NotifyIconContextMenuStrip.Click + Show() + NotifyIconToolStripMenuItemHide.Checked = True + End Sub + Private Sub NotifyIconToolStripMenuItemSetting_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemSetting.Click + RaiseEvent ShowSettingWindow(Me, New EventArgs) + End Sub + Private Sub NotifyIconToolStripMenuItemEdit_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemEdit.Click + Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\ATHS Studio\ClassTable\tablefile.xlsx") + End Sub + Private Sub NotifyIconToolStripMenuItemUp_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemUp.Click + RaiseEvent ShowUpdateWindow(Me, New EventArgs) + End Sub + Private Sub NotifyIconToolStripMenuItemAbout_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemAbout.Click + MsgBox("本产品使用的第三方库:" & vbCrLf & "Newtonsoft.Json" & vbCrLf & "ClosedXML" & vbCrLf & "访问 mybluehorizon.github.io/classtable 获得支持" & vbCrLf & "© ATHS Studio 2016 - 2020", Title:="ClassTable 桌面课表", Buttons:=MsgBoxStyle.Information) + End Sub + Private Sub NotifyIconToolStripMenuItemTop_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemTop.Click + If NotifyIconToolStripMenuItemTop.Checked = True Then + NotifyIconToolStripMenuItemTop.Checked = False + Topmost = False + Else + Topmost = True + NotifyIconToolStripMenuItemTop.Checked = True + End If + End Sub + 'Private Sub NotifyIconToolStripMenuItemHide_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemHide.Click + ' If NotifyIconToolStripMenuItemHide.Checked = True Then + ' NotifyIconToolStripMenuItemHide.Checked = False + ' Show() + ' Else + ' Hide() + ' NotifyIconToolStripMenuItemHide.Checked = True + ' End If + 'End Sub + Private Sub NotifyIconToolStripMenuItemExit_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemExit.Click + System.Windows.Application.Current.Shutdown() + End Sub +End Class diff --git a/src/ClassTable/UpdateWindow.xaml b/src/ClassTable/LegacyUpdateWindow.xaml similarity index 98% rename from src/ClassTable/UpdateWindow.xaml rename to src/ClassTable/LegacyUpdateWindow.xaml index ae23a42..9467e17 100644 --- a/src/ClassTable/UpdateWindow.xaml +++ b/src/ClassTable/LegacyUpdateWindow.xaml @@ -1,4 +1,4 @@ - + Title="MainWindow" Height="450" Width="800"> - - - - - - - - - - - - - + diff --git a/src/ClassTable/MainWindow.xaml.vb b/src/ClassTable/MainWindow.xaml.vb index c133b1b..922a5de 100644 --- a/src/ClassTable/MainWindow.xaml.vb +++ b/src/ClassTable/MainWindow.xaml.vb @@ -1,194 +1,3 @@ -Imports System.Windows.Forms -Imports System.Drawing -Public Class MainWindow - ReadOnly Core As New ClassTable.Core - ReadOnly Excel As New ClassTable.Excel - ReadOnly Network As New ClassTable.Network - '读取配置文件 - Private Event ReadConfigInformation(ByVal sender As Object, ByVal e As EventArgs) - Private Sub MainWindow_ReadConfigInformation(sender As Object, e As EventArgs) Handles Me.ReadConfigInformation - '设置窗口大小 - Select Case My.Settings.WindowMode - Case "Wide" - Width = 96 - Left = Screen.PrimaryScreen.WorkingArea.Width / (ScreenDPI.dpix / 96) - 96 - Case "Narrow" - Width = 48 - Left = Screen.PrimaryScreen.WorkingArea.Width / (ScreenDPI.dpix / 96) - 48 - End Select - '设置颜色 - Background = Core.GetWindowBrush(My.Settings.BackgroundColor_Red, My.Settings.BackgroundColor_Green, My.Settings.BackgroundColor_Blue, My.Settings.BackgroundColor_Alpha) - MorWeekday.Foreground = Core.GetWindowBrush(My.Settings.ForegroundColor_Red, My.Settings.ForegroundColor_Green, My.Settings.ForegroundColor_Blue, My.Settings.ForegroundColor_Alpha) - '设置日期 - If My.Settings.Mdate = "No" Then - Else - NowWeekday = My.Settings.Mdate - My.Settings.Mdate = "No" - My.Settings.Save() - End If - End Sub - '显示设置窗口 - Private Event ShowSettingWindow(ByVal sender As Object, ByVal e As EventArgs) - ReadOnly MySettingWindow As New SettingWindow - Private Sub MainWindow_ShowSettingWindow(sender As Object, e As EventArgs) Handles Me.ShowSettingWindow - MySettingWindow.ShowDialog() - End Sub - '显示更新窗口 - Private Event ShowUpdateWindow(ByVal sender As Object, ByVal e As EventArgs) - ReadOnly MyUpdateWindow As New UpdateWindow - Private Sub MainWindow_ShowUpdateWindow(sender As Object, e As EventArgs) Handles Me.ShowUpdateWindow - MyUpdateWindow.ShowDialog() - End Sub - ReadOnly ScreenDPI = Graphics.FromHwnd(IntPtr.Zero) - ReadOnly Apppart = AppDomain.CurrentDomain.BaseDirectory - Public Shared NowWeekday = Weekday(DateValue(DateString)) - Public Event LoadTable(ByVal sender As Object, ByVal e As EventArgs) - Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded - RaiseEvent InitializeNotifyIcon(Me, New EventArgs) - RaiseEvent ReadConfigInformation(Me, New EventArgs) - '载入课表 - RaiseEvent LoadTable(Me, New EventArgs) - UpdateWindow.ReleaseInformation = Network.GetReleaseInformation - UpdateWindow.LatestVersion = New Version(Network.GetLatestVersion(UpdateWindow.ReleaseInformation)) - If UpdateWindow.LatestVersion > UpdateWindow.LocalVersion Then - RaiseEvent ShowUpdateWindow(Me, New EventArgs) - End If - End Sub - Private Sub MainWindow_LoadTable(sender As Object, e As EventArgs) Handles Me.LoadTable - '判断文字长度 - Select Case Width - Case 96 - MorWeekday.Text = Core.AddSpace(Core.GetChineseFullWeekName(NowWeekday), 1, 1) - Case 48 - MorWeekday.Text = Core.AddSpace(Core.GetChineseWeekLiteName(NowWeekday), 1, 5) - End Select - '开始载入 - Dim WeekSheet = Core.GetChineseFullWeekName(NowWeekday) - Dim ClassJsonString As String = Excel.GetTableInformation(WeekSheet) - MorRead.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeA"), 1, 1) - MorA.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeB"), 1, 1) - MorB.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeC"), 1, 1) - MorC.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeD"), 1, 1) - MorD.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeE"), 1, 1) - MorE.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeF"), 1, 1) - MorF.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeG"), 1, 1) - MorG.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeH"), 1, 1) - MorH.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeI"), 1, 1) - MorI.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeJ"), 1, 1) - MorJ.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeK"), 1, 1) - MorStudy.Text = Core.AddSpace(Excel.GetClassName(ClassJsonString, "RangeL"), 1, 1) - End Sub - '调整窗口大小 - Private Sub MainWindow_MouseDoubleClick(sender As Object, e As MouseButtonEventArgs) Handles Me.MouseDoubleClick - If Width = 48 Then - Width = 96 - Left = Screen.PrimaryScreen.WorkingArea.Width / (ScreenDPI.dpix / 96) - 96 - MorWeekday.Text = Core.AddSpace(Core.GetChineseFullWeekName(NowWeekday), 1, 1) - Else - Width = 48 - Left = Screen.PrimaryScreen.WorkingArea.Width / (ScreenDPI.dpix / 96) - 48 - MorWeekday.Text = Core.AddSpace(Core.GetChineseWeekLiteName(NowWeekday), 1, 5) - End If - End Sub - '设置/取消窗口置顶 - Private Sub MorWeekday_MouseDown(sender As Object, e As MouseButtonEventArgs) Handles MorWeekday.MouseDown - If Topmost = True Then - Topmost = False - NotifyIconToolStripMenuItemTop.Checked = False - Else - Topmost = True - NotifyIconToolStripMenuItemTop.Checked = True - End If - End Sub - '启动设置窗口 - Private Sub MorWeekday_MouseRightButtonDown(sender As Object, e As MouseButtonEventArgs) Handles MorWeekday.MouseRightButtonDown - RaiseEvent ShowSettingWindow(Me, New EventArgs) - End Sub - Private Sub MainWindow_Closed(sender As Object, e As EventArgs) Handles Me.Closed - '存储窗口大小设定 - If Width = 48 Then - My.Settings.WindowMode = "Narrow" - Else - My.Settings.WindowMode = "Wide" - End If - My.Settings.Save() - End Sub - '通知区域 - ReadOnly MyNotifyIcon As NotifyIcon = New NotifyIcon - Private Event InitializeNotifyIcon(ByVal sender As Object, ByVal e As EventArgs) - Dim WithEvents NotifyIconContextMenuStrip As ContextMenuStrip = New ContextMenuStrip - Dim WithEvents NotifyIconToolStripMenuItemQuickly As ToolStripMenuItem = New ToolStripMenuItem - Dim WithEvents NotifyIconToolStripMenuItemEdit As ToolStripMenuItem = New ToolStripMenuItem - Dim WithEvents NotifyIconToolStripMenuItemUp As ToolStripMenuItem = New ToolStripMenuItem - Dim WithEvents NotifyIconToolStripMenuItemAbout As ToolStripMenuItem = New ToolStripMenuItem - Dim WithEvents NotifyIconToolStripMenuItemSetting As ToolStripMenuItem = New ToolStripMenuItem - Dim WithEvents NotifyIconToolStripMenuItemHide As ToolStripMenuItem = New ToolStripMenuItem - Dim WithEvents NotifyIconToolStripMenuItemTop As ToolStripMenuItem = New ToolStripMenuItem - Dim WithEvents NotifyIconToolStripMenuItemExit As ToolStripMenuItem = New ToolStripMenuItem - Private Sub MainWindow_InitializeNotifyIcon(sender As Object, e As EventArgs) Handles Me.InitializeNotifyIcon +Class MainWindow - '初始化通知图标 - MyNotifyIcon.Icon = My.Resources.Icon - MyNotifyIcon.Visible = True - MyNotifyIcon.Text = "ClassTable" - MyNotifyIcon.ContextMenuStrip = NotifyIconContextMenuStrip - - '初始化右键菜单 - NotifyIconToolStripMenuItemQuickly.Text = "快捷设置" - NotifyIconContextMenuStrip.Items.Add(NotifyIconToolStripMenuItemQuickly) - - NotifyIconToolStripMenuItemSetting.Text = "高级设置" - NotifyIconToolStripMenuItemQuickly.DropDown.Items.Add(NotifyIconToolStripMenuItemSetting) - NotifyIconToolStripMenuItemEdit.Text = "编辑" - NotifyIconToolStripMenuItemQuickly.DropDown.Items.Add(NotifyIconToolStripMenuItemEdit) - NotifyIconToolStripMenuItemUp.Text = "更新" - NotifyIconToolStripMenuItemQuickly.DropDown.Items.Add(NotifyIconToolStripMenuItemUp) - NotifyIconToolStripMenuItemAbout.Text = "关于" - NotifyIconToolStripMenuItemQuickly.DropDown.Items.Add(NotifyIconToolStripMenuItemAbout) - - NotifyIconToolStripMenuItemTop.Text = "置顶" - NotifyIconContextMenuStrip.Items.Add(NotifyIconToolStripMenuItemTop) - 'NotifyIconToolStripMenuItemHide.Text = "隐藏" - 'NotifyIconContextMenuStrip.Items.Add(NotifyIconToolStripMenuItemHide) - NotifyIconToolStripMenuItemExit.Text = "关闭" - NotifyIconContextMenuStrip.Items.Add(NotifyIconToolStripMenuItemExit) - - End Sub - Private Sub NotifyIconContextMenuStrip_Click(sender As Object, e As EventArgs) Handles NotifyIconContextMenuStrip.Click - Show() - NotifyIconToolStripMenuItemHide.Checked = True - End Sub - Private Sub NotifyIconToolStripMenuItemSetting_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemSetting.Click - RaiseEvent ShowSettingWindow(Me, New EventArgs) - End Sub - Private Sub NotifyIconToolStripMenuItemEdit_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemEdit.Click - Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\ATHS Studio\ClassTable\tablefile.xlsx") - End Sub - Private Sub NotifyIconToolStripMenuItemUp_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemUp.Click - RaiseEvent ShowUpdateWindow(Me, New EventArgs) - End Sub - Private Sub NotifyIconToolStripMenuItemAbout_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemAbout.Click - MsgBox("本产品使用的第三方库:" & vbCrLf & "Newtonsoft.Json" & vbCrLf & "ClosedXML" & vbCrLf & "访问 mybluehorizon.github.io/classtable 获得支持" & vbCrLf & "© ATHS Studio 2016 - 2020", Title:="ClassTable 桌面课表", Buttons:=MsgBoxStyle.Information) - End Sub - Private Sub NotifyIconToolStripMenuItemTop_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemTop.Click - If NotifyIconToolStripMenuItemTop.Checked = True Then - NotifyIconToolStripMenuItemTop.Checked = False - Topmost = False - Else - Topmost = True - NotifyIconToolStripMenuItemTop.Checked = True - End If - End Sub - 'Private Sub NotifyIconToolStripMenuItemHide_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemHide.Click - ' If NotifyIconToolStripMenuItemHide.Checked = True Then - ' NotifyIconToolStripMenuItemHide.Checked = False - ' Show() - ' Else - ' Hide() - ' NotifyIconToolStripMenuItemHide.Checked = True - ' End If - 'End Sub - Private Sub NotifyIconToolStripMenuItemExit_Click(sender As Object, e As EventArgs) Handles NotifyIconToolStripMenuItemExit.Click - System.Windows.Application.Current.Shutdown() - End Sub End Class diff --git a/src/ClassTable/My Project/AssemblyInfo.vb b/src/ClassTable/My Project/AssemblyInfo.vb index f87f5c4..42c5fd0 100644 --- a/src/ClassTable/My Project/AssemblyInfo.vb +++ b/src/ClassTable/My Project/AssemblyInfo.vb @@ -1,8 +1,8 @@ Imports System -Imports System.Reflection -Imports System.Runtime.InteropServices Imports System.Globalization +Imports System.Reflection Imports System.Resources +Imports System.Runtime.InteropServices Imports System.Windows ' 有关程序集的一般信息由以下 @@ -11,10 +11,10 @@ Imports System.Windows '查看程序集特性的值 - - + + - + @@ -55,5 +55,5 @@ Imports System.Windows '通过使用 "*",如下所示: ' - - + + diff --git a/src/ClassTable/My Project/Resources.Designer.vb b/src/ClassTable/My Project/Resources.Designer.vb index 9da8d22..80de800 100644 --- a/src/ClassTable/My Project/Resources.Designer.vb +++ b/src/ClassTable/My Project/Resources.Designer.vb @@ -26,7 +26,7 @@ Namespace My.Resources Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _ Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _ Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _ - Public Module Resources + Friend Module Resources Private resourceMan As Global.System.Resources.ResourceManager @@ -36,7 +36,7 @@ Namespace My.Resources ''' 返回此类使用的缓存的 ResourceManager 实例。 ''' _ - Public ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager Get If Object.ReferenceEquals(resourceMan, Nothing) Then Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("ClassTable.Resources", GetType(Resources).Assembly) @@ -47,11 +47,11 @@ Namespace My.Resources End Property ''' - ''' 重写当前线程的 CurrentUICulture 属性 - ''' 重写当前线程的 CurrentUICulture 属性。 + ''' 重写当前线程的 CurrentUICulture 属性,对 + ''' 使用此强类型资源类的所有资源查找执行重写。 ''' _ - Public Property Culture() As Global.System.Globalization.CultureInfo + Friend Property Culture() As Global.System.Globalization.CultureInfo Get Return resourceCulture End Get @@ -63,9 +63,9 @@ Namespace My.Resources ''' ''' 查找类似于 (图标) 的 System.Drawing.Icon 类型的本地化资源。 ''' - Public ReadOnly Property Icon() As System.Drawing.Icon + Friend ReadOnly Property AppIcon() As System.Drawing.Icon Get - Dim obj As Object = ResourceManager.GetObject("Icon", resourceCulture) + Dim obj As Object = ResourceManager.GetObject("AppIcon", resourceCulture) Return CType(obj,System.Drawing.Icon) End Get End Property diff --git a/src/ClassTable/My Project/Resources.resx b/src/ClassTable/My Project/Resources.resx index d06ba97..baf8d72 100644 --- a/src/ClassTable/My Project/Resources.resx +++ b/src/ClassTable/My Project/Resources.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\Icon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resource\Icons\AppIcon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a \ No newline at end of file diff --git a/src/ClassTable/My Project/Settings.Designer.vb b/src/ClassTable/My Project/Settings.Designer.vb index 8488b87..3ff32bf 100644 --- a/src/ClassTable/My Project/Settings.Designer.vb +++ b/src/ClassTable/My Project/Settings.Designer.vb @@ -14,9 +14,9 @@ Option Explicit On _ -Partial Public NotInheritable Class MySettings +Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings) diff --git a/src/ClassTable/My Project/app.manifest b/src/ClassTable/My Project/app.manifest deleted file mode 100644 index 13a35fe..0000000 --- a/src/ClassTable/My Project/app.manifest +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/ClassTable/Resources/Icon.ico b/src/ClassTable/Resource/Icons/AppIcon.ico similarity index 100% rename from src/ClassTable/Resources/Icon.ico rename to src/ClassTable/Resource/Icons/AppIcon.ico diff --git a/src/ClassTable/Resources/TableIcon.ico b/src/ClassTable/Resource/Icons/TableIcon.ico similarity index 100% rename from src/ClassTable/Resources/TableIcon.ico rename to src/ClassTable/Resource/Icons/TableIcon.ico diff --git a/src/ClassTable/Resource/SplashScreen.png b/src/ClassTable/Resource/SplashScreen.png new file mode 100644 index 0000000..0b41802 Binary files /dev/null and b/src/ClassTable/Resource/SplashScreen.png differ diff --git a/src/ClassTable/SplashScreen.png b/src/ClassTable/SplashScreen.png deleted file mode 100644 index 0e40119..0000000 Binary files a/src/ClassTable/SplashScreen.png and /dev/null differ diff --git a/src/ClassTable/packages.config b/src/ClassTable/packages.config index 13267a7..69067e8 100644 --- a/src/ClassTable/packages.config +++ b/src/ClassTable/packages.config @@ -1,7 +1,7 @@  - +