Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Params         serverParam = new Params();
            ServerProvider server      = new ServerProvider(serverParam.Adress, serverParam.Port, 10);

            server.Start();
            Console.ReadKey();
        }
Ejemplo n.º 2
0
        private static void Main(string[] args)
        {
            ServerProvider serverProvider = new ServerProvider();

            serverProvider.RegisterServerService <UserService>();
            serverProvider.Start("http://localhost:6525/any");
            Console.WriteLine("server started");
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            ServerProvider serverProvider = new ServerProvider();

            serverProvider.RegisterServerService <ChatService>();
            serverProvider.RegisterClientService <IClientChatService>();
            serverProvider.Start("http://localhost:6262/any");
            Console.WriteLine("server started");
            Console.ReadLine();
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            This = this;
            InitializeComponent();
            mainframe.Navigate(new FirstPage());
            Closing += MainWindow_Closing;

            ServerProvider serverProvider = new ServerProvider();

            serverProvider.RegisterServerService <ServerManagerService>();
            serverProvider.Start("http://localhost:5468/ServerManager/SignalGo");
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            ServerProvider serverProvider = new ServerProvider();

            serverProvider.RegisterServerService <Services.HelloWorldService>();
            serverProvider.RegisterServerService <Services.TestStreamService>();
            serverProvider.RegisterClientService <ClientServices.IHelloCallbackClientService>();
            //to handle cross origin errors
            serverProvider.ProviderSetting.HttpSetting.HandleCrossOriginAccess = true;
            serverProvider.Start("http://localhost:9674/SignalGo");
            Console.WriteLine("server started");
            Console.ReadKey();
        }
Ejemplo n.º 6
0
        private static void Main(string[] args)
        {
            ServerProvider serverProvider = new ServerProvider();

            serverProvider.RegisterServerService <AuthenticationService>();
            serverProvider.RegisterServerService <BookService>();
            serverProvider.ProviderSetting.IsEnabledDataExchanger = false;
            serverProvider.Start("http://localhost:6452/SignalGoTest/any");

            SignalGoBotManager signalGoBotManager = new SignalGoBotManager();

            signalGoBotManager.Start("your telegram bot token here", serverProvider);
            Console.WriteLine("server started successfuly call your services with telegram bot or http request, example http://localhost:6452/Book/GetListOfBook");
            Console.ReadLine();
        }
Ejemplo n.º 7
0
        private static void Main(string[] args)
        {
            try
            {
                ServerProvider serverProvider = new ServerProvider();
                serverProvider.RegisterServerService <FullHttpSupportService>();
                serverProvider.Start("http://localhost:8080/TestService/any");

                Console.WriteLine("seerver started");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.ReadLine();
        }
Ejemplo n.º 8
0
        private static void Main(string[] args)
        {
            //create instace of server provider
            ServerProvider serverProvider = new ServerProvider();

            //register your service class
            serverProvider.RegisterServerService <ExampleService>();

            //customize your validation resutl to client
            serverProvider.ValidationResultHandlingFunction = (validations, service, method) =>
            {
                StringBuilder stringBuilder = new StringBuilder();
                foreach (BaseValidationRuleInfoAttribute item in validations)
                {
                    stringBuilder.AppendLine(BaseValidationRuleInfoAttribute.GetErrorValue(item).ToString());
                }
                return(stringBuilder.ToString());
            };

            //start server with port 4521
            serverProvider.Start("http://localhost:4521/any");

            InitializeValidationRules(serverProvider);


            //example start in your browser

            //invalid login
            StartProcess("http://localhost:4521/Example/Login?userName=&password="******"http://localhost:4521/Example/Login?userName=test&password=testpass");
            //valid addcontact
            StartProcess("http://localhost:4521/Example/AddContact?contact=" + Uri.EscapeDataString("{\"Name\":\"test\"}"));
            //invalid addcontact
            StartProcess("http://localhost:4521/Example/AddContact?contact={}");
            Console.WriteLine("Server started!");
            Console.ReadLine();
        }
Ejemplo n.º 9
0
        public static void Initialize()
        {
            if (server == null)
            {
                server = new SignalGo.Server.ServiceManager.ServerProvider();
                server.RegisterServerService <Models.TestServerStreamModel>();
                server.RegisterServerService <Models.TestServerModel>();
                server.RegisterServerService <Models.AuthenticationService>();
                server.RegisterClientService <Models.ITestClientServiceModel>();
                server.Start("http://localhost:1132/SignalGoTestService");
                server.ErrorHandlingFunction = (ex, serviceType, method, client) =>
                {
                    return(new MessageContract()
                    {
                        IsSuccess = false, Message = ex.ToString()
                    });
                };
                server.ValidationResultHandlingFunction = (errors, service, method) =>
                {
                    List <Models.ValidationRule> result = new List <Models.ValidationRule>();
                    foreach (BaseValidationRuleAttribute item in errors)
                    {
                        result.Add(new Models.ValidationRule()
                        {
                            Message = item.Message, Name = item.PropertyInfo?.Name
                        });
                    }
                    return(new MessageContract <ArticleInfo>()
                    {
                        IsSuccess = false, Errors = result
                    });
                };
                ////your client connector that will be connect to your server
                //ClientProvider provider = new ClientProvider();
                ////connect to your server must have full address that your server is listen
                //provider.Connect("http://localhost:1132/SignalGoTestService");
                //var service = provider.RegisterClientServiceInterfaceWrapper<ITestClientServerModel>();

                //try
                //{
                //    var result = service.HelloWorld("ali");
                //    //var result1 = await service.MUL(10, 20);
                //    //var result3 = await service.WhoAmI();
                //    //var result40 = service.Tagh(10, 3);
                //    ////var result41 = service.Tagha(10, 3);
                //    //var result4 = await service.TaghAsync(10, 3);
                //    //var result5 = await service.LongValue();
                //    //var result6 = await service.TimeS(100000000);
                //}
                //catch (Exception ex)
                //{

                //}
                ////register your service interfacce for client
                ////var testServerModel = provider.RegisterClientServiceDynamic<ITestServerModel>();
                ////call server method and return value from your server to client
                ////var result = testServerModel.HelloWorld("ali");
                //provider.Dispose();
                //Thread.Sleep(10000);
                //print your result to console
                //Console.WriteLine(result.Item1);
            }
            //client = new ClientProvider();
            //client.Connect("http://localhost:1132/SignalGoTestService");
        }