diff --git a/AssemblyVersionInfo.cs b/AssemblyVersionInfo.cs new file mode 100644 index 0000000..8ad584e --- /dev/null +++ b/AssemblyVersionInfo.cs @@ -0,0 +1,6 @@ +using System.Reflection; +using System.Resources; + +[assembly: AssemblyVersion("2.2.0.0")] +[assembly: AssemblyFileVersion("2.2.0.0")] +[assembly: NeutralResourcesLanguage("en-US")] diff --git a/DesktopToast/DesktopToast.csproj b/DesktopToast/DesktopToast.csproj index 876f29c..51e6dca 100644 --- a/DesktopToast/DesktopToast.csproj +++ b/DesktopToast/DesktopToast.csproj @@ -9,31 +9,54 @@ Properties DesktopToast DesktopToast - v4.5.2 + v4.7.2 8.0 512 - + true - full - false - ..\Release\ - DEBUG;TRACE - prompt - 4 + bin\x86\Debug\ + CODE_ANALYSIS;DEBUG;TRACE bin\Debug\DesktopToast.xml + full + x86 true + 7.3 + prompt + MinimumRecommendedRules.ruleset - - none - true - ..\Release\ + + bin\x86\Release\ TRACE - prompt - 4 bin\Release\DesktopToast.xml + true + x86 + 7.3 + prompt + MinimumRecommendedRules.ruleset + + + true + bin\x64\Debug\ + CODE_ANALYSIS;DEBUG;TRACE + bin\Debug\DesktopToast.xml + full + x64 false + 7.3 + prompt + MinimumRecommendedRules.ruleset + + + bin\x64\Release\ + TRACE + bin\Release\DesktopToast.xml + true + x64 + 7.3 + prompt + MinimumRecommendedRules.ruleset diff --git a/DesktopToast/Properties/AssemblyInfo.cs b/DesktopToast/Properties/AssemblyInfo.cs index 4b5d7ce..86dd72b 100644 --- a/DesktopToast/Properties/AssemblyInfo.cs +++ b/DesktopToast/Properties/AssemblyInfo.cs @@ -1,9 +1,6 @@ using System.Reflection; using System.Runtime.InteropServices; -// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 -// アセンブリに関連付けられている情報を変更するには、 -// これらの属性値を変更してください。 [assembly: AssemblyTitle("DesktopToast")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -13,23 +10,4 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから -// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 -// その型の ComVisible 属性を true に設定してください。 -[assembly: ComVisible(false)] - -// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です [assembly: Guid("ba284c23-8fa7-410e-ac8b-1d5200593626")] - -// アセンブリのバージョン情報は、以下の 4 つの値で構成されています: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を -// 既定値にすることができます: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.5.0.8")] -[assembly: AssemblyFileVersion("0.5.0.8")] diff --git a/LICENSE.rtf b/LICENSE.rtf new file mode 100644 index 0000000..69dda28 Binary files /dev/null and b/LICENSE.rtf differ diff --git a/NWS Alerts Setup/NWS Alerts Setup.wax b/NWS Alerts Setup/NWS Alerts Setup.wax new file mode 100644 index 0000000..16a4b58 --- /dev/null +++ b/NWS Alerts Setup/NWS Alerts Setup.wax @@ -0,0 +1,13 @@ + + + + NWS Alerts\NWS Alerts.csproj + + + + + + false + true + false + \ No newline at end of file diff --git a/NWS Alerts Setup/NWS Alerts Setup.wixproj b/NWS Alerts Setup/NWS Alerts Setup.wixproj new file mode 100644 index 0000000..ad3e9e7 --- /dev/null +++ b/NWS Alerts Setup/NWS Alerts Setup.wixproj @@ -0,0 +1,78 @@ + + + + Debug + x86 + 3.10 + 8f84b1ee-6afc-49fa-8b9c-51a710462c0c + 2.0 + NWS Alerts Setup + Package + + + ..\SETUP\ + obj\$(Configuration)\ + Debug + + + ..\SETUP\ + obj\$(Configuration)\ + True + + + ..\SETUP\ + obj\$(Platform)\$(Configuration)\ + + + ..\SETUP\ + obj\$(Platform)\$(Configuration)\ + True + + + + + + + + + + DesktopToast + {b8d704d5-fb0c-4c2d-8189-72c6649ba157} + True + True + Binaries;Content;Satellites + INSTALLFOLDER + + + NWS Alerts + {cb7ba755-6053-4716-9284-273d66978262} + True + True + Binaries;Content;Satellites + INSTALLFOLDER + + + + + $(WixExtDir)\WixUtilExtension.dll + WixUtilExtension + + + $(WixExtDir)\WixUIExtension.dll + WixUIExtension + + + + + + + + + \ No newline at end of file diff --git a/NWS Alerts Setup/Product.wxs b/NWS Alerts Setup/Product.wxs new file mode 100644 index 0000000..e6fc800 --- /dev/null +++ b/NWS Alerts Setup/Product.wxs @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/NWS Alerts.sln b/NWS Alerts.sln index 5a0474d..3e4e0fb 100644 --- a/NWS Alerts.sln +++ b/NWS Alerts.sln @@ -10,20 +10,44 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NWS Alerts", "NWS Alerts\NW EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DesktopToast", "DesktopToast\DesktopToast.csproj", "{B8D704D5-FB0C-4C2D-8189-72C6649BA157}" EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "NWS Alerts Setup", "NWS Alerts Setup\NWS Alerts Setup.wixproj", "{8F84B1EE-6AFC-49FA-8B9C-51A710462C0C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A53F850E-6A86-4DBC-88E8-4006DF3CF820}" + ProjectSection(SolutionItems) = preProject + AssemblyVersionInfo.cs = AssemblyVersionInfo.cs + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CB7BA755-6053-4716-9284-273D66978262}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CB7BA755-6053-4716-9284-273D66978262}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CB7BA755-6053-4716-9284-273D66978262}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CB7BA755-6053-4716-9284-273D66978262}.Release|Any CPU.Build.0 = Release|Any CPU - {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Release|Any CPU.Build.0 = Release|Any CPU + {CB7BA755-6053-4716-9284-273D66978262}.Debug|x64.ActiveCfg = Debug|x64 + {CB7BA755-6053-4716-9284-273D66978262}.Debug|x64.Build.0 = Debug|x64 + {CB7BA755-6053-4716-9284-273D66978262}.Debug|x86.ActiveCfg = Debug|x86 + {CB7BA755-6053-4716-9284-273D66978262}.Debug|x86.Build.0 = Debug|x86 + {CB7BA755-6053-4716-9284-273D66978262}.Release|x64.ActiveCfg = Release|x64 + {CB7BA755-6053-4716-9284-273D66978262}.Release|x64.Build.0 = Release|x64 + {CB7BA755-6053-4716-9284-273D66978262}.Release|x86.ActiveCfg = Release|x86 + {CB7BA755-6053-4716-9284-273D66978262}.Release|x86.Build.0 = Release|x86 + {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Debug|x64.ActiveCfg = Debug|x64 + {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Debug|x64.Build.0 = Debug|x64 + {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Debug|x86.ActiveCfg = Debug|x86 + {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Debug|x86.Build.0 = Debug|x86 + {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Release|x64.ActiveCfg = Release|x64 + {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Release|x64.Build.0 = Release|x64 + {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Release|x86.ActiveCfg = Release|x86 + {B8D704D5-FB0C-4C2D-8189-72C6649BA157}.Release|x86.Build.0 = Release|x86 + {8F84B1EE-6AFC-49FA-8B9C-51A710462C0C}.Debug|x64.ActiveCfg = Debug|x64 + {8F84B1EE-6AFC-49FA-8B9C-51A710462C0C}.Debug|x86.ActiveCfg = Debug|x86 + {8F84B1EE-6AFC-49FA-8B9C-51A710462C0C}.Debug|x86.Build.0 = Debug|x86 + {8F84B1EE-6AFC-49FA-8B9C-51A710462C0C}.Release|x64.ActiveCfg = Release|x64 + {8F84B1EE-6AFC-49FA-8B9C-51A710462C0C}.Release|x64.Build.0 = Release|x64 + {8F84B1EE-6AFC-49FA-8B9C-51A710462C0C}.Release|x86.ActiveCfg = Release|x86 + {8F84B1EE-6AFC-49FA-8B9C-51A710462C0C}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/NWS Alerts/ToastImage.png b/NWS Alerts/DesktopToast.png similarity index 100% rename from NWS Alerts/ToastImage.png rename to NWS Alerts/DesktopToast.png diff --git a/NWS Alerts/DesktopWeather.xaml.cs b/NWS Alerts/DesktopWeather.xaml.cs index aef9942..972fac4 100644 --- a/NWS Alerts/DesktopWeather.xaml.cs +++ b/NWS Alerts/DesktopWeather.xaml.cs @@ -29,7 +29,7 @@ public partial class DesktopWeather : Window public static bool ConnectedToInternet = true; static DateTime AlertTime = DateTime.Now.AddSeconds(-DateTime.Now.Second); public static DispatcherTimer timer; - static readonly string LocalDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + static readonly string NWSAlertsDirectory = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\NWS Alerts"; // Desktop Weather References static XmlDocument xmlDoc; @@ -53,6 +53,11 @@ public DesktopWeather() { InitializeComponent(); + if (!Directory.Exists(NWSAlertsDirectory)) + { + Directory.CreateDirectory(NWSAlertsDirectory); + } + RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\PackageRepository\Extensions\ProgIDs\AppXgtz62cfp9761w8h33sbaykyt1vkbm4vj"); foreach (string vName in key.GetValueNames()) @@ -163,11 +168,11 @@ public void DesktopWeatherXML(string url, string savePath) EasyLogger.Info("It appears that you do not have an internet connection. We will retry later. The actual error message is: " + Environment.NewLine + Environment.NewLine + " " + ex.Message + Environment.NewLine); } - if (File.Exists(LocalDirectory + "\\WeatherInfo.xml")) + if (File.Exists(NWSAlertsDirectory + "\\WeatherInfo.xml")) { EasyLogger.Info("New weather information downloaded and saved successfully"); - fileInfo = new FileInfo(LocalDirectory + "\\WeatherInfo.xml"); + fileInfo = new FileInfo(NWSAlertsDirectory + "\\WeatherInfo.xml"); FileTime = fileInfo.LastWriteTime; } @@ -191,7 +196,7 @@ public void SetWeatherUI() { EasyLogger.Info("Updating Desktop Weather info using WeatherInfo.xml"); - using (FileStream fileStream = new FileStream(LocalDirectory + "\\WeatherInfo.xml", + using (FileStream fileStream = new FileStream(NWSAlertsDirectory + "\\WeatherInfo.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) @@ -382,7 +387,7 @@ public void DateTimeSettings() EasyLogger.Info("Downloading new weather info using values: " + Default.LatValue + "," + Default.LongValue); - Thread thread = new Thread(() => DesktopWeatherXML(PreWeatherString + Default.LatValue + "," + Default.LongValue, LocalDirectory + "\\WeatherInfo.xml")) + Thread thread = new Thread(() => DesktopWeatherXML(PreWeatherString + Default.LatValue + "," + Default.LongValue, NWSAlertsDirectory + "\\WeatherInfo.xml")) { IsBackground = true }; @@ -474,9 +479,9 @@ private void LoadSettings() thread.Start(); } - if (File.Exists(LocalDirectory + "\\WeatherInfo.xml")) + if (File.Exists(NWSAlertsDirectory + "\\WeatherInfo.xml")) { - fileInfo = new FileInfo(LocalDirectory + "\\WeatherInfo.xml"); + fileInfo = new FileInfo(NWSAlertsDirectory + "\\WeatherInfo.xml"); FileTime = fileInfo.LastWriteTime; @@ -566,7 +571,7 @@ private void CloseSettings_Click(object sender, RoutedEventArgs e) Updating = true; - Thread thread = new Thread(() => DesktopWeatherXML(PreWeatherString + Default.LatValue + "," + Default.LongValue, LocalDirectory + "\\WeatherInfo.xml")) + Thread thread = new Thread(() => DesktopWeatherXML(PreWeatherString + Default.LatValue + "," + Default.LongValue, NWSAlertsDirectory + "\\WeatherInfo.xml")) { IsBackground = true }; diff --git a/NWS Alerts/MainWindow.xaml.cs b/NWS Alerts/MainWindow.xaml.cs index aeca593..af67390 100644 --- a/NWS Alerts/MainWindow.xaml.cs +++ b/NWS Alerts/MainWindow.xaml.cs @@ -30,7 +30,6 @@ public partial class MainWindow : Window private const string MessageId = "Message"; public string MessageTitle = "National Weather Service"; public string MessageBody { get; set; } - private const string MessageThumbImage = "ToastImage.png"; #endregion References @@ -38,8 +37,6 @@ public partial class MainWindow : Window public MainWindow() { - Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); - InitializeComponent(); EasyLogger.BackupLogs(EasyLogger.LogFile); @@ -224,6 +221,7 @@ private async Task ShowInteractiveToastAsync(int expire) ToastXml = ComposeInteractiveToast(), ShortcutFileName = "NWS Alerts.lnk", ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location, + ShortcutWorkingFolder = AppDomain.CurrentDomain.BaseDirectory, AppId = "NWS Alerts", ActivatorId = typeof(NotificationActivator).GUID }; @@ -246,7 +244,7 @@ private string ComposeInteractiveToast() }, AppLogoOverride = new ToastGenericAppLogo { - Source = string.Format("file:///{0}", Path.GetFullPath(MessageThumbImage)), + Source = string.Format("file:///{0}", Path.GetFullPath("DesktopToast.png")), AlternateText = "" } } diff --git a/NWS Alerts/NWS Alerts.csproj b/NWS Alerts/NWS Alerts.csproj index 02d11e4..74f2496 100644 --- a/NWS Alerts/NWS Alerts.csproj +++ b/NWS Alerts/NWS Alerts.csproj @@ -16,37 +16,53 @@ true - - AnyCPU + + false + + + + + + + Resources\DayNotify.ico + + true - pdbonly - false ..\Release\ DEBUG;TRACE + full + x64 + 7.3 prompt - 4 - false + MinimumRecommendedRules.ruleset - - AnyCPU - none - true + ..\Release\ TRACE + true + x64 + 7.3 prompt - 4 - false - false + MinimumRecommendedRules.ruleset - - false - - - - + + true + bin\x86\Debug\ + DEBUG;TRACE + pdbonly + x86 + 7.3 + prompt + MinimumRecommendedRules.ruleset - - Resources\DayNotify.ico + + ..\Release\ + TRACE + true + x86 + 7.3 + prompt + MinimumRecommendedRules.ruleset @@ -170,7 +186,7 @@ - + PreserveNewest diff --git a/NWS Alerts/Properties/AssemblyInfo.cs b/NWS Alerts/Properties/AssemblyInfo.cs index dc17c70..0a556ee 100644 --- a/NWS Alerts/Properties/AssemblyInfo.cs +++ b/NWS Alerts/Properties/AssemblyInfo.cs @@ -1,11 +1,7 @@ using System.Reflection; -using System.Resources; using System.Runtime.InteropServices; using System.Windows; -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. [assembly: AssemblyTitle("NWS Alerts")] [assembly: AssemblyDescription("National Weather Service Alerts")] [assembly: AssemblyConfiguration("")] @@ -15,42 +11,5 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// 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("2.1.0.0")] -[assembly: AssemblyFileVersion("2.1.0.0")] -[assembly: NeutralResourcesLanguage("en-US")] +[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] [assembly: Guid("535888A1-AEC1-4917-8EE8-767689CB4B45")] diff --git a/NWS Alerts/SettingsWindow.xaml b/NWS Alerts/SettingsWindow.xaml index 9b4c049..8a7dd9d 100644 --- a/NWS Alerts/SettingsWindow.xaml +++ b/NWS Alerts/SettingsWindow.xaml @@ -4,7 +4,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Name="window" AllowsTransparency="True" BorderBrush="Black" BorderThickness="1" MouseDown="Window_MouseDown" - Title="MainWindow" Height="260" Width="590" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" ShowInTaskbar="False" WindowStyle="None" Background="#FF1D1D1D"> + Title="MainWindow" Height="280" Width="590" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" ShowInTaskbar="False" WindowStyle="None" Background="#FF1D1D1D" Topmost="True"> @@ -16,7 +16,7 @@ - +