console-application

Running the scheduler twice is updating the file with the earlier file in Console application C#

好久不见. 提交于 2019-12-11 17:54:43
问题 I have a requirement where my scheduler will run twice in a day. One in the morning and a second time in evening. When I run my current code it stores the file in a folder. So again when I run the same application in the evening what happens is that the same file which is saved earlier in the morning is getting updated again which I don't want to happen. I want to save both the files. So what should I do? Below is my current code. Please give me suggestions public void ExportExcel(string

Converting a Console Application into a GUI that uses a BackgroundWorker

拥有回忆 提交于 2019-12-11 17:53:18
问题 I am converting a console application into a Windows Forms Application and a DLL. The Windows Forms Application uses a BackgroundWorker to have the DLL perform a computationally heavy task. Left over from the console application, the DLL is still littered with Console.WriteLine() statements. I would like to direct what used to be printed to the console into a TextBox in the Windows Form. Ideally, I would like to hook a stream from the DLL up to the text box during form initialization and be

WCF Service in Console app throwing error

你。 提交于 2019-12-11 17:41:01
问题 BasicHttp and NetTcp Binding hosted in Console App I have the below web.config file <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <services> <service name="HelloService.HelloService" behaviorConfiguration="mexBehaviour"> <endpoint address="HelloService" binding="basicHttpBinding" contract="HelloService.IHelloService"></endpoint> <endpoint address="HelloService" binding="netTcpBinding" contract="HelloService.IHelloService"></endpoint> <endpoint address="mex"

How to setup console self-host project for an existing Asp.NET Web API project

时光总嘲笑我的痴心妄想 提交于 2019-12-11 16:23:51
问题 I have ASP.NET web application. The template creates default web api controller ValuesController. I am trying to create console application to self-host using Microsoft.AspNet.WebApi.OwinSelfHost version 5.2.6. Solution structure looks like: Startup.cs in SelfHost.Server, agree! not a good name, is looks like: HttpConfiguration config = new HttpConfiguration(); config.Routes.MapHttpRoute( "DefaultApi", "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional }); app.UseWebApi

How to write back to command line from c# program

百般思念 提交于 2019-12-11 16:07:32
问题 Winform app that accepts CLI arguments opens new console window when run, but i want it to run in the CLI instead and return any Console.WriteLine()'s there This is how i split out the GUI and the console static class program{ [STAThread] [System.Runtime.InteropServices.DllImport("kernel32.dll")] private static extern bool AllocConsole(); static void Main(string[] args){ if (args.Length > 0) { AllocConsole(); Console.WriteLine("Yo!"); Console.ReadKey(); } else { Application.EnableVisualStyles

Run console Asynchronously to result a more efficient output

给你一囗甜甜゛ 提交于 2019-12-11 16:00:36
问题 class CommandLine2 { static void Main(string[] args) { System.Console.WriteLine("Number of command line parameters = {0}", args.Length); foreach (string s in args) { System.Console.WriteLine(s); } } } This is an example of the console app that will fire the task from a WCF. I got a project that fires a set of check on csv files line by line and I am creating a console app that will do the task. What I need is to run this async so it will hit each row and after say around few seconds end the

Xcode + swift + Darwin.ncurses = “A_BOLD not found” compilation error. I can't get bright colors

若如初见. 提交于 2019-12-11 15:23:41
问题 I'm creating a silly utility under XCode 10.2.1, with a swift + ncurses template. The compilation environment seems amazingly easy to setup: 1.- You import some Darwin.ncurses at the beginning of your main.swift file 2.- You start to invoke the typical ncurses primitives (to create some "color brushes") 3.- You addstrings to the ncurses canvas and your text appears happily rendered. So far so good, but I need something more than the 8 dark colors my Darwin.ncurses apparently gives. I googled

Dispatcher.CheckAccess() isn't working from my console application, is there a better way

丶灬走出姿态 提交于 2019-12-11 14:48:06
问题 I wrote an application in WPF / VB and separated the business logic and UI into different projects. The business layer uses a serial port which runs on a different thread, Now that I'm trying to write a command line interface for the same business layer, it seems to fail when .Invoke() is called. (no error, just doesn't work) I'm pretty sure the reason I had to add in checkaccess and .invoke was because I have collections that would be changed during processing the serial port data and wanted

Closing Console Window From WPF

非 Y 不嫁゛ 提交于 2019-12-11 13:59:33
问题 I have a WPF project, when you click on a button, a Console application window Appears and do a long task (crawling some url that it got it from the wpf window). All of this works good, I have 2 problems. while the Console window is on, the WPF window freezes. if I closed the Console window, the whole application closes (including the wpf window). For the Console Window, I implemented the class from John Leidegren in this post: No output to console from a WPF application? then from my WPF

Accessing ASP.Net Membership in a Console Application?

无人久伴 提交于 2019-12-11 13:04:20
问题 I'm writing a simple utility console app to add new users, etc, to an SQL Server Membership Store. The issue I'm running into is that I can't seem to add a reference to System.Web, so I can't access the Membership stuff. How does one go about doing this? NOTE: I've found a few questions on stackoverflow that seem similar, but the answers revolved around MVC, and after attempting the suggested answers, the problem still remains. Edit: Oded helped lead me to the answer. By default it was