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); } } }
public void RequestDelivery(Message m, sendMessageDelegate t) { Console.WriteLine("Task Done-->\n"); //td = new Agent.tasksenddelegate(t); Admin.subscribe(a); a.doTask(t, m); }
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); }); }
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; }
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); }
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(); }
public void RequestDelivery(Message message, sendMessageDelegate waysOfSending) { sendingTask = new Agent.taskSendDelegate(waysOfSending); agent.DoTask(sendingTask, message); }