Esempio n. 1
0
File: Plugin.cs Progetto: t9mike/ADK
        private void ShowMotionTrackWindow()
        {
            var body = map.SelectedObject;

            if (IsMotionTrackEnabled())
            {
                var vm = ViewManager.CreateViewModel <MotionTrackVM>();
                vm.TrackId       = Guid.NewGuid();
                vm.SelectedBody  = body;
                vm.JulianDayFrom = sky.Context.JulianDay;
                vm.JulianDayTo   = sky.Context.JulianDay + 30;
                vm.UtcOffset     = sky.Context.GeoLocation.UtcOffset;

                if (ViewManager.ShowDialog(vm) ?? false)
                {
                    sky.Calculate();
                }
            }
            else
            {
                var vm = ViewManager.CreateViewModel <TracksListVM>();
                if (ViewManager.ShowDialog(vm) ?? false)
                {
                    sky.Calculate();
                }
            }
        }
Esempio n. 2
0
 private void DeleteSelectedTrack()
 {
     if (ViewManager.ShowMessageBox("Question", "Do you really want to delete the selected track?", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         tracksProvider.Tracks.Remove(SelectedTrack.Track);
         sky.Calculate();
         LoadList();
     }
 }
Esempio n. 3
0
 private void DeleteSelectedTrack()
 {
     if (ViewManager.ShowMessageBox("$TracksListWindow.WarningTitle", "$TracksListWindow.DeleteWarningText", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         trackCalc.Tracks.Remove(SelectedTrack.Track);
         sky.Calculate();
         LoadList();
     }
 }
Esempio n. 4
0
        public async void UpdateOrbitalElements(bool silent)
        {
            ICollection <Comet> newData = await updater.Update(silent);

            if (newData != null && newData.Any())
            {
                lock (locker)
                {
                    comets.Clear();
                    comets.AddRange(newData);
                }
                Log.Info($"Updated comets: {newData.Count}");
                sky.Calculate();
            }
        }
Esempio n. 5
0
File: MainVM.cs Progetto: t9mike/ADK
        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;
        }
Esempio n. 6
0
File: MainVM.cs Progetto: t9mike/ADK
 private void MapKeyDown(Key key)
 {
     // "+" = Zoom In
     if (key == Key.Add)
     {
         Zoom(1);
     }
     // "-" = Zoom Out
     else if (key == Key.Subtract)
     {
         Zoom(-1);
     }
     // "D" = [D]ate
     else if (key == Key.D)
     {
         SetDate();
     }
     // "A" = [A]dd
     else if (key == Key.A)
     {
         sky.Context.JulianDay += 1;
         sky.Calculate();
     }
     // "S" = [S]ubtract
     else if (key == Key.S)
     {
         sky.Context.JulianDay -= 1;
         sky.Calculate();
     }
     // "O" = [O]ptions
     else if (key == Key.O)
     {
         ChangeSettings();
     }
     // "I" = [I]nfo
     else if (key == Key.I)
     {
         GetObjectInfo(map.SelectedObject);
     }
     // "F12" = Full Screen On
     else if (key == Key.F12)
     {
         SetFullScreen(true);
     }
     // "Esc" = Full Screen Off
     else if (key == Key.Escape)
     {
         SetFullScreen(false);
     }
     // "F" = [F]ind
     else if (key == Key.F)
     {
         SearchObject();
     }
     // "E" = [E]phemerides
     else if (key == Key.E)
     {
         GetObjectEphemeris(map.SelectedObject);
     }
     // "P" = [P]henomena
     else if (key == Key.P)
     {
         CalculatePhenomena();
     }
     // "L" = [L]ocation
     else if (key == Key.L)
     {
         SelectLocation();
     }
     // "T" = [T]rack
     //else if (key == Key.T)
     //{
     //    MotionTrack(map.SelectedObject);
     //}
 }