コード例 #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);
                }
            }
        }
コード例 #2
0
ファイル: Manager.cs プロジェクト: Sandeep-Kumawat/C-Sharp
 public void RequestDelivery(Message m, sendMessageDelegate t)
 {
     Console.WriteLine("Task Done-->\n");
     //td = new Agent.tasksenddelegate(t);
     Admin.subscribe(a);
     a.doTask(t, m);
 }
コード例 #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);
     });
 }
コード例 #4
0
ファイル: Game.cs プロジェクト: sankalpshere/projects
 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;
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: Sandeep-Kumawat/C-Sharp
        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);
        }
コード例 #6
0
ファイル: MainForm.cs プロジェクト: sankalpshere/projects
        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();
        }
コード例 #7
0
 public void RequestDelivery(Message message, sendMessageDelegate waysOfSending)
 {
     sendingTask = new Agent.taskSendDelegate(waysOfSending);
     agent.DoTask(sendingTask, message);
 }