Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Version Check Asynchronous #28

Closed
TriggerAu opened this issue Jun 10, 2014 · 1 comment
Closed

Make Version Check Asynchronous #28

TriggerAu opened this issue Jun 10, 2014 · 1 comment

Comments

@TriggerAu
Copy link
Owner

Prevents the web check from holding up the game transitions

Source: Mihara at http://forum.kerbalspaceprogram.com/threads/24786-0-23-5-Kerbal-Alarm-Clock-v2-7-4-0-%28June-10%29?p=1205352&viewfull=1#post1205352

@TriggerAu TriggerAu self-assigned this Jun 10, 2014
TriggerAu added a commit that referenced this issue Jun 11, 2014
…day even if the daily check fails. (related to #28)

Need to look at proper async stuff
TriggerAu added a commit that referenced this issue Jun 12, 2014
@TriggerAu
Copy link
Owner Author

Ted uses the below for async tasks in BOSS (example shows button disabled and then reenabled at a later stage), try this with WWW object

.....
        if (superSampleValueInt > 1 && overrideLimiter != true)
        {
            buttonsEnabled = false;
            checkforPicture(kspPluginDataFldr + screenshotFilename + ".png");
        }
 .....
public void checkforPicture(string shotname)
    {
        /*This method checks for the image to appear inside the ss folder.
        Thus not allowing the user to take multiple shots in a row crashing their game.*/

        var bw = new BackgroundWorker();

        bw.DoWork += delegate(object o, DoWorkEventArgs args)
        {
            bool exists = false;
            var b = o as BackgroundWorker;
            while (exists == false)
            {
                Thread.Sleep(500);
                if (File.Exists<BOSS>(kspPluginDataFldr + shotname))
                {
                    exists = true;
                    buttonsEnabled = true;
                }
            }
        };
        bw.RunWorkerAsync();
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant