public Plugin(ISky sky, ISkyMap map, TrackCalc trackCalc) { this.sky = sky; this.map = map; this.trackCalc = trackCalc; this.map.SelectedObjectChanged += (o) => NotifyPropertyChanged(nameof(IsMotionTrackEnabled)); this.trackCalc.Tracks.CollectionChanged += (s, e) => NotifyPropertyChanged(nameof(IsTracksListEnabled)); var contextMenuTrack = new MenuItem("$Astrarium.Plugins.Tracks.ContextMenu", new Command(ShowMotionTrackWindow)); contextMenuTrack.AddBinding(new SimpleBinding(this, nameof(IsMotionTrackEnabled), nameof(MenuItem.IsEnabled))); MenuItems.Add(MenuItemPosition.ContextMenu, contextMenuTrack); var toolsMenuTracks = new MenuItem("$Astrarium.Plugins.Tracks.ToolsMenu", new Command(ShowTracksListWindow)); var menuAddTrack = new MenuItem("$Astrarium.Plugins.Tracks.ToolsMenu.Add", new Command(ShowMotionTrackWindow)); menuAddTrack.HotKey = new KeyGesture(Key.T, ModifierKeys.Control, "Ctrl+T"); var menuTracksList = new MenuItem("$Astrarium.Plugins.Tracks.ToolsMenu.List", new Command(ShowTracksListWindow)); menuTracksList.AddBinding(new SimpleBinding(this, nameof(IsTracksListEnabled), nameof(MenuItem.IsEnabled))); menuTracksList.HotKey = new KeyGesture(Key.T, ModifierKeys.Control | ModifierKeys.Shift, "Ctrl+Shift+T"); toolsMenuTracks.SubItems.Add(menuAddTrack); toolsMenuTracks.SubItems.Add(menuTracksList); MenuItems.Add(MenuItemPosition.MainMenuTools, toolsMenuTracks); }
public AsteroidsCalc(ISky sky, ISettings settings, AsteroidsReader reader, AsteroidsDataUpdater updater) { this.sky = sky; this.settings = settings; this.reader = reader; this.updater = updater; }
public Plugin(ISky sky, ISkyMap map) { this.sky = sky; this.map = map; AddContextMenuItem(new ContextMenuItem("Motion track", ShowMotionTrackWindow, IsMotionTrackEnabled, () => true)); }
public CometsCalc(ISky sky, ISettings settings, CometsReader reader, CometsDataUpdater updater) { this.sky = sky; this.settings = settings; this.reader = reader; this.updater = updater; }
public PlannerPlugin(ISky sky, ISkyMap map, ISettings settings, IRecentPlansManager recentPlansManager, IPlanManagerFactory planManagerFactory) { this.sky = sky; this.map = map; this.settings = settings; this.map.SelectedObjectChanged += (x) => NotifyPropertyChanged(nameof(HasSelectedObject)); this.planManagerFactory = planManagerFactory; this.recentPlansManager = recentPlansManager; DefineSetting("PlannerDefaultSettings", new PlanningFilter(), isPermanent: true); /* Main app menu */ MenuItem plannerMenu = new MenuItem("$Planner.Menu.Planner"); MenuItem recentPlansMenu = new MenuItem("$Planner.Menu.RecentPlans"); recentPlansMenu.AddBinding(new SimpleBinding(this, nameof(RecentPlansMenuItems), nameof(MenuItem.SubItems))); recentPlansMenu.AddBinding(new SimpleBinding(this, nameof(HasRecentPlans), nameof(MenuItem.IsEnabled))); plannerMenu.SubItems = new ObservableCollection <MenuItem>(new[] { new MenuItem("$Planner.Menu.CreateNewPlan", new Command <PlanImportData>(CreateNewPlan), null), new MenuItem("$Planner.Menu.OpenPlan", new Command(OpenPlan)), recentPlansMenu, null, new MenuItem("$Planner.Menu.Defaults", new Command(ShowPlannerDefaults)) }); MenuItems.Add(MenuItemPosition.MainMenuTop, plannerMenu); /* Context menu */ MenuItem contextMenu = new MenuItem("$Planner.ContextMenu.AddToObservationPlan"); contextMenu.AddBinding(new SimpleBinding(this, nameof(HasSelectedObject), nameof(MenuItem.IsEnabled))); contextMenu.AddBinding(new SimpleBinding(this, nameof(ActivePlansMenuItems), nameof(MenuItem.SubItems))); MenuItems.Add(MenuItemPosition.ContextMenu, contextMenu); }
public EphemerisVM(ISky sky) { this.sky = sky; SaveToFileCommand = new Command(SaveToFile); CloseCommand = new Command(Close); }
public PhenomenaVM(ISky sky) { this.sky = sky; SaveToFileCommand = new Command(SaveToFile); CloseCommand = new Command(Close); SelectAstroEventCommand = new Command <AstroEventVM>(SelectAstroEvent); }
public MotionTrackVM(ISky sky, ITracksProvider tracksProvider) { this.sky = sky; this.tracksProvider = tracksProvider; OkCommand = new Command(Ok); CancelCommand = new Command(Close); }
public AstrariumPlanManager(ISky sky) { this.sky = sky; this.jsonSerializerSettings = new JsonSerializerSettings() { DateFormatString = "yyyy-MM-dd" }; }
public EphemerisSettingsVM(ISky sky) { this.sky = sky; UtcOffset = sky.Context.GeoLocation.UtcOffset; OkCommand = new Command(Ok); CancelCommand = new Command(Close); }
public MotionTrackVM(ISky sky, ISettings settings, TrackCalc trackCalc) { this.sky = sky; this.trackCalc = trackCalc; ColorSchema = settings.Get <ColorSchema>("Schema"); OkCommand = new Command(Ok); CancelCommand = new Command(Close); }
public StarsRenderer(ISky sky, StarsCalc starsCalc, ISettings settings) { this.sky = sky; this.starsCalc = starsCalc; this.settings = settings; penConLine = new Pen(new SolidBrush(Color.Transparent)); penConLine.DashStyle = DashStyle.Custom; penConLine.DashPattern = new float[] { 2, 2 }; starColor = Color.White; }
public PhenomenaSettingsVM(ISky sky) { this.sky = sky; UtcOffset = sky.Context.GeoLocation.UtcOffset; OkCommand = new Command(Ok); CancelCommand = new Command(Close); BuildCategoriesTree(); }
public TracksListVM(ISky sky, ITracksProvider tracksProvider) { this.sky = sky; this.tracksProvider = tracksProvider; CancelCommand = new Command(Close); SelectTrackCommand = new Command <TrackListItemVM>(SelectTrack); EditSelectedTrackCommand = new Command(EditSelectedTrack); DeleteSelectedTrackCommand = new Command(DeleteSelectedTrack); AddTrackCommand = new Command(AddTrack); LoadList(); }
public TracksListVM(ISky sky, ISettings settings, TrackCalc trackCalc) { this.sky = sky; this.trackCalc = trackCalc; ColorSchema = settings.Get <ColorSchema>("Schema"); CancelCommand = new Command(Close); SelectTrackCommand = new Command <TrackListItemVM>(SelectTrack); EditSelectedTrackCommand = new Command(EditSelectedTrack); DeleteSelectedTrackCommand = new Command(DeleteSelectedTrack); AddTrackCommand = new Command(AddTrack); LoadList(); }
public PhenomenaSettingsVM(ISky sky) { this.sky = sky; JulianDayFrom = cache?.JdFrom ?? sky.Context.JulianDay; JulianDayTo = cache?.JdTo ?? sky.Context.JulianDay + 30; UtcOffset = sky.Context.GeoLocation.UtcOffset; OkCommand = new Command(Ok); CancelCommand = new Command(Close); BuildCategoriesTree(); }
public MainVM(ISky sky, ISkyMap map, ISettings settings, ToolbarButtonsConfig toolbarButtonsConfig, ContextMenuItemsConfig contextMenuItemsConfig) { this.sky = sky; this.map = map; this.settings = settings; sky.Calculate(); MapKeyDownCommand = new Command <Key>(MapKeyDown); ZoomCommand = new Command <int>(Zoom); MapDoubleClickCommand = new Command <PointF>(MapDoubleClick); MapRightClickCommand = new Command <PointF>(MapRightClick); SetDateCommand = new Command(SetDate); SelectLocationCommand = new Command(SelectLocation); SearchObjectCommand = new Command(SearchObject); CenterOnPointCommand = new Command <PointF>(CenterOnPoint); GetObjectInfoCommand = new Command <CelestialObject>(GetObjectInfo); GetObjectEphemerisCommand = new Command <CelestialObject>(GetObjectEphemeris); CalculatePhenomenaCommand = new Command(CalculatePhenomena); LockOnObjectCommand = new Command <CelestialObject>(LockOnObject); CenterOnObjectCommand = new Command <CelestialObject>(CenterOnObject); ClearObjectsHistoryCommand = new Command(ClearObjectsHistory); ChangeSettingsCommand = new Command(ChangeSettings); sky.Context.ContextChanged += Sky_ContextChanged; sky.Calculated += () => map.Invalidate(); sky.DateTimeSyncChanged += () => NotifyPropertyChanged(nameof(DateTimeSync)); map.SelectedObjectChanged += Map_SelectedObjectChanged; map.ViewAngleChanged += Map_ViewAngleChanged; settings.SettingValueChanged += (s, v) => map.Invalidate(); Sky_ContextChanged(); Map_SelectedObjectChanged(map.SelectedObject); Map_ViewAngleChanged(map.ViewAngle); var toolbarGroups = toolbarButtonsConfig.GroupBy(b => b.Group); foreach (var group in toolbarGroups) { foreach (var button in group) { ToolbarItems.Add(button); } ToolbarItems.Add(new ToolbarSeparator()); } this.contextMenuItemsConfig = contextMenuItemsConfig; }
/// <summary> /// Creates new instance of <see cref="LocationVM"/> /// </summary> public LocationVM(ISky sky, ISettings settings) { CrdsEquatorial eqSun = SolarEphem.Ecliptical(sky.Context.JulianDay).ToEquatorial(sky.Context.Epsilon); ObserverLocation = new CrdsGeographical(sky.Context.GeoLocation); SunHourAngle = Coordinates.HourAngle(sky.Context.SiderealTime, 0, eqSun.Alpha); SunDeclination = eqSun.Delta; IsNightMode = settings.Get <ColorSchema>("Schema") == ColorSchema.Red; OkCommand = new Command(Ok); CancelCommand = new Command(Close); EndSearchModeCommand = new Command(EndSearchMode); SelectLocationCommand = new Command(SelectLocation); string line; string filePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Data", "TimeZones.dat"); using (StreamReader file = new StreamReader(filePath)) { while ((line = file.ReadLine()) != null) { // skip first and empty lines if (line.StartsWith("CountryCode") || string.IsNullOrWhiteSpace(line)) { continue; } string[] chunks = line.Split('\t'); TimeZones.Add(new TimeZoneItem() { TimeZoneId = chunks[1], UtcOffset = double.Parse(chunks[4], CultureInfo.InvariantCulture) }); } file.Close(); } }
public Plugin(ISkyMap map, ISky sky, ISettings settings) { var menuAscom = new MenuItem("$Menu.Telescope"); this.ascom = Ascom.Proxy; this.map = map; this.sky = sky; this.settings = settings; DefineSetting("ASCOMTelescopeId", "", isPermanent: true); var menuConnectTelescope = new MenuItem("$Menu.ConnectToTelescope", new Command(ConnectTelescope)); menuConnectTelescope.AddBinding(new SimpleBinding(this, nameof(IsConnectTelescopeVisible), nameof(MenuItem.IsVisible))); var menuDisconnectTelescope = new MenuItem("$Menu.DisconnectTelescope", new Command(DisconnectTelescope)); menuDisconnectTelescope.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsVisible))); menuDisconnectTelescope.AddBinding(new SimpleBinding(this, nameof(DisconnectTitle), nameof(MenuItem.Header))); var menuFindCurrentPoint = new MenuItem("$Menu.FindCurrentPoint", new Command(FindCurrentPoint)); menuFindCurrentPoint.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuAbortSlew = new MenuItem("$Menu.AbortSlew", new Command(AbortSlew)); menuAbortSlew.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsSlewing), nameof(MenuItem.IsEnabled))); var menuFindHome = new MenuItem("$Menu.Home", new Command(FindHome)); menuFindHome.AddBinding(new SimpleBinding(ascom, nameof(ascom.AtHome), nameof(MenuItem.IsChecked))); menuFindHome.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuPark = new MenuItem("$Menu.Park", new Command(ParkOrUnpark)); menuPark.AddBinding(new SimpleBinding(ascom, nameof(ascom.AtPark), nameof(MenuItem.IsChecked))); menuPark.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuTrack = new MenuItem("$Menu.Track", new Command(SwitchTracking)); menuTrack.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsTracking), nameof(MenuItem.IsChecked))); menuTrack.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuSetup = new MenuItem("$Menu.Setup", new Command(ShowSetupDialog)); menuSetup.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); var menuInfo = new MenuItem("$Menu.AscomInformation", new Command(ShowInfo)); menuInfo.AddBinding(new SimpleBinding(ascom, nameof(ascom.IsConnected), nameof(MenuItem.IsEnabled))); menuAscom.SubItems.Add(menuConnectTelescope); menuAscom.SubItems.Add(menuDisconnectTelescope); menuAscom.SubItems.Add(null); menuAscom.SubItems.Add(menuFindCurrentPoint); menuAscom.SubItems.Add(menuAbortSlew); menuAscom.SubItems.Add(null); menuAscom.SubItems.Add(menuFindHome); menuAscom.SubItems.Add(menuPark); menuAscom.SubItems.Add(menuTrack); menuAscom.SubItems.Add(null); menuAscom.SubItems.Add(menuSetup); menuAscom.SubItems.Add(menuInfo); MenuItems.Add(MenuItemPosition.MainMenuTop, menuAscom); var contextMenuAscom = new MenuItem("$ContextMenu.Telescope"); contextMenuAscom.AddBinding(new SimpleBinding(this, nameof(IsContextMenuEnabled), nameof(MenuItem.IsEnabled))); var contextMenuSyncTo = new MenuItem("$ContextMenu.Telescope.Sync", new Command(SyncToPosition)); contextMenuSyncTo.AddBinding(new SimpleBinding(this, nameof(IsContextMenuEnabled), nameof(MenuItem.IsEnabled))); var contextMenuSlewTo = new MenuItem("$ContextMenu.Telescope.Slew", new Command(SlewToPosition)); contextMenuSlewTo.AddBinding(new SimpleBinding(this, nameof(IsContextMenuEnabled), nameof(MenuItem.IsEnabled))); contextMenuAscom.SubItems.Add(contextMenuSyncTo); contextMenuAscom.SubItems.Add(contextMenuSlewTo); MenuItems.Add(MenuItemPosition.ContextMenu, contextMenuAscom); ascom.PropertyChanged += Ascom_PropertyChanged; ascom.OnMessageShow += Ascom_OnMessageShow; DefineSetting("TelescopeMarkerColor", new SkyColor(Color.DarkOrange)); DefineSetting("TelescopeMarkerFont", SystemFonts.DefaultFont); DefineSetting("TelescopeMarkerLabel", true); DefineSetting("TelescopeFindCurrentPointAfterConnect", false); DefineSetting("TelescopePollingPeriod", 500m); DefineSettingsSection <AscomSettingsSection, SettingsViewModel>(); settings.SettingValueChanged += Settings_SettingValueChanged; }
public SolarCalc(ISky sky) { sky.SunEquatorial = Equatorial; }
public ConstellationsCalc(ISky sky) { this.sky = sky; }
public ConstellationsRenderer(ConstellationsCalc constellationsCalc, ISky sky, ISettings settings) { this.constellationsCalc = constellationsCalc; this.settings = settings; GetConstellation = sky.GetConstellation; }
public EclipsesCalculator(ISky sky, IGeoLocationsManager locationsManager) { this.sky = sky; this.sky.Calculated += Sky_Calculated; this.locationsManager = locationsManager; }
public ObservationPlanner(ISky sky) { this.sky = sky; }
public PlanManagerFactory(ISky sky) { this.sky = sky; }
public StarsCalc(ISky sky) { GetConstellation = sky.GetConstellation; Star.GetNames = GetStarNames; }
public StarsCalc(ISky sky, IStarsReader dataReader) { this.sky = sky; this.dataReader = dataReader; Star.GetNames = GetStarNames; }
public Cell(ISky sky, ICreature creature, IGround ground) { Sky = sky; Creature = creature; Ground = ground; }
public Cell AddSky(ISky sky) { return(Sky != null ? this : new Cell(sky, Creature, Ground)); }
/// <summary> /// Creates new instance of the ViewModel. /// </summary> /// <param name="sky"></param> public SearchVM(ISky sky) { this.sky = sky; }