static void Main(string[] args) { var mainConf = System.Configuration.ConfigurationManager.OpenExeConfiguration(""); var conf = new System.ServiceModel.Configuration.ClientSection(); //((System.ServiceModel.Configuration.ClientSection)mainConf.SectionGroups["system.serviceModel"].Sections["client"]).Endpoints[0] mainGate = new ConnectionProvider.Client(); mainGate.Subscribe(); Console.WriteLine("Press Enter"); Console.ReadLine(); mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 1001 }); Console.WriteLine("Press Enter"); Console.ReadLine(); mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 100 }); Console.WriteLine("Press Enter"); Console.ReadLine(); mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 101 }); Console.WriteLine("Press Enter"); Console.ReadLine(); CultureInfo culture = CultureInfo.InvariantCulture; Assembly executingAssembly = Assembly.GetExecutingAssembly(); // load spim-generated data from embedded resource file //const string spimDataName = ; for (int i = 0; i < 1000; i++) { Console.WriteLine("Press Enter"); Console.ReadLine(); // mainGate.PushEvent(new Esms.FingersStateEvent { FingersOpened = true, Time = DateTime.Now }); } //mainGate.PushEvent(new HeatChangeEvent() { HeatNumber = 1001, iCnvNr = DateTime.Now.Second % 2 + 1, Time = DateTime.Now }); //Console.ReadLine(); mainGate.PushEvent(new LanceEvent() { O2TotalVol = 20 }); Console.ReadLine(); for (int i = 0; i < 1000; i++) { Thread.Sleep(100); mainGate.PushEvent(new LanceEvent() { O2TotalVol = i * 20 }); } Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("########################################"); Console.WriteLine("# WCF Simple Client 1.0 by HarryGG"); Console.WriteLine("########################################" + Environment.NewLine); string selection = "Type: 1 to add comment, 2 to view comments, 3 to exit"; Console.WriteLine(selection); Console.Write(">"); string action = Console.ReadLine(); string comment = null; string name = null; //EvalServiceClient WSHttpBinding_client = new EvalServiceClient("WSHttpBinding_IEvalService"); EvalServiceClient WSHttpBinding_client = new EvalServiceClient(); try { while (action != "3" && action != "exit") { switch (action) { case "1": Console.WriteLine("Write comment and hit <Enter> to submit:"); comment = Console.ReadLine(); Console.WriteLine("Write your name and hit <Enter> to submit:"); name = Console.ReadLine(); Eval eval = new Eval(); eval.Comments = comment; eval.Submitter = name; eval.TimeSubmitted = DateTime.Now; System.ServiceModel.Configuration.ClientSection clientSection = (System.ServiceModel.Configuration.ClientSection)ConfigurationManager.GetSection("system.serviceModel/client"); System.ServiceModel.Configuration.ChannelEndpointElement endpoint = clientSection.Endpoints[0]; //string endpointStr = endpoint.Address.ToString(); Console.WriteLine("Submitting comment to endpoint "); // + endpointStr); WSHttpBinding_client.SubmitEval(eval); Console.WriteLine("Comment submitted!" + Environment.NewLine); Console.WriteLine(selection); Console.Write(">"); action = Console.ReadLine(); break; case "2": Console.WriteLine("Getting list of submitted comments..."); Eval[] evals = WSHttpBinding_client.GetEvals(); int i = 0; if (evals.Length > 0) { Console.WriteLine(evals.Length + " comments retrieved successfully:"); Console.WriteLine(Environment.NewLine); foreach (Eval ev in evals) { Console.WriteLine(++i + ": " + ev.Comments + " from user " + ev.Submitter); } } else { Console.WriteLine(Environment.NewLine); Console.WriteLine("No comments found! I suggest you first add some comments!"); } Console.WriteLine(Environment.NewLine); Console.WriteLine(selection); Console.Write(">"); action = Console.ReadLine(); break; } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } Console.WriteLine("*********************************************************"); //Console.WriteLine(selection); //Console.Write(">"); //action = Console.ReadLine(); }