public void Configuration(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); // Setup camel case var jsonFormatter = config.Formatters.OfType <JsonMediaTypeFormatter>().First(); jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); jsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter() { CamelCaseText = true }); // Setup ignoring null value properties jsonFormatter.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; config.Routes.MapHttpRoute( "Default", "{controller}/{uid}", new { uid = RouteParameter.Optional }); app.UseWebApi(config); // Start up static variables Trace.WriteLine("Reading dictionary..."); CoreWorker worker = new CoreWorker(RoleEnvironment.GetConfigurationSettingValue("cloudConn")); Trace.WriteLine("Reading filter list..."); StringParser.Parse(""); }
static void Main(string[] args) { // Endpoint var config = new HttpSelfHostConfiguration("http://localhost:8002"); // Serialization var jsonFormatter = config.Formatters.JsonFormatter; jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); jsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter() { CamelCaseText = true }); jsonFormatter.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; // Exception handling config.Filters.Add(new ApiExceptionFilterAttribute()); // Routing AttributeRoutingConfig.RegisterRoutes(config); // Start reading dictionary Console.WriteLine("Reading dictionary..."); CoreWorker worker = new CoreWorker(ConfigurationManager.ConnectionStrings["AzureStorage"].ConnectionString); // Start server using (HttpSelfHostServer server = new HttpSelfHostServer(config)) { Console.WriteLine("Started server at endpoint: {0}", config.BaseAddress.AbsoluteUri); server.OpenAsync().Wait(); config.Routes.Cast <HttpRoute>().ToArray().LogTo(Console.Out); Console.WriteLine("Press Enter to quit..."); Console.ReadLine(); } }
public void TestRysowania() { SignalRoutes signals = new SignalRoutes(new MockDataReader().ReadData()); ProjectionsData testMatrix = new ProjectionsData(2, signals, 0, 30, 0, 20); var valueMatrix = testMatrix.MakeRayDensity(); var worker = new CoreWorker(); var signalChart = worker.CreateSignalsChart(); }
private void wczytajModelToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Text Files (.txt)|*.txt|All Files (*.*)|*.*"; openFileDialog1.FilterIndex = 1; openFileDialog1.ShowDialog(); if (openFileDialog1.FileName == null || openFileDialog1.FileName == "") { startToolStripMenuItem.Enabled = false; return; } else { startToolStripMenuItem.Enabled = true; InputFile = openFileDialog1.FileName; worker = new CoreWorker(); Text = "Inwersja Tomograficzna | " + openFileDialog1.FileName; SetWorkingStatus("Plik wczytany poprawnie. Można zaczynać."); } IsModel = true; }
private void mockDataMenu_Click(object sender, EventArgs e) { worker = new CoreWorker(); }