예제 #1
0
        public MainWindowForm(Common.Solver solver)
        {
            InitializeComponent();

            this.solver   = solver;
            ticketService = new TicketsServiceClient();
            NotificationServiceCallback notificationServiceCallback = new NotificationServiceCallback();

            notificationServiceCallback.UserNotifiedEvent += UserNotified_Handler;


            instanceContext           = new InstanceContext(notificationServiceCallback);
            notificationServiceClient = new NotificationServiceClient(instanceContext);



            try
            {
                userId = notificationServiceClient.Subscribe();
            }
            catch
            {
                Console.WriteLine("ERROR: notificationServiceClient.Subscribe()");
            }
            UI_Init();
        }
예제 #2
0
파일: Program.cs 프로젝트: mkhiami/Idemia
        static void Main(string[] args)
        {
            Console.WriteLine("Hi from Suscriber Console!");
            InstanceContext site = new InstanceContext(null, new Program());

            NotificationServiceClient client = new NotificationServiceClient(site);

            //create a unique callback address so multiple clients can run on one machine
            WSDualHttpBinding binding = (WSDualHttpBinding)client.Endpoint.Binding;
            string            clientcallbackaddress = binding.ClientBaseAddress.AbsoluteUri;

            clientcallbackaddress    += Guid.NewGuid().ToString();
            binding.ClientBaseAddress = new Uri(clientcallbackaddress);

            //Subscribe.
            Console.WriteLine("Subscribing");
            client.Subscribe();

            Console.WriteLine();
            Console.WriteLine("Press ENTER to unsubscribe and shut down client");
            Console.ReadLine();

            Console.WriteLine("Unsubscribing");
            client.Unsubscribe();

            //Closing the client gracefully closes the connection and cleans up resources
            client.Close();
        }
예제 #3
0
 /// <summary>
 /// Handles the click event of the subscribe button.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">Event arguments.</param>
 private void SubscribeButtonClick(object sender, RoutedEventArgs e)
 {
     try
     {
         UnsubscribeSidsIfNeeded();
         InitializeClient(Address.Text);
         notificationServiceClient.BeginSubscribe();
         foreach (SidConstants.SID subscribedSid in subscribedSids)
         {
             notificationServiceClient.Subscribe(subscribedSid.ToString());
         }
         notificationServiceClient.EndSubscribe();
     }
     catch (Exception ex)
     {
         MessageBox.Show("ERROR:\n\n" + ex.Message, "Error", MessageBoxButton.OK);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            ticketsService = new TicketsService.TicketsServiceClient();

            NotificationServiceCallback notificationServiceCallback = new NotificationServiceCallback();

            notificationServiceCallback.UserNotifiedEvent += UserNotified_Handler;


            instanceContext           = new InstanceContext(notificationServiceCallback);
            notificationServiceClient = new NotificationServiceClient(instanceContext);

            try
            {
                userId = notificationServiceClient.Subscribe();
            }
            catch
            {
                Console.WriteLine("ERROR: notificationServiceClient.Subscribe()");
            }

            LoadWorkers();


            if (!Page.IsPostBack)
            {
                UpdateWorkersList();
            }

            if (workersList != null)
            {
                if (workersList.Count > 0)
                {
                    UpdateQuestionsListBox(workersList[workersDropDownList.SelectedIndex].id);
                }
            }

            //TODO remover, Isto é para DEBUG
            //DebugLabel.Text = ticketsService.DebugTests();
        }
예제 #5
0
        public MainWindowForm()
        {
            InitializeComponent();


            QueueService.UI_Updater = UI_UpdateList; //Calls UI_UpdateList When new question is received

            ticketService = new TicketsServiceClient();

            NotificationServiceCallback notificationServiceCallback = new NotificationServiceCallback();

            notificationServiceCallback.UserNotifiedEvent += UserNotified_Handler;

            instanceContext           = new InstanceContext(notificationServiceCallback);
            notificationServiceClient = new NotificationServiceClient(instanceContext);



            try
            {
                userId = notificationServiceClient.Subscribe();
            }
            catch
            {
                Console.WriteLine("ERROR: notificationServiceClient.Subscribe()");
            }

            ServiceHost host = new ServiceHost(typeof(QueueService));

            host.Open();



            UI_LBOX();

            //TODO remover
            //DebugTestes();
        }