//----< query button to send query message with query requirement >----------------
        private void Query1_Click(object sender_, RoutedEventArgs e)
        {
            if (ServerUrl == null)
            {
                MessageBox.Show("Please register with Server first!");
            }
            else
            {
                QueryCommunicator query = new QueryCommunicator(reference);
                query.Name = "client-query";
                receiver.Register(query);
                query.Start();

                Result.Items.Clear();
                Categories1.Items.Clear();
                show_elements.Items.Clear();
                string         queryContents = Categories2.Text + "&" + QueryContent.Text;
                ServiceMessage msg2          = null;

                if (Text.IsChecked == true && all_strings.IsChecked == true)
                {
                    msg2           = ServiceMessage.MakeMessage("query", "ServiceClient", queryContents, "textqueryA");
                    msg2.SourceUrl = ClientUrl;
                    msg2.TargetUrl = ServerUrl;
                    sender.PostMessage(msg2);
                }
                else if (Text.IsChecked == true && all_strings.IsChecked != true)
                {
                    msg2           = ServiceMessage.MakeMessage("query", "ServiceClient", queryContents, "textqueryO");
                    msg2.SourceUrl = ClientUrl;
                    msg2.TargetUrl = ServerUrl;
                    sender.PostMessage(msg2);
                }
                else if (Metadata.IsChecked == true)
                {
                    msg2           = ServiceMessage.MakeMessage("query", "ServiceClient", queryContents, "metadataquery");
                    msg2.SourceUrl = ClientUrl;
                    msg2.TargetUrl = ServerUrl;
                    sender.PostMessage(msg2);
                }
                else
                {
                    MessageBox.Show("Choose file pattern!");
                }
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.Write("\n  Starting CommService");
            Console.Write("\n ======================\n");

            string   ServerUrl = "http://localhost:8000/CommService";
            Receiver receiver  = new Receiver(ServerUrl);

            EchoCommunicator echo = new EchoCommunicator();

            echo.Name = "echo";
            receiver.Register(echo);
            echo.Start();

            string ClientUrl = echo.GetClientUrl();
            Sender sender    = new Sender();

            sender.Name = "sender";
            sender.Connect(ClientUrl);
            receiver.Register(sender);
            sender.Start();


            QueryCommunicator query = new QueryCommunicator();

            query.Name = "query";
            receiver.Register(query);
            query.Start();

            // parent/child relationships

            NavigationCommunicator nav = new NavigationCommunicator();

            nav.Name = "nav";
            receiver.Register(nav);
            nav.Start();

            Console.Write("\n  Started CommService - Press key to exit:\n ");
            Console.ReadKey();
        }
Пример #3
0
            static void Main(string[] args)
            {
                Console.Write("\n  Starting CommService");
                Console.Write("\n ======================\n");

                string   ServerUrl = "http://localhost:8000/CommService";
                Receiver receiver  = new Receiver(ServerUrl);

                string ClientUrl = "http://localhost:8001/CommService";

                Sender sender = new Sender();

                sender.Name = "sender";
                sender.Connect(ClientUrl);
                receiver.Register(sender);
                sender.Start();

                // Test Component that simply echos message

                EchoCommunicator echo = new EchoCommunicator();

                echo.Name = "echo";
                receiver.Register(echo);
                echo.Start();

                // Placeholder for query processor

                QueryCommunicator query = new QueryCommunicator();

                query.Name = "query";
                receiver.Register(query);
                query.Start();

                FileContent filecontent = new FileContent();

                filecontent.Name = "filecontent";
                receiver.Register(filecontent);
                filecontent.Start();

                EditMetadataCommunicator editmetadata = new EditMetadataCommunicator();

                editmetadata.Name = "metadataedit";
                receiver.Register(editmetadata);
                editmetadata.Start();
                // Placeholder for component that searches for and returns
                // parent/child relationships

                TextFilesCommunicator textfiles = new TextFilesCommunicator();

                textfiles.Name = "textfiles";
                receiver.Register(textfiles);
                textfiles.Start();

                NavigationCommunicator nav = new NavigationCommunicator();

                nav.Name = "nav";
                receiver.Register(nav);
                nav.Start();

                FileInsertionCommunicator fic = new FileInsertionCommunicator();

                fic.Name = "file";
                receiver.Register(fic);
                fic.Start();

                Console.Write("\n  Started CommService - Press key to exit:\n ");
                Console.ReadKey();
            }