├── .gitattributes ├── .gitignore ├── LICENSE ├── Programs └── SweWPF │ ├── App.config │ ├── App.xaml │ ├── App.xaml.cs │ ├── Controls │ ├── DateTimeInput.xaml │ ├── DateTimeInput.xaml.cs │ ├── LatitudeInput.xaml │ ├── LatitudeInput.xaml.cs │ ├── LongitudeInput.xaml │ └── LongitudeInput.xaml.cs │ ├── Converters │ ├── DoubleToDegreesFormatConverter.cs │ ├── DoubleToTimeFormatConverter.cs │ └── StringEmptyToVisibility.cs │ ├── GlobalSuppressions.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── Models │ ├── Configuration.cs │ ├── EphemerisResult.cs │ ├── HouseValues.cs │ ├── InputCalculation.cs │ └── PlanetValues.cs │ ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings │ ├── Services │ ├── CalcService.cs │ └── ICalcService.cs │ ├── SweWPF.csproj │ ├── SwephData │ └── sedeltat.txt │ ├── Themes │ ├── DataTemplates.xaml │ └── Styles.xaml │ ├── ViewModels │ ├── CalculationResultViewModel.cs │ ├── ConfigViewModel.cs │ ├── InputDateViewModel.cs │ ├── InputViewModel.cs │ ├── MainViewModel.cs │ ├── RelayCommand.cs │ ├── ViewModel.cs │ └── [Enums].cs │ ├── Views │ ├── ConfigView.xaml │ ├── ConfigView.xaml.cs │ ├── InputDateView.xaml │ ├── InputDateView.xaml.cs │ ├── InputView.xaml │ ├── InputView.xaml.cs │ ├── ResultView.xaml │ └── ResultView.xaml.cs │ └── packages.config ├── README.md ├── SwephNet.sln ├── SwephNet ├── SweNet │ ├── Date │ │ ├── DateUT.cs │ │ ├── EphemerisTime.cs │ │ ├── IDeltaTReader.cs │ │ ├── JulianDay.cs │ │ ├── SideralTime.cs │ │ ├── StreamDeltaTReader.cs │ │ ├── SweDate.cs │ │ └── WeekDay.cs │ ├── Extensions │ │ ├── DateTimeExtensions.cs │ │ └── StringExtensions.cs │ ├── Geo │ │ ├── GeoPosition.cs │ │ ├── Latitude.cs │ │ └── Longitude.cs │ ├── Houses │ │ └── SweHouse.cs │ ├── Persit │ │ ├── EmptyDataProvider.cs │ │ ├── IDataProvider.cs │ │ ├── IDataReader.cs │ │ └── StreamDataReader.cs │ ├── Planets │ │ ├── IAsteroidNameReader.cs │ │ ├── Planet.cs │ │ └── SwePlanet.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SweConfig.cs │ ├── SweConst.cs │ ├── SweFormat.cs │ ├── SweNet.csproj │ ├── Sweph.cs │ ├── [Enums].cs │ ├── [Events].cs │ └── packages.config └── SwephNet │ ├── Date │ ├── DeltaTRecord.cs │ ├── DeltaTRecordFile.cs │ ├── EphemerisTime.cs │ ├── IDeltaTRecordProvider.cs │ ├── JulianDay.cs │ ├── SideralTime.cs │ ├── SweDate.cs │ ├── UniversalTime.cs │ └── [Enums].cs │ ├── Dependency │ ├── IDependencyContainer.cs │ └── SimpleContainer.cs │ ├── Extensions │ ├── DateTimeExtensions.cs │ ├── DependencyExtensions.cs │ ├── HouseExtensions.cs │ └── TracerExtensions.cs │ ├── Geo │ ├── GeoPosition.cs │ ├── Latitude.cs │ └── Longitude.cs │ ├── Houses │ ├── HousePoint.cs │ ├── HouseResult.cs │ ├── HouseSystem.cs │ └── SweHouse.cs │ ├── JPL │ └── [Enums].cs │ ├── Locales │ ├── LSR.Designer.cs │ ├── LSR.fr.resx │ └── LSR.resx │ ├── Persit │ ├── IStreamProvider.cs │ └── LoadFileEventArgs.cs │ ├── Planets │ ├── AsteroidNameFile.cs │ ├── IAsteroidNameProvider.cs │ ├── IOsculatingElementProvider.cs │ ├── OsculatingElement.cs │ ├── OsculatingElementFile.cs │ ├── Planet.cs │ └── SwePlanet.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SweError.cs │ ├── SweFormat.cs │ ├── SweLib.cs │ ├── Sweph.cs │ ├── SwephNet.csproj │ ├── Utils │ ├── Check.cs │ └── ITracer.cs │ └── [Events].cs ├── Tests ├── SweNet.Tests │ ├── DateUTTest.cs │ ├── EphemerisTimeTest.cs │ ├── GeoPositionTest.cs │ ├── JulianDayTest.cs │ ├── LatitudeTest.cs │ ├── LongitudeTest.cs │ ├── PlanetTest.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SideralTimeTest.cs │ ├── StringExtensionsTest.cs │ ├── SweDateTest.cs │ ├── SweNet.Tests.csproj │ ├── SwePlanetTest.cs │ ├── SwephTest.Date.cs │ └── packages.config └── SwephNet.Tests │ ├── CheckTest.cs │ ├── DependencyTest.cs │ ├── EphemerisTimeTest.cs │ ├── GeoPositionTest.cs │ ├── JulianDayTest.cs │ ├── LatitudeTest.cs │ ├── LongitudeTest.cs │ ├── PlanetTest.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SideralTimeTest.cs │ ├── SweDateTest.cs │ ├── SweErrorTest.cs │ ├── SweFormatTest.cs │ ├── SweLibTest.cs │ ├── SwePlanetTest-fr.cs │ ├── SwePlanetTest.cs │ ├── SwephDateTest.cs │ ├── SwephNet.Tests.csproj │ ├── SwephTest.cs │ └── UniversalTimeTest.cs ├── appveyor.yml └── release_notes.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | [Dd]ebug/ 11 | [Dd]ebugPublic/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | bld/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # MSTest test Results 20 | [Tt]est[Rr]esult*/ 21 | [Bb]uild[Ll]og.* 22 | 23 | #NUNIT 24 | *.VisualState.xml 25 | TestResult.xml 26 | 27 | # Build Results of an ATL Project 28 | [Dd]ebugPS/ 29 | [Rr]eleasePS/ 30 | dlldata.c 31 | 32 | *_i.c 33 | *_p.c 34 | *_i.h 35 | *.ilk 36 | *.meta 37 | *.obj 38 | *.pch 39 | *.pdb 40 | *.pgc 41 | *.pgd 42 | *.rsp 43 | *.sbr 44 | *.tlb 45 | *.tli 46 | *.tlh 47 | *.tmp 48 | *.tmp_proj 49 | *.log 50 | *.vspscc 51 | *.vssscc 52 | .builds 53 | *.pidb 54 | *.svclog 55 | *.scc 56 | 57 | # Chutzpah Test files 58 | _Chutzpah* 59 | 60 | # Visual C++ cache files 61 | ipch/ 62 | *.aps 63 | *.ncb 64 | *.opensdf 65 | *.sdf 66 | *.cachefile 67 | 68 | # Visual Studio profiler 69 | *.psess 70 | *.vsp 71 | *.vspx 72 | 73 | # TFS 2012 Local Workspace 74 | $tf/ 75 | 76 | # Guidance Automation Toolkit 77 | *.gpState 78 | 79 | # ReSharper is a .NET coding add-in 80 | _ReSharper*/ 81 | *.[Rr]e[Ss]harper 82 | *.DotSettings.user 83 | 84 | # JustCode is a .NET coding addin-in 85 | .JustCode 86 | 87 | # TeamCity is a build add-in 88 | _TeamCity* 89 | 90 | # DotCover is a Code Coverage Tool 91 | *.dotCover 92 | 93 | # NCrunch 94 | *.ncrunch* 95 | _NCrunch_* 96 | .*crunch*.local.xml 97 | 98 | # MightyMoose 99 | *.mm.* 100 | AutoTest.Net/ 101 | 102 | # Web workbench (sass) 103 | .sass-cache/ 104 | 105 | # Installshield output folder 106 | [Ee]xpress/ 107 | 108 | # DocProject is a documentation generator add-in 109 | DocProject/buildhelp/ 110 | DocProject/Help/*.HxT 111 | DocProject/Help/*.HxC 112 | DocProject/Help/*.hhc 113 | DocProject/Help/*.hhk 114 | DocProject/Help/*.hhp 115 | DocProject/Help/Html2 116 | DocProject/Help/html 117 | 118 | # Click-Once directory 119 | publish/ 120 | 121 | # Publish Web Output 122 | *.[Pp]ublish.xml 123 | *.azurePubxml 124 | 125 | # NuGet Packages Directory 126 | packages/ 127 | ## TODO: If the tool you use requires repositories.config uncomment the next line 128 | #!packages/repositories.config 129 | 130 | # Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets 131 | # This line needs to be after the ignore of the build folder (and the packages folder if the line above has been uncommented) 132 | !packages/build/ 133 | 134 | # Windows Azure Build Output 135 | csx/ 136 | *.build.csdef 137 | 138 | # Windows Store app package directory 139 | AppPackages/ 140 | 141 | # Others 142 | sql/ 143 | *.Cache 144 | ClientBin/ 145 | [Ss]tyle[Cc]op.* 146 | ~$* 147 | *~ 148 | *.dbmdl 149 | *.dbproj.schemaview 150 | *.pfx 151 | *.publishsettings 152 | node_modules/ 153 | 154 | # RIA/Silverlight projects 155 | Generated_Code/ 156 | 157 | # Backup & report files from converting an old project file to a newer 158 | # Visual Studio version. Backup files are not needed, because we have git ;-) 159 | _UpgradeReport_Files/ 160 | Backup*/ 161 | UpgradeLog*.XML 162 | UpgradeLog*.htm 163 | 164 | # SQL Server files 165 | *.mdf 166 | *.ldf 167 | 168 | # Business Intelligence projects 169 | *.rdl.data 170 | *.bim.layout 171 | *.bim_*.settings 172 | 173 | # Microsoft Fakes 174 | FakesAssemblies/ 175 | /README.html 176 | /README.min.html 177 | /release-bin 178 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland. All rights reserved. 2 | 3 | License conditions 4 | ------------------ 5 | 6 | This file is part of Swiss Ephemeris. 7 | 8 | Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author 9 | or distributor accepts any responsibility for the consequences of using it, 10 | or for whether it serves any particular purpose or works at all, unless he 11 | or she says so in writing. 12 | 13 | Swiss Ephemeris is made available by its authors under a dual licensing 14 | system. The software developer, who uses any part of Swiss Ephemeris 15 | in his or her software, must choose between one of the two license models, 16 | which are 17 | a) GNU public license version 2 or later 18 | b) Swiss Ephemeris Professional License 19 | 20 | The choice must be made before the software developer distributes software 21 | containing parts of Swiss Ephemeris to others, and before any public 22 | service using the developed software is activated. 23 | 24 | If the developer choses the GNU GPL software license, he or she must fulfill 25 | the conditions of that license, which includes the obligation to place his 26 | or her whole software project under the GNU GPL or a compatible license. 27 | See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 28 | 29 | If the developer choses the Swiss Ephemeris Professional license, 30 | he must follow the instructions as found in http://www.astro.com/swisseph/ 31 | and purchase the Swiss Ephemeris Professional Edition from Astrodienst 32 | and sign the corresponding license contract. 33 | 34 | The License grants you the right to use, copy, modify and redistribute 35 | Swiss Ephemeris, but only under certain conditions described in the License. 36 | Among other things, the License requires that the copyright notices and 37 | this notice be preserved on all copies. 38 | 39 | Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 40 | 41 | The authors of Swiss Ephemeris have no control or influence over any of 42 | the derived works, i.e. over software or services created by other 43 | programmers which use Swiss Ephemeris functions. 44 | 45 | The names of the authors or of the copyright holder (Astrodienst) must not 46 | be used for promoting any software, product or service which uses or contains 47 | the Swiss Ephemeris. This copyright notice is the ONLY place where the 48 | names of the authors can legally appear, except in cases where they have 49 | given special permission in writing. 50 | 51 | The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 52 | for promoting such software, products or services. 53 | */ 54 | 55 | -------------------------------------------------------------------------------- /Programs/SweWPF/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Programs/SweWPF/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Programs/SweWPF/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Globalization; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | using System.Windows; 9 | using System.Windows.Markup; 10 | 11 | namespace SweWPF 12 | { 13 | /// 14 | /// Logique d'interaction pour App.xaml 15 | /// 16 | public partial class App : Application 17 | { 18 | 19 | protected override void OnStartup(StartupEventArgs e) { 20 | base.OnStartup(e); 21 | 22 | FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), 23 | new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); 24 | 25 | } 26 | 27 | protected override void OnExit(ExitEventArgs e) { 28 | base.OnExit(e); 29 | } 30 | 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Programs/SweWPF/Controls/DateTimeInput.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 42 | 43 | -------------------------------------------------------------------------------- /Programs/SweWPF/Controls/DateTimeInput.xaml.cs: -------------------------------------------------------------------------------- 1 | using SweNet; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | using System.Windows.Data; 10 | using System.Windows.Documents; 11 | using System.Windows.Input; 12 | using System.Windows.Media; 13 | using System.Windows.Media.Imaging; 14 | using System.Windows.Navigation; 15 | using System.Windows.Shapes; 16 | 17 | namespace SweWPF.Controls 18 | { 19 | /// 20 | /// Logique d'interaction pour DateTimeInput.xaml 21 | /// 22 | public partial class DateTimeInput : UserControl 23 | { 24 | public DateTimeInput() { 25 | InitializeComponent(); 26 | Date = new DateUT(DateTime.Now); 27 | } 28 | 29 | bool _Updating = false; 30 | 31 | private void DateChanged() { 32 | if (_Updating) return; 33 | _Updating = true; 34 | Day = Date.Day; 35 | Month = Date.Month; 36 | Year = Date.Year; 37 | Hours = Date.Hours; 38 | Minutes = Date.Minutes; 39 | Seconds = Date.Seconds; 40 | _Updating = false; 41 | } 42 | 43 | private void ElementDateChanged() { 44 | if (_Updating) return; 45 | try { 46 | _Updating = true; 47 | Date = new DateUT(Year, Month, Day, Hours, Minutes, Seconds); 48 | _Updating = false; 49 | } 50 | catch { 51 | _Updating = false; 52 | DateChanged(); 53 | } 54 | } 55 | 56 | public DateUT Date { 57 | get { return (DateUT)GetValue(DateProperty); } 58 | set { SetValue(DateProperty, value); } 59 | } 60 | 61 | public static readonly DependencyProperty DateProperty = 62 | DependencyProperty.Register("Date", typeof(DateUT), typeof(DateTimeInput), new PropertyMetadata(new DateUT(), DatePropertyChanged)); 63 | 64 | private static void DatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { 65 | var dti = d as DateTimeInput; 66 | if (dti != null) 67 | dti.DateChanged(); 68 | } 69 | 70 | 71 | public int Day { 72 | get { return (int)GetValue(DayProperty); } 73 | set { SetValue(DayProperty, value); } 74 | } 75 | public static readonly DependencyProperty DayProperty = 76 | DependencyProperty.Register("Day", typeof(int), typeof(DateTimeInput), new PropertyMetadata(1, ElementDatePropertyChanged)); 77 | 78 | public int Month { 79 | get { return (int)GetValue(MonthProperty); } 80 | set { SetValue(MonthProperty, value); } 81 | } 82 | public static readonly DependencyProperty MonthProperty = 83 | DependencyProperty.Register("Month", typeof(int), typeof(DateTimeInput), new PropertyMetadata(1, ElementDatePropertyChanged)); 84 | 85 | public int Year { 86 | get { return (int)GetValue(YearProperty); } 87 | set { SetValue(YearProperty, value); } 88 | } 89 | public static readonly DependencyProperty YearProperty = 90 | DependencyProperty.Register("Year", typeof(int), typeof(DateTimeInput), new PropertyMetadata(1, ElementDatePropertyChanged)); 91 | 92 | public int Hours { 93 | get { return (int)GetValue(HoursProperty); } 94 | set { SetValue(HoursProperty, value); } 95 | } 96 | public static readonly DependencyProperty HoursProperty = 97 | DependencyProperty.Register("Hours", typeof(int), typeof(DateTimeInput), new PropertyMetadata(1, ElementDatePropertyChanged)); 98 | 99 | public int Minutes { 100 | get { return (int)GetValue(MinutesProperty); } 101 | set { SetValue(MinutesProperty, value); } 102 | } 103 | public static readonly DependencyProperty MinutesProperty = 104 | DependencyProperty.Register("Minutes", typeof(int), typeof(DateTimeInput), new PropertyMetadata(1, ElementDatePropertyChanged)); 105 | 106 | public int Seconds { 107 | get { return (int)GetValue(SecondsProperty); } 108 | set { SetValue(SecondsProperty, value); } 109 | } 110 | public static readonly DependencyProperty SecondsProperty = 111 | DependencyProperty.Register("Seconds", typeof(int), typeof(DateTimeInput), new PropertyMetadata(1, ElementDatePropertyChanged)); 112 | 113 | private static void ElementDatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { 114 | var dti = d as DateTimeInput; 115 | if (dti != null) 116 | dti.ElementDateChanged(); 117 | } 118 | 119 | 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Programs/SweWPF/Controls/LatitudeInput.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Programs/SweWPF/Controls/LatitudeInput.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace SweWPF.Controls 17 | { 18 | /// 19 | /// Logique d'interaction pour LatitudeInput.xaml 20 | /// 21 | public partial class LatitudeInput : UserControl 22 | { 23 | public LatitudeInput() { 24 | Polarities = new SweNet.LatitudePolarity[]{ 25 | SweNet.LatitudePolarity.North, 26 | SweNet.LatitudePolarity.South, 27 | }; 28 | InitializeComponent(); 29 | } 30 | 31 | bool _Updating = false; 32 | 33 | private void LatitudeChanged() { 34 | if (_Updating) return; 35 | _Updating = true; 36 | Degrees = Latitude.Degrees; 37 | Minutes = Latitude.Minutes; 38 | Seconds = Latitude.Seconds; 39 | Polarity = Latitude.Polarity; 40 | _Updating = false; 41 | } 42 | 43 | private void ComponentChanged() { 44 | if (_Updating) return; 45 | try { 46 | _Updating = true; 47 | Latitude = new SweNet.Latitude(Degrees, Minutes, Seconds, Polarity); 48 | _Updating = false; 49 | } 50 | catch { 51 | _Updating = false; 52 | LatitudeChanged(); 53 | } 54 | } 55 | 56 | public SweNet.Latitude Latitude { 57 | get { return (SweNet.Latitude)GetValue(LatitudeProperty); } 58 | set { SetValue(LatitudeProperty, value); } 59 | } 60 | public static readonly DependencyProperty LatitudeProperty = 61 | DependencyProperty.Register("Latitude", typeof(SweNet.Latitude), typeof(LatitudeInput), new PropertyMetadata(new SweNet.Latitude(), LatitudePropertyChanged)); 62 | 63 | private static void LatitudePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { 64 | var li = d as LatitudeInput; 65 | if (li != null) 66 | li.LatitudeChanged(); 67 | } 68 | 69 | public int Degrees { 70 | get { return (int)GetValue(DegreesProperty); } 71 | set { SetValue(DegreesProperty, value); } 72 | } 73 | public static readonly DependencyProperty DegreesProperty = 74 | DependencyProperty.Register("Degrees", typeof(int), typeof(LatitudeInput), new PropertyMetadata(0, LatitudeComponentChanged)); 75 | 76 | private static void LatitudeComponentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { 77 | var li = d as LatitudeInput; 78 | if (li != null) 79 | li.ComponentChanged(); 80 | } 81 | 82 | public int Minutes { 83 | get { return (int)GetValue(MinutesProperty); } 84 | set { SetValue(MinutesProperty, value); } 85 | } 86 | public static readonly DependencyProperty MinutesProperty = 87 | DependencyProperty.Register("Minutes", typeof(int), typeof(LatitudeInput), new PropertyMetadata(0, LatitudeComponentChanged)); 88 | 89 | public int Seconds { 90 | get { return (int)GetValue(SecondsProperty); } 91 | set { SetValue(SecondsProperty, value); } 92 | } 93 | public static readonly DependencyProperty SecondsProperty = 94 | DependencyProperty.Register("Seconds", typeof(int), typeof(LatitudeInput), new PropertyMetadata(0, LatitudeComponentChanged)); 95 | 96 | public SweNet.LatitudePolarity Polarity { 97 | get { return (SweNet.LatitudePolarity)GetValue(PolarityProperty); } 98 | set { SetValue(PolarityProperty, value); } 99 | } 100 | public static readonly DependencyProperty PolarityProperty = 101 | DependencyProperty.Register("Polarity", typeof(SweNet.LatitudePolarity), typeof(LatitudeInput), new PropertyMetadata(SweNet.LatitudePolarity.North, LatitudeComponentChanged)); 102 | 103 | public SweNet.LatitudePolarity[] Polarities { get; private set; } 104 | 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Programs/SweWPF/Controls/LongitudeInput.xaml: -------------------------------------------------------------------------------- 1 |  10 | 11 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Programs/SweWPF/Controls/LongitudeInput.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Controls; 8 | using System.Windows.Data; 9 | using System.Windows.Documents; 10 | using System.Windows.Input; 11 | using System.Windows.Media; 12 | using System.Windows.Media.Imaging; 13 | using System.Windows.Navigation; 14 | using System.Windows.Shapes; 15 | 16 | namespace SweWPF.Controls 17 | { 18 | /// 19 | /// Logique d'interaction pour LongitudeInput.xaml 20 | /// 21 | public partial class LongitudeInput : UserControl 22 | { 23 | public LongitudeInput() { 24 | Polarities = new SweNet.LongitudePolarity[]{ 25 | SweNet.LongitudePolarity.East, 26 | SweNet.LongitudePolarity.West, 27 | }; 28 | InitializeComponent(); 29 | } 30 | 31 | bool _Updating = false; 32 | 33 | private void LongitudeChanged() { 34 | if (_Updating) return; 35 | _Updating = true; 36 | Degrees = Longitude.Degrees; 37 | Minutes = Longitude.Minutes; 38 | Seconds = Longitude.Seconds; 39 | Polarity = Longitude.Polarity; 40 | _Updating = false; 41 | } 42 | 43 | private void ComponentChanged() { 44 | if (_Updating) return; 45 | try { 46 | _Updating = true; 47 | Longitude = new SweNet.Longitude(Degrees, Minutes, Seconds, Polarity); 48 | _Updating = false; 49 | } 50 | catch { 51 | _Updating = false; 52 | LongitudeChanged(); 53 | } 54 | } 55 | 56 | public SweNet.Longitude Longitude { 57 | get { return (SweNet.Longitude)GetValue(LongitudeProperty); } 58 | set { SetValue(LongitudeProperty, value); } 59 | } 60 | public static readonly DependencyProperty LongitudeProperty = 61 | DependencyProperty.Register("Longitude", typeof(SweNet.Longitude), typeof(LongitudeInput), new PropertyMetadata(new SweNet.Longitude(), LongitudePropertyChanged)); 62 | 63 | private static void LongitudePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { 64 | var li = d as LongitudeInput; 65 | if (li != null) 66 | li.LongitudeChanged(); 67 | } 68 | 69 | public int Degrees { 70 | get { return (int)GetValue(DegreesProperty); } 71 | set { SetValue(DegreesProperty, value); } 72 | } 73 | public static readonly DependencyProperty DegreesProperty = 74 | DependencyProperty.Register("Degrees", typeof(int), typeof(LongitudeInput), new PropertyMetadata(0, LongitudeComponentChanged)); 75 | 76 | private static void LongitudeComponentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { 77 | var li = d as LongitudeInput; 78 | if (li != null) 79 | li.ComponentChanged(); 80 | } 81 | 82 | public int Minutes { 83 | get { return (int)GetValue(MinutesProperty); } 84 | set { SetValue(MinutesProperty, value); } 85 | } 86 | public static readonly DependencyProperty MinutesProperty = 87 | DependencyProperty.Register("Minutes", typeof(int), typeof(LongitudeInput), new PropertyMetadata(0, LongitudeComponentChanged)); 88 | 89 | public int Seconds { 90 | get { return (int)GetValue(SecondsProperty); } 91 | set { SetValue(SecondsProperty, value); } 92 | } 93 | public static readonly DependencyProperty SecondsProperty = 94 | DependencyProperty.Register("Seconds", typeof(int), typeof(LongitudeInput), new PropertyMetadata(0, LongitudeComponentChanged)); 95 | 96 | public SweNet.LongitudePolarity Polarity { 97 | get { return (SweNet.LongitudePolarity)GetValue(PolarityProperty); } 98 | set { SetValue(PolarityProperty, value); } 99 | } 100 | public static readonly DependencyProperty PolarityProperty = 101 | DependencyProperty.Register("Polarity", typeof(SweNet.LongitudePolarity), typeof(LongitudeInput), new PropertyMetadata(SweNet.LongitudePolarity.East, LongitudeComponentChanged)); 102 | 103 | public SweNet.LongitudePolarity[] Polarities { get; private set; } 104 | 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /Programs/SweWPF/Converters/DoubleToDegreesFormatConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Data; 7 | 8 | namespace SweWPF.Converters 9 | { 10 | 11 | /// 12 | /// Convert double to Degrees format 13 | /// 14 | public class DoubleToDegreesFormatConverter : IValueConverter 15 | { 16 | 17 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { 18 | double val = System.Convert.ToDouble(value); 19 | string fmt = parameter != null ? parameter.ToString() : null; 20 | return SwissEphNet.SwissEph.FormatToDegreeMinuteSecond(val, fmt); 21 | } 22 | 23 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { 24 | throw new NotImplementedException(); 25 | } 26 | 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Programs/SweWPF/Converters/DoubleToTimeFormatConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Data; 7 | 8 | namespace SweWPF.Converters 9 | { 10 | 11 | /// 12 | /// Convert double to Time/Hour format 13 | /// 14 | public class DoubleToTimeFormatConverter : IValueConverter 15 | { 16 | 17 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { 18 | double val = System.Convert.ToDouble(value); 19 | if (parameter != null && parameter.ToString() == "hour") 20 | return SweNet.SweFormat.FormatAsHour(val); 21 | else 22 | return SweNet.SweFormat.FormatAsTime(val); 23 | } 24 | 25 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { 26 | throw new NotImplementedException(); 27 | } 28 | 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /Programs/SweWPF/Converters/StringEmptyToVisibility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows; 7 | using System.Windows.Data; 8 | 9 | namespace SweWPF.Converters 10 | { 11 | 12 | public class StringEmptyToVisibility : IValueConverter 13 | { 14 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { 15 | bool isVisible = !(value == null || String.IsNullOrWhiteSpace(value.ToString())); 16 | if (parameter != null && parameter.ToString() == "not") 17 | isVisible = !isVisible; 18 | return isVisible ? Visibility.Visible : Visibility.Collapsed; 19 | } 20 | 21 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /Programs/SweWPF/GlobalSuppressions.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ygrenier/SwephNet/164a8b734d7dc5aad06070db7e4d33ce83127e0f/Programs/SweWPF/GlobalSuppressions.cs -------------------------------------------------------------------------------- /Programs/SweWPF/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |