protected override void AfterSolveInstance()
        {
            if (!this.run || reset || staticSolver)
            {
                return;
            }
            GH_Document gH_Document = base.OnPingDocument();

            if (gH_Document == null)
            {
                return;
            }
            GH_Document.GH_ScheduleDelegate gH_ScheduleDelegate = new GH_Document.GH_ScheduleDelegate(this.ScheduleCallback);
            gH_Document.ScheduleSolution(1, gH_ScheduleDelegate);
        }
Ejemplo n.º 2
0
        public static void SetData <TGoo, T>(ITargetParam <TGoo, T> owner, T value) where TGoo : GH_Goo <T>
        {
            GH_PersistentParam <TGoo> target = owner.Target;

            GH_Document.GH_ScheduleDelegate callback = new GH_Document.GH_ScheduleDelegate(ScheduleCallback);
            target.OnPingDocument().ScheduleSolution(20, callback);

            void ScheduleCallback(GH_Document doc)
            {
                target.RecordUndoEvent(typeof(T).Name + "Changed!");
                {
                    target.PersistentData.Clear();
                    target.SetPersistentData(value);
                }
            }
        }
Ejemplo n.º 3
0
        protected void AutoFrameCompute(int inputFrame)
        {
            this.OnPingDocument().SolutionEnd -= ends;
            int Delay = (int)Math.Pow(10, DelayLog);

            this.PercentStr = "";
            this.RemainStr  = "";

            GH_Document.GH_ScheduleDelegate callback = new GH_Document.GH_ScheduleDelegate(this.ScheduleCallback);
            if (this.Play)
            {
                if (GH_Document.IsEscapeKeyDown())
                {
                    this.Play = false;
                    this.ExpireSolution(true);
                    this.AutoFrame  = -1;
                    this.RightFrame = inputFrame;
                }

                if (AutoFrame == -1)
                {
                    watchtime       = Stopwatch.StartNew();
                    StartFrame      = inputFrame;
                    this.AutoFrame  = StartFrame;
                    this.RightFrame = AutoFrame;
                    this.OnPingDocument().ScheduleSolution(Delay, callback);
                    this.OnPingDocument().SolutionEnd += ends;
                }
                else
                {
                    this.RightFrame = AutoFrame;

                    if (this.AutoFrame <= this.MaxFrame)
                    {
                        double remain  = ((watchtime.Elapsed.TotalSeconds) / (double)(AutoFrame - StartFrame + 1)) * (double)(this.MaxFrame - AutoFrame);
                        double percent = (double)(AutoFrame - StartFrame) / (double)(this.MaxFrame - StartFrame) * 100;
                        PercentStr = percent.ToString("f0") + "%  ";
                        RemainStr  = remain.ToString("f2") + "s Left";
                        AutoFrame++;
                        this.OnPingDocument().ScheduleSolution(Delay, callback);
                        this.OnPingDocument().SolutionEnd += ends;
                    }
                    else
                    {
                        PercentStr      = "Finished!  ";
                        RemainStr       = "TotalTime: " + watchtime.Elapsed.TotalSeconds.ToString("f2") + "s";
                        watchtime       = null;
                        this.Play       = false;
                        this.AutoFrame  = -1;
                        this.RightFrame = inputFrame;
                        this.OnPingDocument().SolutionEnd += ends;
                    }
                }
            }
            else
            {
                this.RightFrame = inputFrame;
                AutoFrame       = -1;
                watchtime       = null;
                this.OnPingDocument().ScheduleSolution(0, callback);
            }

            this.RightTime = this.KeyTimes[this.RightFrame];
        }