Example #1
0
        private void UpdateRange()
        {
            /*
             *              tick	hours
             * quarter day	    1	    6
             * day	            2	    24
             * week	        3	    168
             * month	        4	    672
             * quarter year	5	    2016
             * year	        6	    8064
             * 5 years	        7	    40320
             *
             * exponential fit,  tick = 1.592 * e ^ (1.4485 * hours)
             */

            double x = DateRange.Maximum - DateRange.Value;

            x /= 20;

            double hours = 1.592 * Math.Exp(1.4485 * x);

            //EndTime = StartTime.AddHours(hours);

            DateTime fourthTime = new DateTime(StartTime.Ticks + (EndTime.Ticks - StartTime.Ticks) / 4);

            StartTime = fourthTime.AddHours(-hours * 1 / 4);
            EndTime   = fourthTime.AddHours(hours * 3 / 4);

            ScheduleSlider.RefreshSlider();
        }
Example #2
0
        public override void Init()
        {
            if (UserID != Core.UserID)
            {
                NewButton.Visible = false;
            }

            PlanStructure.Columns[1].WidthResized += new EventHandler(PlanStructure_Resized);

            ScheduleSlider.Init(this);

            DateRange.Value = 40;
            UpdateRange();

            GotoTime(Core.TimeNow);

            // guilty of a hack, this sets the last column to the correct length,
            // firing the event to set the slider to the same size as the column
            PlanStructure.GenerateColumnRects();
            PlanStructure.Invalidate();


            // load links
            RefreshUplinks();
            RefreshStructure();


            // events
            Trust.GuiUpdate  += new LinkGuiUpdateHandler(Trust_Update);
            Plans.PlanUpdate += new PlanUpdateHandler(Plans_Update);
        }
Example #3
0
        private void GotoTime(DateTime time)
        {
            long ticks = ScheduleSlider.Width * ScheduleSlider.TicksperPixel;

            StartTime = time.AddTicks(-ticks * 1 / 4);
            EndTime   = time.AddTicks(ticks * 3 / 4);

            ScheduleSlider.RefreshSlider();
        }