Пример #1
0
        /// <summary>
        /// Builds the window, moves it into position and assigns click listeners
        /// </summary>
        /// <param name="LeftOffset"></param>
        /// <param name="TopOffset"></param>
        /// <param name="mainWindowHeight">The height of the window that creates this one</param>
        public EditAlarmWindow(double LeftOffset, double TopOffset, double mainWindowHeight, Alarm alarm)
        {
            InitializeComponent();
            this.Left       = LeftOffset + borderOffset;
            this.Top        = TopOffset + borderOffset;
            this.Width      = mainWindowHeight / 2; //the 1:1 ratio looks nice
            this.Height     = mainWindowHeight / 2;
            this.ResizeMode = ResizeMode.CanMinimize;

            this.alarm = alarm;

            this.SaveAlarm.Click += SaveAlarmClick;

            this.Repeats.Click += Weekly_Click;

            //add the handler for each weekday
            this.Sunday.Click    += Weekday_Click;
            this.Monday.Click    += Weekday_Click;
            this.Tuesday.Click   += Weekday_Click;
            this.Wednesday.Click += Weekday_Click;
            this.Thursday.Click  += Weekday_Click;
            this.Friday.Click    += Weekday_Click;
            this.Saturday.Click  += Weekday_Click;

            this.timeSelector = new TimeSelector(this);

            if (alarm != null)
            {
                SetUpGUI();
            }



            AddAudioFilesNamesToGUI();
        }
Пример #2
0
        public IHttpActionResult LoadEvents(int sportTypeId, TimeSelector time)
        {
            var a = sportTypeId;

            string draw   = this.Request.GetQueryNameValuePairs().Where(x => x.Key == "draw").FirstOrDefault().Value;
            string start  = this.Request.GetQueryNameValuePairs().Where(x => x.Key == "start").FirstOrDefault().Value;
            string length = this.Request.GetQueryNameValuePairs().Where(x => x.Key == "length").FirstOrDefault().Value;

            int pageSize = length != null?Convert.ToInt32(length) : 0;

            int skip = start != null?Convert.ToInt32(start) : 0;

            int recordsTotal = this.eventService.Count(sportTypeId, time);

            IEnumerable <ResultDto> results = this.eventService
                                              .GetSportEvents(sportTypeId, time, skip, pageSize);

            return(this.Ok(new
            {
                draw = draw,
                recordsFiltered = recordsTotal,
                recordsTotal = recordsTotal,
                data = results
            }));
        }
Пример #3
0
        public int Count(int sportTypeId, TimeSelector timeSelector)
        {
            int count;
            int time = (int)timeSelector;

            if (sportTypeId != 0)
            {
                IEnumerable <SportEvent> sportEvents = this.dataUnit.GetRepository <SportEvent>().Get(filter: m => m.SportType.Id == sportTypeId);
                if (time != 0)
                {
                    count = sportEvents.Count(m => DateTime.Compare(m.Date, DateTime.UtcNow) == time);
                }
                else
                {
                    count = sportEvents.Count();
                }
            }
            else
            {
                IEnumerable <SportEvent> sportEvents = this.dataUnit.GetRepository <SportEvent>().Get();
                if (time != 0)
                {
                    count = sportEvents.Count(m => DateTime.Compare(m.Date, DateTime.UtcNow) == time);
                }
                else
                {
                    count = sportEvents.Count();
                }
            }
            return(count);
        }
Пример #4
0
        // GET: Mvc/Event
        public ActionResult Index(int page = 1, int id = 0, TimeSelector timeSelector = TimeSelector.All)
        {
            int recordsTotal = this.sportTypeService.Count(id, timeSelector);

            if (page < 1)
            {
                page = 1;
            }

            PageInfo           pageInfo       = new PageInfo(recordsTotal, page, PAGESIZE);
            SportTypeSelectDto sportTypeModel = this.sportTypeService.GetSportTypes(
                id,
                timeSelector,
                (page - 1) * PAGESIZE,
                PAGESIZE);


            if (sportTypeModel != null)
            {
                return(this.View(new SportEventViewModel()
                {
                    PageInfo = pageInfo,
                    SportTypeSelectDto = sportTypeModel,
                    ActionName = "Index",
                    ControllerName = "Event"
                }));
            }
            else
            {
                return(this.View());
            }
        }
Пример #5
0
 public OperationPlane ()
 {
     timeSelector = new TimeSelector(new TimeReference[]
     {
         TimeReference.REL_HIGHEST_AD, TimeReference.REL_NEAREST_AD,
         TimeReference.REL_ASCENDING, TimeReference.REL_DESCENDING
     });
 }
Пример #6
0
 public OperationPlane()
 {
     timeSelector = new TimeSelector(new TimeReference[]
     {
         TimeReference.REL_HIGHEST_AD, TimeReference.REL_NEAREST_AD,
         TimeReference.REL_ASCENDING, TimeReference.REL_DESCENDING
     });
 }
Пример #7
0
        public IEnumerable <ResultDto> GetSportEvents(int sportTypeId, TimeSelector timeSelector, int skip, int take)
        {
            IList <ResultDto> results = new List <ResultDto>();
            int time = (int)timeSelector;

            IEnumerable <SportEvent> sportEvents;

            if (sportTypeId != 0)
            {
                if (time != 0)
                {
                    sportEvents =
                        this.dataUnit.GetRepository <SportEvent>().Get(
                            filter: m => m.SportType.Id == sportTypeId && DateTime.Compare(m.Date, DateTime.UtcNow) == time,
                            includeProperties: "Results,SportType,Results.Team",
                            orderBy: s => time == 1 ? s.OrderBy(x => x.Date).ThenByDescending(x => x.Id) : s.OrderByDescending(x => x.Date).ThenByDescending(x => x.Id),
                            skip: skip,
                            take: take);
                }
                else
                {
                    sportEvents =
                        this.dataUnit.GetRepository <SportEvent>().Get(
                            filter: m => m.SportType.Id == sportTypeId,
                            includeProperties: "Results,SportType,Results.Team",
                            orderBy: s => s.OrderByDescending(x => x.Date).ThenByDescending(x => x.Id),
                            skip: skip,
                            take: take);
                }
            }
            else
            {
                if (time != 0)
                {
                    sportEvents =
                        this.dataUnit.GetRepository <SportEvent>().Get(
                            filter: m => DateTime.Compare(m.Date, DateTime.UtcNow) == time,
                            includeProperties: "Results,SportType,Results.Team",
                            orderBy: s => time == 1 ? s.OrderBy(x => x.Date).ThenByDescending(x => x.Id) : s.OrderByDescending(x => x.Date).ThenByDescending(x => x.Id),
                            skip: skip,
                            take: take);
                }
                else
                {
                    sportEvents =
                        this.dataUnit.GetRepository <SportEvent>().Get(
                            includeProperties: "Results,SportType,Results.Team",
                            orderBy: s => s.OrderByDescending(x => x.Date).ThenByDescending(x => x.Id),
                            skip: skip,
                            take: take);
                }
            }
            foreach (SportEvent sportEvent in sportEvents)
            {
                results.Add(Mapper.Map <SportEvent, ResultDto>(sportEvent));
            }
            return(results);
        }
 public OperationInclination ()
 {
     timeSelector = new TimeSelector(new TimeReference[]
     {
         TimeReference.EQ_HIGHEST_AD, TimeReference.EQ_NEAREST_AD,
         TimeReference.EQ_ASCENDING, TimeReference.EQ_DESCENDING,
         TimeReference.X_FROM_NOW
     });
 }
Пример #9
0
 public OperationInclination()
 {
     timeSelector = new TimeSelector(new TimeReference[]
     {
         TimeReference.EQ_HIGHEST_AD, TimeReference.EQ_NEAREST_AD,
         TimeReference.EQ_ASCENDING, TimeReference.EQ_DESCENDING,
         TimeReference.X_FROM_NOW
     });
 }
Пример #10
0
        public ActionResult Details(int id, TimeSelector timeSelector)
        {
            var      data  = db.Get(id);
            var      model = new Schedule(data);
            DateTime startDate;
            DateTime endDate;

            HelperLibary.EvaluateTimeSelector.Evaluate(timeSelector, out startDate, out endDate);
            model.Transactions = new SqlDataServices <Data.Models.Transactions>().GetAll(model.ID, typeof(Schedule)).Where(e => e.Date > startDate && e.Date < endDate).Select(e => new Transactions(e)).OrderBy(e => e.Date).ToList();
            return(View(model));
        }
Пример #11
0
        public void CountCheckEventsNotExist(int sportId, TimeSelector time)
        {
            int expectedCount = this.databaseSportsContext
                                .SportEvents.Where(e => e.SportType.Id == sportId).Count();

            Assert.AreEqual(expectedCount, 0);

            int actualCount = this.eventService.Count(sportId, time);

            Assert.AreEqual(actualCount, 0);
        }
        public ActionResult Index(TimeSelector timeSelector)
        {
            DateTime startDate;
            DateTime endDate;

            HelperLibary.EvaluateTimeSelector.Evaluate(timeSelector, out startDate, out endDate);
            var data  = db.GetAll().Where(e => e.Date > startDate && e.Date < endDate);
            var model = new List <Transactions>();

            model = data.Select(e => new Transactions(e)).OrderBy(e => e.Date).ToList();
            return(View(model));
        }
Пример #13
0
        public void GetSportEventsCheckEventsExist(int sportId, TimeSelector time, int skip, int take)
        {
            // Get SportEvents from datavase directly and check, that they are exist
            List <SportEvent> expectedSportEvents = this.databaseSportsContext.SportEvents
                                                    .Where(e => e.SportType.Id == sportId)
                                                    .OrderByDescending(e => e.Date).ThenByDescending(e => e.Id)
                                                    .Skip(skip)
                                                    .Take(take)
                                                    .ToList();

            Assert.Greater(expectedSportEvents.Count, 0);

            // Map SportEvent to ResultDto
            List <ResultDto> expectedResultDtos = new List <ResultDto>();

            foreach (SportEvent item in expectedSportEvents)
            {
                expectedResultDtos
                .Add(Mapper.Map <SportEvent, ResultDto>(item));
            }

            // Get SportEvents through EventsService
            List <ResultDto> actualResultDtos = this.eventService
                                                .GetSportEvents(sportId, time, skip, take).ToList();

            Assert.AreEqual(expectedResultDtos.Count, actualResultDtos.Count);
            for (int i = 0; i < expectedResultDtos.Count; i++)
            {
                Assert.AreEqual(expectedResultDtos[i].Id, actualResultDtos[i].Id);
                Assert.AreEqual(expectedResultDtos[i].Date, actualResultDtos[i].Date);
                Assert.AreEqual(
                    expectedResultDtos[i].TeamIds.Count(),
                    actualResultDtos[i].TeamIds.Count());
                Assert.AreEqual(
                    expectedResultDtos[i].TeamNames.Count(),
                    actualResultDtos[i].TeamIds.Count());

                for (int j = 0; j < expectedResultDtos[i].TeamIds.Count(); j++)
                {
                    Assert.AreEqual(
                        expectedResultDtos[i].TeamIds.ElementAt(j),
                        actualResultDtos[i].TeamIds.ElementAt(j));

                    Assert.AreEqual(
                        expectedResultDtos[i].TeamNames.ElementAt(j),
                        actualResultDtos[i].TeamNames.ElementAt(j));
                }
            }
        }
Пример #14
0
        public ActionResult Details(int id, TimeSelector timeSelector)
        {
            var      data  = db.Get(id);
            var      model = new Payee(data);
            DateTime startDate;
            DateTime endDate;

            HelperLibary.EvaluateTimeSelector.Evaluate(timeSelector, out startDate, out endDate);
            var transactionsData = new SqlDataServices <Data.Models.Transactions>().GetAll(id, typeof(Data.Models.Category)).Where(e => e.Date > startDate && e.Date < endDate).OrderBy(e => e.Date);

            foreach (var item in transactionsData)
            {
                model.Transactions.Add(new Transactions(item));
            }
            return(View(model));
        }
Пример #15
0
 public void Update(LevelTime levelTime)
 {
     while (idx < list.Count &&
            levelTime.SongPosition >= TimeSelector.Invoke(list[idx]))
     {
         var time   = TimeSelector.Invoke(list[idx]);
         var lateBy = levelTime.SongPosition - time;
         var args   = new TimeIterActionArgs <T>()
         {
             List      = list,
             Index     = idx,
             LevelTime = levelTime,
             LateBy    = lateBy,
         };
         Action.Invoke(args);
         idx++;
     }
 }
Пример #16
0
        private void Form1_Load(object sender, EventArgs e)
        {
            VideoCaptureDevices             = new FilterInfoCollection(FilterCategory.VideoInputDevice);
            captureDevice                   = new VideoCaptureDeviceForm();
            panel3.HorizontalScroll.Maximum = 0;
            panel3.AutoScroll               = false;
            panel3.HorizontalScroll.Enabled = false;
            panel3.VerticalScroll.Visible   = false;
            panel3.AutoScroll               = true;
            TimeSelector ts = new TimeSelector();
            DateTime     dt = DateTime.Today;

            ts.Body = $"{dt.Day} {dt.ToString("MMMM")}";
            ts.Size = new Size(539, 23);
            ts.Left = 0;
            ts.Top  = 6;
            panel3.Controls.Add(ts);
            timer1.Start();
        }
Пример #17
0
        public void GetSportEventsCheckEventsNotExist(int sportId, TimeSelector time, int skip, int take)
        {
            // Get SportEvents from database directly and check, that they are not exist
            List <SportEvent> expectedSportEvents = this.databaseSportsContext.SportEvents
                                                    .Where(e => e.SportType.Id == sportId)
                                                    .OrderByDescending(e => e.Date)
                                                    .ThenByDescending(e => e.Id)
                                                    .Skip(skip)
                                                    .Take(take)
                                                    .ToList();

            Assert.AreEqual(0, expectedSportEvents.Count);

            // Get SportEvents from EventsService
            List <ResultDto> actualResultDtos = this.eventService
                                                .GetSportEvents(sportId, time, skip, take).ToList();

            Assert.AreEqual(expectedSportEvents.Count, actualResultDtos.Count);
        }
Пример #18
0
        public IncomeExpenseModel(TimeSelector leftHandTimeSelector, TimeSelector rightHandTimeSelector)
        {
            this.LeftHandTimeSelector  = leftHandTimeSelector;
            this.RightHandTimeSelector = rightHandTimeSelector;

            DateTime leftHandStartDate;
            DateTime leftHandEndDate;
            DateTime rightHandStartDate;
            DateTime rightHandEndDate;
            int      leftHandAverageDividend;
            int      rightHandAverageDividend;
            var      now = DateTime.Today;

            EvaluateTimeSelector.Evaluate(this.LeftHandTimeSelector, out leftHandStartDate, out leftHandEndDate, out leftHandAverageDividend);
            EvaluateTimeSelector.Evaluate(this.RightHandTimeSelector, out rightHandStartDate, out rightHandEndDate, out rightHandAverageDividend);

            if (this.Selection == IncomeExpenseSelection.Category)
            {
                var data = new SqlDataServices <Data.Models.Category>().GetAll();
                this.LeftHandIncome   = IncomeExpenseCategory.GetModel(data, leftHandStartDate, leftHandEndDate, leftHandAverageDividend).Where(e => e.IncomeOrExpense == CategoryType.Income).ToList();
                this.LeftHandExpense  = IncomeExpenseCategory.GetModel(data, leftHandStartDate, leftHandEndDate, leftHandAverageDividend).Where(e => e.IncomeOrExpense == CategoryType.Expense).ToList();
                this.RightHandIncome  = IncomeExpenseCategory.GetModel(data, rightHandStartDate, rightHandEndDate, rightHandAverageDividend).Where(e => e.IncomeOrExpense == CategoryType.Income).ToList();
                this.RightHandExpense = IncomeExpenseCategory.GetModel(data, rightHandStartDate, rightHandEndDate, rightHandAverageDividend).Where(e => e.IncomeOrExpense == CategoryType.Expense).ToList();

                this.Income  = IncomeExpenseTable.GetModel(this.LeftHandIncome, this.RightHandIncome).ToList();
                this.Expense = IncomeExpenseTable.GetModel(this.LeftHandExpense, this.RightHandExpense).ToList();
            }

            if (this.Selection == IncomeExpenseSelection.Payee)
            {
                var data = new SqlDataServices <Data.Models.Payee>().GetAll();
                this.LeftHandIncome   = IncomeExpensePayee.GetModel(data, leftHandStartDate, leftHandEndDate, leftHandAverageDividend).Where(e => e.IncomeOrExpense == CategoryType.Income).ToList();
                this.LeftHandExpense  = IncomeExpensePayee.GetModel(data, leftHandStartDate, leftHandEndDate, leftHandAverageDividend).Where(e => e.IncomeOrExpense == CategoryType.Expense).ToList();
                this.RightHandIncome  = IncomeExpensePayee.GetModel(data, rightHandStartDate, rightHandEndDate, rightHandAverageDividend).Where(e => e.IncomeOrExpense == CategoryType.Income).ToList();
                this.RightHandExpense = IncomeExpensePayee.GetModel(data, rightHandStartDate, rightHandEndDate, rightHandAverageDividend).Where(e => e.IncomeOrExpense == CategoryType.Expense).ToList();

                this.Income  = IncomeExpenseTable.GetModel(this.LeftHandIncome, this.RightHandIncome).ToList();
                this.Expense = IncomeExpenseTable.GetModel(this.LeftHandExpense, this.RightHandExpense).ToList();
            }
        }
Пример #19
0
 public OperationSemiMajor()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.X_FROM_NOW, TimeReference.APOAPSIS, TimeReference.PERIAPSIS });
 }
Пример #20
0
        public SportTypeSelectDto GetSportTypes(int sportTypeId, TimeSelector timeSelector, int skip, int take)
        {
            IList <ResultDto>        results           = new List <ResultDto>();
            IList <SportTypeListDto> sportTypeListDtos = new List <SportTypeListDto>();
            ICollection <SportEvent> sportEvents       = new List <SportEvent>();
            string selectedName;
            int    time = (int)timeSelector;

            if (sportTypeId != 0)
            {
                if (time != 0)
                {
                    sportEvents =
                        this.dataUnit.GetRepository <SportEvent>().Get(
                            filter: m => m.SportType.Id == sportTypeId &&
                            DateTime.Compare(m.Date, DateTime.UtcNow) == time,
                            includeProperties: "Results,SportType,Results.Team",
                            orderBy: s => s.OrderByDescending(x => x.Date).ThenByDescending(x => x.Id),
                            skip: skip,
                            take: take).ToList();
                }
                else
                {
                    sportEvents = this.dataUnit.GetRepository <SportEvent>().Get(
                        filter: x => x.SportType.Id == sportTypeId,
                        includeProperties: "Results,SportType,Results.Team",
                        orderBy: s => s.OrderByDescending(x => x.Date).ThenByDescending(x => x.Id),
                        skip: skip,
                        take: take).ToList();
                }


                if (sportEvents.Count > 0)
                {
                    SportType sportType = sportEvents.ElementAt(0).SportType;
                    selectedName = sportType.Name;
                    foreach (SportEvent sportEvent in sportEvents)
                    {
                        results.Add(Mapper.Map <SportEvent, ResultDto>(sportEvent));
                    }
                    sportTypeListDtos.Add(new SportTypeListDto
                    {
                        SportType = new SportTypeDto
                        {
                            Id   = sportType.Id,
                            Name = sportType.Name
                        },
                        Results = results
                    });
                }
                else
                {
                    SportType selectedSportType = this.dataUnit.GetRepository <SportType>().Get(
                        filter: s => s.Id == sportTypeId).FirstOrDefault();
                    if (selectedSportType == null)
                    {
                        selectedName = string.Empty;
                    }
                    else
                    {
                        selectedName = selectedSportType.Name;
                    }
                }
            }
            else
            {
                if (time != 0)
                {
                    sportEvents =
                        this.dataUnit.GetRepository <SportEvent>().Get(
                            filter: m => DateTime.Compare(m.Date, DateTime.UtcNow) == time,
                            includeProperties: "Results,SportType,Results.Team",
                            orderBy: s => s.OrderBy(x => x.SportType.Id).ThenByDescending(x => x.Date).ThenByDescending(x => x.Id),
                            skip: skip,
                            take: take).ToList();
                }
                else
                {
                    sportEvents = this.dataUnit.GetRepository <SportEvent>().Get(
                        includeProperties: "Results,SportType,Results.Team",
                        orderBy: s => s.OrderBy(x => x.SportType.Id).ThenByDescending(x => x.Date).ThenByDescending(x => x.Id),
                        skip: skip,
                        take: take).ToList();
                }

                selectedName = "Sport Events";

                if (sportEvents.Count != 0)
                {
                    SportType sportType = sportEvents.ElementAt(0).SportType;

                    foreach (SportEvent sportEvent in sportEvents)
                    {
                        if (sportEvent.SportType.Id != sportType.Id)
                        {
                            sportTypeListDtos.Add(new SportTypeListDto
                            {
                                SportType = new SportTypeDto
                                {
                                    Id   = sportType.Id,
                                    Name = sportType.Name
                                },
                                Results = results
                            });
                            sportType = sportEvent.SportType;
                            results   = new List <ResultDto>();
                        }
                        results.Add(Mapper.Map <SportEvent, ResultDto>(sportEvent));
                    }
                    if (results.Count > 0)
                    {
                        sportTypeListDtos.Add(new SportTypeListDto
                        {
                            SportType = new SportTypeDto
                            {
                                Id   = sportType.Id,
                                Name = sportType.Name
                            },
                            Results = results
                        });
                    }
                }
            }

            SportTypeSelectDto sportTypeModel = new SportTypeSelectDto()
            {
                SelectedId       = sportTypeId,
                SelectedName     = selectedName,
                SelectedTime     = timeSelector,
                SportTypes       = this.GetAllSportTypes(),
                SportTypeResults = sportTypeListDtos
            };

            return(sportTypeModel);
        }
Пример #21
0
 public OperationApoapsis()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.PERIAPSIS, TimeReference.APOAPSIS, TimeReference.X_FROM_NOW, TimeReference.EQ_DESCENDING, TimeReference.EQ_ASCENDING });
 }
 public OperationEllipticize ()
 {
     timeSelector = new TimeSelector(new TimeReference[] {TimeReference.X_FROM_NOW});
 }
 public OperationLambert()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.X_FROM_NOW });
 }
Пример #24
0
 public OperationPeriapsis()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.APOAPSIS, TimeReference.PERIAPSIS, TimeReference.X_FROM_NOW });
 }
 public OperationKillRelVel ()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.CLOSEST_APPROACH, TimeReference.X_FROM_NOW });
 }
 public OperationCircularize()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.APOAPSIS, TimeReference.PERIAPSIS, TimeReference.ALTITUDE, TimeReference.X_FROM_NOW });
 }
Пример #27
0
        internal static bool InitTypes()
        {
            AssemblyLoader.loadedAssemblies.TypeOperation(t => {
                switch (t.FullName)
                {
                case "MuMech.MechJebCore":
                    type = t;
                    getComputerModule = t.GetMethod("GetComputerModule", new Type[] { typeof(string) });
                    break;

                default:
                    bool unused = AscentAutopilot.InitTypes(t) || ComputerModule.InitTypes(t) || EditableVariables.InitTypes(t) || Operation.InitTypes(t) || TimeSelector.InitTypes(t) || VesselExtensions.InitTypes(t);
                    break;
                }
            });

            return(type != null);
        }
Пример #28
0
 public OperationPeriapsis ()
 {
     timeSelector = new TimeSelector(new TimeReference[] {TimeReference.APOAPSIS, TimeReference.PERIAPSIS, TimeReference.X_FROM_NOW});
 }
Пример #29
0
 public TimeSelectorItem() : base(new TimeSelector())
 {
     timeSelector         = (TimeSelector)Control;
     timeSelector.Scroll += TimeSelector_Scroll;
 }
Пример #30
0
        public static void Evaluate(TimeSelector timeSelector, out DateTime startDate, out DateTime endDate, out int averageDividend)
        {
            var now = DateTime.Today;

            switch (timeSelector)
            {
            case TimeSelector.ThisYear:
                startDate       = new DateTime(now.Year, 1, 1);
                endDate         = new DateTime(now.Year, 12, 31);
                averageDividend = 12;
                break;

            case TimeSelector.LastYear:
                startDate       = new DateTime(now.Year - 1, 1, 1);
                endDate         = new DateTime(now.Year - 1, 12, 31);
                averageDividend = 12;
                break;

            case TimeSelector.ThisMonth:
                startDate       = new DateTime(now.Year, now.Month, 1);
                endDate         = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month));
                averageDividend = 1;
                break;

            case TimeSelector.LastMonth:
                startDate       = new DateTime(now.Year, now.Month, 1).AddMonths(-1);
                endDate         = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month)).AddMonths(-1);
                averageDividend = 1;
                break;

            case TimeSelector.Last3Month:
                startDate       = new DateTime(now.Year, now.Month, 1).AddMonths(-3);
                endDate         = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month)).AddMonths(-1);
                averageDividend = 3;
                break;

            case TimeSelector.Last6Month:
                startDate       = new DateTime(now.Year, now.Month, 1).AddMonths(-6);
                endDate         = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month)).AddMonths(-1);
                averageDividend = 6;
                break;

            case TimeSelector.Last9Month:
                startDate       = new DateTime(now.Year, now.Month, 1).AddMonths(-9);
                endDate         = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month)).AddMonths(-1);
                averageDividend = 9;
                break;

            case TimeSelector.Last12Month:
                startDate       = new DateTime(now.Year, now.Month, 1).AddMonths(-12);
                endDate         = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month)).AddMonths(-1);
                averageDividend = 12;
                break;

            case TimeSelector.Last30Days:
                startDate       = now.AddDays(-30);
                endDate         = now;
                averageDividend = 1;
                break;

            case TimeSelector.Last60Days:
                startDate       = now.AddDays(-60);
                endDate         = now;
                averageDividend = 2;
                break;

            case TimeSelector.Last90Days:
                startDate       = now.AddDays(-90);
                endDate         = now;
                averageDividend = 3;
                break;

            case TimeSelector.Last120Days:
                startDate       = now.AddDays(-120);
                endDate         = now;
                averageDividend = 4;
                break;

            default:
                startDate       = new DateTime(now.Year, 1, 1);
                endDate         = new DateTime(now.Year, 12, 31);
                averageDividend = 12;
                break;
            }
        }
Пример #31
0
 public OperationLambert ()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.X_FROM_NOW });
 }
 public OperationCircularize()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.APOAPSIS, TimeReference.PERIAPSIS, TimeReference.ALTITUDE, TimeReference.X_FROM_NOW });
 }
Пример #33
0
 public OperationKillRelVel()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.CLOSEST_APPROACH, TimeReference.X_FROM_NOW });
 }
Пример #34
0
        private void editDueDate_Click(object sender, RoutedEventArgs e)
        {
            Popup myPopup = new Popup();

            myPopup.HorizontalAlignment   = HorizontalAlignment.Center;
            myPopup.VerticalAlignment     = VerticalAlignment.Center;
            myPopup.IsLightDismissEnabled = true;

            Grid g = new Grid();

            ColumnDefinition cd1 = new ColumnDefinition();

            g.ColumnDefinitions.Add(cd1);
            //cd1.Width = new GridLength(320);
            //ColumnDefinition cd2 = new ColumnDefinition();
            //g.ColumnDefinitions.Add(cd2);
            //cd2.Width = new GridLength(320);

            RowDefinition rd1 = new RowDefinition();

            rd1.Height = new GridLength(205);
            g.RowDefinitions.Add(rd1);
            RowDefinition rd2 = new RowDefinition();

            g.RowDefinitions.Add(rd2);

            DateSelector dateSelector = new DateSelector();

            dateSelector.ShowCancelButton = false;
            dateSelector.ShowDoneButton   = false;
            dateSelector.Height           = 200;
            dateSelector.Margin           = new Thickness(2);
            dateSelector.AccentBrush      = new SolidColorBrush(Colors.SteelBlue);
            if (taskDueDateTextBox.Text != "None")
            {
                dateSelector.SelectedDateTime = DateTime.Parse(taskDueDateTextBox.Text);
            }
            Grid.SetColumn(dateSelector, 0);
            Grid.SetRow(dateSelector, 0);
            g.Children.Add(dateSelector);

            TimeSelector timeSelector = new TimeSelector();

            timeSelector.ShowDoneButton   = false;
            timeSelector.ShowCancelButton = false;
            timeSelector.Height           = 200;
            timeSelector.Margin           = new Thickness(2);
            timeSelector.AccentBrush      = new SolidColorBrush(Colors.SteelBlue);
            if (taskDueDateTextBox.Text != "None")
            {
                timeSelector.SelectedTime = DateTime.Parse(taskDueDateTextBox.Text);
            }
            Grid.SetColumn(timeSelector, 1);
            Grid.SetRow(timeSelector, 0);
            //g.Children.Add(timeSelector);

            Border b = new Border();

            b.BorderBrush     = new SolidColorBrush(Colors.LightGray);
            b.BorderThickness = new Thickness(2);
            b.Width           = 314;
            //b.Width = 635;

            StackPanel s = new StackPanel();

            b.Child       = s;
            s.Orientation = Orientation.Horizontal;
            //s.Width = 630;
            //s.Width = 630;
            s.Background = new SolidColorBrush(Colors.White);

            StackPanel s1 = new StackPanel();

            s1.Orientation = Orientation.Horizontal;
            //s1.Width = 315;
            s1.Width         = 157;
            s1.Margin        = new Thickness(0, 10, 0, 10);
            s1.FlowDirection = FlowDirection.RightToLeft;
            s.Children.Add(s1);

            StackPanel s2 = new StackPanel();

            s2.Orientation = Orientation.Horizontal;
            s2.Width       = 157;
            //s2.Width = 315;
            s2.Margin        = new Thickness(0, 10, 0, 10);
            s2.FlowDirection = FlowDirection.LeftToRight;
            s.Children.Add(s2);;

            Button apply = new Button();

            apply.Content = "Apply";
            apply.HorizontalContentAlignment = HorizontalAlignment.Center;
            s1.Children.Add(apply);
            apply.Click += new RoutedEventHandler(delegate(object sender1, RoutedEventArgs ev)
            {
                DateTime d = (DateTime)dateSelector.SelectedDateTime;
                //DateTime d = DateTime.Parse(((DateTime)dateSelector.SelectedDateTime).ToString("yyyy-MM-dd") + "T" + ((DateTime) timeSelector.SelectedTime).ToString("HH:mm:ss"));
                System.Diagnostics.Debug.WriteLine(d);
                taskDueDateTextBox.Text = d.ToString();
                EnableTaskEditMode();
                myPopup.IsOpen = false;
            });

            Button clear = new Button();

            clear.Content = "Clear";
            clear.HorizontalContentAlignment = HorizontalAlignment.Center;
            s2.Children.Add(clear);
            clear.Click += new RoutedEventHandler(delegate(object sender1, RoutedEventArgs ev)
            {
                taskDueDateTextBox.Text = "None";
                EnableTaskEditMode();
                myPopup.IsOpen = false;
            });


            Grid.SetColumnSpan(b, 2);
            Grid.SetColumn(b, 0);
            Grid.SetRow(b, 1);
            g.Children.Add(b);

            myPopup.Child = g;

            myPopup.IsOpen = true;
            myCanvas.Children.Add(myPopup);
        }
Пример #35
0
 public OperationSemiMajor ()
 {
     timeSelector = new TimeSelector(new TimeReference[] {TimeReference.X_FROM_NOW, TimeReference.APOAPSIS, TimeReference.PERIAPSIS});
 }
Пример #36
0
 public OperationEllipticize()
 {
     timeSelector = new TimeSelector(new TimeReference[] { TimeReference.X_FROM_NOW });
 }
Пример #37
0
 public OperationApoapsis ()
 {
     timeSelector = new TimeSelector(new TimeReference[] {TimeReference.PERIAPSIS, TimeReference.APOAPSIS, TimeReference.X_FROM_NOW, TimeReference.EQ_DESCENDING, TimeReference.EQ_ASCENDING});
 }