C# a Step by Step Beginners Tutorial

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bfusr
    Junior Member
    • Jan 2013
    • 2

    #106
    Thanks for your quick answer. Q1: It should look like this:



    and I simply don't know how to get checked Items from Form, to MenuTree.cs. I could save them to file and load, but it's not the best way I guess.

    Comment

    • Escapee
      Junior Member
      • Feb 2009
      • 51

      #107
      Originally posted by bfusr View Post
      I simply don't know how to get checked Items from Form, to MenuTree.cs.
      In your specific example, as your check boxes sit directly on your form you could create a few public bool variable in the menuTree.cs, such as bEnglishSoccer and then set them in the check_changed event.



      Code:
      chkEnglishSoccer_checkChanged()
      {
          if( chkEnglishSoccer.checked == true )
          {
              c_MenuTree.bEnglishSoccer = true;
          }
          else
          {
              c_MenuTree.bEnglishSoccer = false;
          }
      
          c_menuTree.Initialise()
      }
      and in the initialise() you can see what is checked and what isn't.


      Ok, so that's a kludge that might work for your example, but when you've got a control sitting 5 levels deep and it's got to communicate with another control 7 layers down and niether of them know much about each other then that's where OO design fails imho.
      Maybe I'm missing something, but I've never really found what I would consider a natural and elegant inter-object communication method when there is no hierarchical object connection.

      I usually use delegate redirection or event messaging but it doesn't seem quite right to me.

      Edit
      P.S. this onChkChanged is simplified for clarity, be aware, some of these events fire twice for each click
      Last edited by Escapee; 27-02-2013, 03:39 AM.

      Comment

      • tmos1985
        Junior Member
        • Feb 2013
        • 1

        #108
        This is a great tutorial. Very helpful. I just want to display soccer fixtures and odds. I want to do all the calculations for the returns myself. I will just be doing football matches. I am trying to code a betting simulator. All of my information will be stored on my own database.

        Comment

        • AnsarSA
          Junior Member
          • Mar 2013
          • 1

          #109
          Hi, are the entire solution files available by any chance? Where could I get them? Thanks.

          Comment

          • paypascal
            Junior Member
            • Mar 2013
            • 2

            #110
            I've copied your source code quickly, but the odds aren't functioning right. Do you know what might be causing this?

            I would have simply divided by 10 but the numbers change like this:
            Essence Of Bubbles
            30 305 31
            Which really is:
            3.0 3.05 3.1

            CMarketData.RDATA[r].BackPrice[0].dOdds

            Comment

            • paypascal
              Junior Member
              • Mar 2013
              • 2

              #111
              If anyone else has the same issue.
              Change this UpdateMarketPricesCompressed() in CMarketData:

              RDATA[ind].BackPrice[i].dOdds = BackPricesArr[iTmp].Length > 0 ? Convert.ToDouble(BackPricesArr[iTmp]) : 0;
              RDATA[ind].BackPrice[i].dAmount = BackPricesArr[(iTmp + 1)].Length > 0 ? Convert.ToDouble(BackPricesArr[(iTmp + 1)]) : 0;

              To:

              if (BackPricesArr[iTmp].Length > 0) RDATA[ind].BackPrice[i].dOdds = Convert.ToDouble(BackPricesArr[iTmp].ToString().Replace(".", ","));
              if (BackPricesArr[(iTmp + 1)].Length > 0) RDATA[ind].BackPrice[i].dAmount = Convert.ToDouble(BackPricesArr[(iTmp + 1)].ToString().Replace(".", ","));

              And the same for laying.

              Comment

              • denvb
                Junior Member
                • Mar 2013
                • 8

                #112
                Originally posted by paypascal View Post
                If anyone else has the same issue.
                This is a known issue. Simple use this method

                Convert.ToDouble(data, System.Globalization.CultureInfo.InvariantCulture)
                Last edited by denvb; 01-04-2013, 11:29 AM.

                Comment

                • Escapee
                  Junior Member
                  • Feb 2009
                  • 51

                  #113

                  Comment

                  • Letrix
                    Junior Member
                    • Aug 2011
                    • 10

                    #114
                    MenuTree doesn't appear in my Toolbox

                    Hello.

                    Thank you so much for this very useful and detailed tutorial.

                    But I don't have experience in writing programs with windowsforms, buttons etc. and so do maybe stupid mistakes.

                    After 25th step MenuTree control doesn't appear in my Toolbox as well as BetfairControls Components and BetfairAPI Components groups of controls.
                    And it doesn't appear independently on weather I change from what class MenuTree inherits or not.

                    Does someone encountered such a problem?

                    I am using VS2010 professional.
                    Last edited by Letrix; 01-06-2013, 07:22 PM.

                    Comment

                    • Letrix
                      Junior Member
                      • Aug 2011
                      • 10

                      #115
                      Solved

                      Finally I solved the problem.
                      Right click on Toolbox->Choose items...->browse file BetfairControls.dll

                      Comment

                      • chewie22
                        Junior Member
                        • Jul 2009
                        • 2

                        #116
                        An old thread but I've just gone through the sample for the first time and as you spent the time to create it, I felt obliged to spend the time to thank you for your effort.

                        Thanks very much for the generous donation of your time and expertise.

                        Comment

                        • CaptnCanary
                          Junior Member
                          • Feb 2014
                          • 2

                          #117
                          Originally posted by denvb View Post
                          This is a known issue. Simple use this method

                          Convert.ToDouble(data, System.Globalization.CultureInfo.InvariantCulture)
                          I am completely new to coding but have worked through the tutorial and managed to get it working. Unfortunately, the odds on my GUI are not showing up the same as on the Betfair website. I don't think the problem is quite the same as the one paypascal mentioned but could have a similar solution? I note the suggested code above but do not know where to put this to try it out.
                          Here is a screenshot of my GUI and Betfair taken at the same time on a Greyhound market. As you can see, most of it is right but the odds and amount available are not.



                          Any help would be much appreciated. Please tell me exactly where to put any suggested code. I will be working on more tutorials to learn C# to help me develop this program further and learn to automate placing bets.

                          Comment

                          • clerk
                            Junior Member
                            • Feb 2014
                            • 10

                            #118
                            Maybe website Betfair just opened, and the entrance to your account is not complete?

                            Comment

                            • betdynamics
                              Junior Member
                              • Sep 2010
                              • 534

                              #119
                              What have you got your RollupStake value set to?

                              Comment

                              • CaptnCanary
                                Junior Member
                                • Feb 2014
                                • 2

                                #120
                                Originally posted by betdynamics View Post
                                What have you got your RollupStake value set to?
                                Hi. Where can I find RollupStake? I searched through the cs files but cannot see it anywhere. But anyhow, I have not changed anything in the tutorial code so everything should be completely as designed by the OP. Since posting my question I noticed some other behaviour too. When watching in-play football(soccer) odds, the tutorial GUI matches the Betfair market well, but when there is a goal, and the market is suspended then reopened, the odds in the GUI jump around all over the place for a while, whereas the odds on Betfair are stable in comparison.

                                Here is another example of the problem on the greyhounds markets but this time over an hour before the race while the odds are not moving at all, in the GUI or on Betfair website.

                                Comment

                                Working...
                                X