Example #1
0
        public GamePage()
        {
            InitializeComponent();

            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;

            // Create a timer for this page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update        += OnUpdate;
            timer.Draw          += OnDraw;

            this.Width  = System.Windows.Application.Current.Host.Content.ActualWidth;
            this.Height = System.Windows.Application.Current.Host.Content.ActualHeight;

            model = new ConstellationModel((int)this.Width, (int)this.Height);
            model.LoadData();

            verPos = (-model.dec) * 180.0 / Math.PI;
            horPos = (360.0 - model.ra * 180.0 / Math.PI);

            xmid = (int)this.Width / 2;
            ymid = (int)this.Height / 2;

            IsMotion = Motion.IsSupported;
        }
Example #2
0
        public IActionResult Get(string name)
        {
            ConstellationModel constellation = repo.GetConstellationByName(name);

            if (constellation == null)
            {
                return(NotFound());
            }

            return(Ok(jconv.Convert(constellation)));
        }
Example #3
0
        public ConstellationModel GetConstellationByName(string name)
        {
            ConstellationModel constellation = db.Constellation.FirstOrDefault(s => s.Name.ToUpper().Equals(name.ToUpper()));

            List <StarConstJunction> junctions = db.StarConstJunction.Where(ps => ps.Constellation.Id == constellation.Id).Include("Star").Include("Constellation").ToList();

            foreach (StarConstJunction sc in junctions)
            {
                constellation.Stars.Add(sc.Star);
            }

            return(constellation);
        }
Example #4
0
        public void ConstellationConvert()
        {
            Console.WriteLine("Constellation Convert Test:");

            ConstellationModel bigDipper = repo.GetConstellationByName("Ursa Major");

            List <ConstellationModel> constellations = repo.GetAllConstellations();

            JSONConvert jconv = new JSONConvert();

            Console.WriteLine(jconv.Convert(bigDipper));

            Console.WriteLine(jconv.Convert(constellations));
        }
Example #5
0
        public void GetConstellation()
        {
            Console.WriteLine("Get Constellation Test:");

            DomainServiceRepository repo      = new DomainServiceRepository();
            ConstellationModel      bigDipper = repo.GetConstellationByName("Ursa Major");

            Console.WriteLine("Big Dipper Stars: ");

            foreach (StarModel star in bigDipper.Stars)
            {
                Console.WriteLine(star.Name);
            }

            Console.WriteLine("");
        }
Example #6
0
 public string Convert(ConstellationModel constellation)
 {
     return(JsonConvert.SerializeObject(constellation));
 }