Ejemplo n.º 1
0
        public void doTask(sendMessageDelegate task, Message m)
        {
            NotificationEventArgs notificationInfo = new NotificationEventArgs(isTaskCompleted);

            if (isTaskCompleted == false)
            {
                if (notificationChanged != null)
                {
                    //Console.WriteLine("start");
                    notificationChanged(this, notificationInfo);
                }
            }
            Thread.Sleep(500);
            isTaskCompleted = true;
            Console.WriteLine("\n");
            notificationInfo = new NotificationEventArgs(isTaskCompleted);
            if (isTaskCompleted)
            {
                //Console.WriteLine("ty");
                var status = task(m);
                if (notificationChanged != null)
                {
                    notificationChanged(this, notificationInfo);
                }
            }
        }
Ejemplo n.º 2
0
 public void RequestDelivery(Message m, sendMessageDelegate t)
 {
     Console.WriteLine("Task Done-->\n");
     //td = new Agent.tasksenddelegate(t);
     Admin.subscribe(a);
     a.doTask(t, m);
 }
Ejemplo n.º 3
0
 public void RequestDelivery(Message m, sendMessageDelegate t)
 {
     td = new Agent.tasksenddelegate(t);
     a.doTask(td, m);
     a.notificationChanged += new Agent.NotificationHandler((o, e) => {
         Console.WriteLine(e.status);
     });
 }
Ejemplo n.º 4
0
 public Game(OppCommMode mode, string strategy, string sessionSSID, sendMessageDelegate msgDelegate, updateListbox msgListBoxDelegate, updateCredibility credibilityDelegate, restartProbing reProbingDelegate)
 {
     this.gameMode = mode;
     this.strategy = strategy;
     this.sessionID = sessionSSID;
     this.sendMsgDelegate = msgDelegate;
     this.msgListBoxDelegate = msgListBoxDelegate;
     this.credibilityDelegate = credibilityDelegate;
     this.restartProbingDelegate = reProbingDelegate;
     this.state = GameState.Started;
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Manager m1        = new Manager();
            Message m1Message = new Message
            {
                Address = "abc",
                Content = "This a message"
            };
            sendMessageDelegate md = SendTypes.SendByCar;

            m1.RequestDelivery(m1Message, md);
            //Agent a = new Agent();
            //a.notificationChanged += new Agent.NotificationHandler(ShowNotification);
        }
Ejemplo n.º 6
0
        public MainForm()
        {
            InitializeComponent();

            strategyComboBox.SelectedItem = (object)"Select Strategy";

            messageDelegate = SendMessage;

            updateMsgListBox = addMessageToListBox;

            credibilityDelegate = UpdateCredibility;

            OppCommRequestCallBack = NeighborJoined;

            restartProbingDelegate = RestartProbing;

            ToggleControls(true);

            CommonUtilities.Logger.flushAll();

            //This only initiates the device advertisement
            oppCommHandler = OppCommHandler.getInstance();
            deviceIDLabel.Text = DeviceID.GetInstance().ToIDString();

            //Read existing credibility history.
            ReadCredibilityHistory();
        }
Ejemplo n.º 7
0
 public void RequestDelivery(Message message, sendMessageDelegate waysOfSending)
 {
     sendingTask = new Agent.taskSendDelegate(waysOfSending);
     agent.DoTask(sendingTask, message);
 }