CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2008
    Posts
    161

    [RESOLVED] Help with my app

    I was working on an app that downloads and installs addons for an online game.

    I absolutely can not figure out what is wrong with it, i try debuging and it doesn't even step into the next thread.

    If anyone is willing to look over it i will attach the source.

    The amount of code in it is far too much to post.

    Advice and suggestions welcome.

    Thank you.

  2. #2
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Question Re: Help with my app

    please post the part of your code that you think it is faulty and also error and warnings you recieved.

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Help with my app

    You need to start the thread.

    Code:
           private void btnInstall_Click( object sender, EventArgs e )
            {
                if( Locations.Addons == null )
                {
                    GMAI.WriteLine( "You do not have Garrys Mod installed!" );
                }
                else
                {
                    EnableItems( false );
                    listFailed.Items.Clear( );
                    MainThread = new Thread( new ThreadStart( ExecutionPoint ) );
                    MainThread.Start( );
                }
            }
    I'd recommend following the C# naming conventions as well.

    1) Namely private fields are camelCase (and preferably are prefixed with an underscore).
    2) Public static fields and Properties are PascalCase.

    Using this naming, MainThread (a private field) would become _mainThread and GMAI.download (a public static field) would become GMAI.Download.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Help with my app

    Lastly, the Locations code is very fragile.

    For example, this class won't initialize if \\Gmod Addons\\ isn't a sub-folder of 'My Documents'.

    I know you expect folks to have Steam or Garry's mods installed, but consider failing more gracefully if they don't.

    The following doesn't allow for gracefull failing (if the Gmod... folder isn't present):
    Code:
    public static readonly string Save = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments ) + "\\Gmod Addons\\";
    One strategy is to check for these folders and to display a message box if a needed folder isn't present.

  5. #5
    Join Date
    Mar 2008
    Posts
    161

    Re: Help with my app

    Quote Originally Posted by Arjay
    Lastly, the Locations code is very fragile.

    For example, this class won't initialize if \\Gmod Addons\\ isn't a sub-folder of 'My Documents'.

    I know you expect folks to have Steam or Garry's mods installed, but consider failing more gracefully if they don't.

    The following doesn't allow for gracefull failing (if the Gmod... folder isn't present):
    Code:
    public static readonly string Save = Environment.GetFolderPath( Environment.SpecialFolder.MyDocuments ) + "\\Gmod Addons\\";
    One strategy is to check for these folders and to display a message box if a needed folder isn't present.
    Thanks again Arjay, it was late and now i feel REALLY stupid for not adding MainThread.Start();

    And thanks for the info about the fragile class code. Ill fix them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured