Announcement

Collapse
No announcement yet.

[screen] issues

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [screen] issues

    http://www.mediafire.com/?laj52as2ffeb9lh

    There is the link to the code, I just copy/pasted the code into a notepad file. Mediafire didn't like trying to upload whole folders or I couldn't be bothered figuring it out...

    Here is what it should like normally:


    Here is what it looks like when 2 different screens run it at the same time:
    Current Worklog: TBA - '05 Rav4 (Mobo Dead).
    www.rav4world.com - Forums for Rav4 owners
    www.flavorfeasts.com - Cooking website/forums
    -Basic forums live atm, come contribute!

  • #2
    I'll try your code as soon as I have some free time (probably some time tomorrow).
    Failure is not an option...
    __________________________________________________ ______________________________
    The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

    Comment


    • #3
      Do you want each screen to be able to update at different times or do you want each screen to update at the same time?
      Failure is not an option...
      __________________________________________________ ______________________________
      The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

      Comment


      • #4
        Your problem is caused by code that is not thread safe.
        Each button press spawns a new thread in where you grab the data and format it for the screen.

        In you're code you're using global variables for some controls as well as some other data like nflgamecount. This is not safe in a multithread enviroment as your global data can be (and is) changed by one thread while the other thread is using the data in another location. In certain situations this can lead to some funny results. So try to stay away from global data when possible. A good rule to follow is that you can only trust data that's declared in the same method or passed along as a parameter into the method.

        If you change your code in nflbutton_click to the following code it should work:
        Code:
                    removemiddlecontrols(screen);
                    int GameCount = getdatafromnflsite("http://www.nfl.com/scores", screen);
                    if (GameCount != 0)
                        resizeallnflgamepicboxs(screen, GameCount);
                    nflgamecount = GameCount;   // Now the data can no longer affect our handling, pass data to global reference
        You also have to change your getdatafromnflsite method to return int where the number is the gamecount.

        Your webrequest code was also unstable and would in certain cases return null or incomplete code, you need to add error checks for this in your code so that you're not prosessing any code that will lead to crashing your plugin (as it currently does).
        If you use the following code to get the url instead of the webrequest then it will be more stable:
        Code:
        string nflgames = OpenMobile.Net.Network.getFile(nflurl);
        Also instead of using the code "manager[screen]" every time you want to access something on a panel use a variable in your method as this saves code and makes it all faster:
        Code:
        OMPanel p = manager[screen];
        // Use p for access to the panel after this line
        I've edited your code so that it can run on my 4 monitor setup without graphical problems. If you want to I can upload this complete code.

        PS! The above code does not fix all problems related to multi threading and global data, you still have a problem with your code related to nflweekslist_click as clicking the weeklist crashes the code but it should get you going in the correct direction.
        Failure is not an option...
        __________________________________________________ ______________________________
        The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

        Comment


        • #5
          I knew there would be errors, as I just had to a working state as long as there were no active games at the time being run. I know about the error checking, but figured that the screen issues were not caused by error trapping. The global variables didn't even cross my mind, but now that it's mentioned, I think it creates a duh moment for me.

          I got rid of all my global variables except for the ScreenManager and IPluginHost and what a difference. I will keep testing it to make sure, but thanks so much for the help.

          Btw, I took out all the code that scrolllist I had for the weeks (no click events, no array to hold data according to click events, etc) and the list is scrolling abnormally slow. Is this because the list is so small in size? The list just adds 20ish text strings so I figured it couldn't be the item being added... All the other lists scroll fast from other plugins (settings, media, etc).
          Current Worklog: TBA - '05 Rav4 (Mobo Dead).
          www.rav4world.com - Forums for Rav4 owners
          www.flavorfeasts.com - Cooking website/forums
          -Basic forums live atm, come contribute!

          Comment


          • #6
            Originally posted by detlion1643 View Post
            Btw, I took out all the code that scrolllist I had for the weeks (no click events, no array to hold data according to click events, etc) and the list is scrolling abnormally slow. Is this because the list is so small in size? The list just adds 20ish text strings so I figured it couldn't be the item being added... All the other lists scroll fast from other plugins (settings, media, etc).
            The list that was in the code you posted works just fine here, no slow scrolling or lagging. But it is quite short so you dont get a lot of speed up for the actual "throwing" motion. But it still works just fine.
            Failure is not an option...
            __________________________________________________ ______________________________
            The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

            Comment

            Working...
            X