What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Beginner question: adding Windows Forms to AB plugin

Status
Not open for further replies.

Benninger

Member
Joined
Apr 22, 2010
Messages
457
Reaction score
0
Hm, I am learning C# just for AB ;) Can you provide a link to that sample plugins in this forum, please? I only find complex plugins (e.g. TradeRunner) which I am not able to analyze yet :(

Or can you please answer this:
This code does not work and I wonder how I can do that: Mini Plugin that opens a Windows Form. In that Form is e.g. a DropDownList and depending on the selected value AB shall do something.
Oh, Reference to System.Windows.Forms has been added and a form named "Form1.cs", too.

Code:
using System;
using System.Windows.Forms;
using System.Threading;
using System.Collections.Generic;
using ArcheBuddy.Bot.Classes;

namespace DefaultNamespace
{
    public class DefaultClass : Core
    {
        private Form1 F;
       
        public void PluginRun()
        {
            F.ShowDialog();
           // Do Some Stuff depending on selectec DropDownList in the Form
           switch (F.Listbox1.SelectedItem.Tostring())
           {
               case "Entry 1":
                   // do some AB Stuff
                   break;
               case "Entry 2":
               // do some AB Stuff
                   break;
               //...
           }
        }
    }
}

Thank you,
Benninger
 
Your problem is this line: F.ShowDialog();
ShowDialog call a modal window, nothing after it is executed while the form is still opened.

The forum plugin section has many sources to explore and learn. In fast search, I found this one:
https://www.thebuddyforum.com/arche...83001-plugin-dumpydumper-gui-info-dumper.html

btw, I recommend you to learn C# from an online course. You can focus on Windows Forms, or WPF.
Complex plugins need to deal with threads and sync, and other stuffs.
 
Thank you Will!

I am a little bit used to program vb.net - so c# will be a little challenge.
BTW: Can I create a plugin in vb.net (using the ArcheBuddy.dll reference)? Imho it should work, doesn't it?
Thanks for the link - i did not find it. The plugins I found were quite (too) complex.
I programmed a handful of plugins for harvesting, moving, etc. But I am missing the "live form for chosing what to do" ^^ So I have to modify the VS-solution every time :(
I am trying now, thanks again and rep added!
 
I think VB.NET will work as well, dunno, need to try!
 
Either vb.net does not work or I am missing something:

This code does not work:

Imports ArcheBuddy.Bot.Classes has a green underline which says:
The namespace or type give in ArcheBuddy.Bot.Classes does not have any public member...
(not really, but I tried to translate it due to a german VisualStudio)
So "Inherits Core" does not work:
"Type Core is not defined.

Code:
Imports System.Drawing
Imports System.Threading
Imports System.Collections.Generic
Imports System.Linq
Imports ArcheBuddy.Bot.Classes

Namespace DefaultNameSpace
   Public Class DefaultClass
      Inherits Core

      Public Shared Function GetPluginAuthor() As String
         Return "Plugin Author"
      End Function

      Public Shared Function GetPluginVersion() As String
         Return "1.0.0.0"
      End Function

      Public Shared Function GetPluginDescription() As String
         Return "My plugin description"
      End Function

      'Call on plugin start
      Public Sub PluginRun()
      End Sub
      'Call on plugin stop
      Public Sub PluginStop()
      End Sub
   End Class
End Namespace

What is my mistake? (Oh, reference to Archebuddy.dll has been set)
I thought the .NET languages can be "mixed".
So I can write a vb.net class which imports a c#-class and after compiling I get common .net code, or?

Best regards,
The Benninger

EDIT: Screenshot of my german VisualStudio added
 

Attachments

  • vbplugin.webp
    vbplugin.webp
    30 KB · Views: 44
Last edited:
I start to learn German two weeks ago, so, atm its very very hard to understand your screenshot ahhahah

Your code is ok, its work here.

My steps to reach the goal:
1 - Create a VB.NET project setting Framework 4.5.1 (last Archebuddy dll warning about 4.5)
2 - Add reference to Archebuddy.dll in Project Properties -> References tab

3 - Set compile target to x86 in Project Properties -> Compile tab



Enjoy...
 
Will, you are my hero!
After setting the target framework from 4.5 to 4.5.1 my "project" compiled...
I can not check it because of the downtime of AB, but it looks very well.
 
Status
Not open for further replies.
Back
Top