[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

C# fluent.toc basic programming help

Posted on 2007-10-17
4
Medium Priority
?
402 Views
Last Modified: 2013-12-17
I am trying to use the fluent.toc library and  when i try to use the easiest sample code from their web site to test receiving a message (see below)
did anyone ever use this library...does this error make any sense?

i get the following error message

:Error      1      'Fluent.Toc.MessageEventHandler' is a 'type' but is used like a 'variable'      C:\Documents and Settings\damien\My Documents\Visual Studio 2005\Projects\JCIMBot\JCIMBot\Program.cs      23      27      JCIMBot



using System;
using System.Collections.Generic;
using System.Text;
using Fluent.Toc;


namespace JCIMBot
{
    class Program
    {
        static void Main(string[] args)
        {
            TocClient tc = new TocClient();
            tc.Message += MessageEventHandler(OnMessage);
            tc.SignOn("me","mypassword");
            tc.StartListening();
            System.Threading.Thread.Sleep(100000);
            tc.SignOff();
        }
        protected void  OnMessage(object sender, MessageEventArgs e)
        {
            System.Console.WriteLine("{0}: {1}",e.From, e.Message);
        }

       
    }
}
0
Comment
Question by:tstuardo
  • 2
4 Comments
 
LVL 22

Expert Comment

by:JimBrandley
ID: 20096195
Try this instead:
 tc.Message += new MessageEventHandler(OnMessage);

Jim
0
 
LVL 1

Author Comment

by:tstuardo
ID: 20096245
i had tried that already
here is the error
Error      1      An object reference is required for the nonstatic field, method, or property 'JCIMBot.Program.OnMessage(object, Fluent.Toc.MessageEventArgs)'
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 20096304
tc.Message += OnMessage;

protected static void OnMessage(object sender, MessageEventArgs e)
        {
            System.Console.WriteLine("{0}: {1}",e.From, e.Message);
        }

Bob
0
 
LVL 1

Author Comment

by:tstuardo
ID: 20096418
thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses
Course of the Month18 days, 21 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question