console-application

Console app that opens a new window for each thread started by background worker

白昼怎懂夜的黑 提交于 2019-12-13 21:22:42
问题 I have a console application that starts multiple different threads. The main console app will poll a service and based on responses it will spawn one or more background threads using the BackgroundWorker class. At the moment each of these threads do a console.writeline to the sole default console window opened as it normally does for a console application. This makes it too confusing to follow the progress of any one thread. I want to be able to spawn a separate window with each of them

Passing command line arguments to console application does not work

我只是一个虾纸丫 提交于 2019-12-13 10:45:53
问题 I can't pass arguments to my console app. I tried it like this: App.exe arg1 App.exe "arg1" App.exe When I run the app with arguments, the app quits running without any messages. When debugging there is nothing in string[] args . My C# project is a plain .net 4.5.2 command line project. My OS is Windows 10 x64. Sample Code: using System; using System.Collections.ObjectModel; using System.Management.Automation; namespace Setup { class Program { static void Main(string[] args) { if (args.Length

Trying to show a Windows Form using a DLL that is imported at the runtime in a console application

烂漫一生 提交于 2019-12-13 09:44:41
问题 I am working on some research project and this mini project is a part of it. The objective of this mini project is to import the DLL at runtime and load the GUI stored in that DLL. I am trying to fire Show() function of Windows Form from a function of the DLL. Here's how the code looks like: Console Application Code using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Reflection; namespace DLLTest { class Program {

Convert DateTime to string “yyyy-mm-dd”

荒凉一梦 提交于 2019-12-13 09:33:18
问题 Im wondering how to convert a DateTime to a string value (yyyy-mm-dd). I have a console application and i want the user to be able to write a Date as "yyyy-mm-dd" which are then converted as a string. I have tried this but it works in oposite direction it seem. The idea is that the user enters a Start date and an End date with Console.ReadLine. Then these values are stored as strings in string A and B wich could then be used later. Is that possible? string A = string.Empty; string B = string

Storing file by creating datefolders and saving inside it

与世无争的帅哥 提交于 2019-12-13 09:23:50
问题 I want to store excel file Inside date folder which I will create dynamically. So I wrote the code Like below public void ExportExcel(string strWorkbookName, DataSet ds) { string strFilePath = ""; string strDateFolder = ""; try { using (XLWorkbook wb = new XLWorkbook()) { wb.Worksheets.Add(ds); //wb.SaveAs(ConfigurationRead.GetAppSetting("ReportDirectory") + "Report.xlsx"); strDateFolder = Directory.CreateDirectory(DateTime.Now.ToString("dd-MM-yyyy")); strFilePath = ConfigurationRead

c# console application unassigned local variable [duplicate]

霸气de小男生 提交于 2019-12-13 09:18:21
问题 This question already has answers here : What does “Use of unassigned local variable” mean? (10 answers) Closed 4 years ago . int ValueOne, ValueTwo, Numchar, Total; Console.WriteLine("This Is A Program For doing any Of the four mathematical Proccesses"); Console.WriteLine("You can Add , substract , Divide And Multiply"); Console.WriteLine("When Asked Please Type The Values Or The Proccesses You Want."); Console.WriteLine("Please Type The First Value"); ValueOne = Convert.ToInt32((Console

Json Api values 0 or false

你说的曾经没有我的故事 提交于 2019-12-13 08:39:00
问题 I am using a web JSON api to provide some values from a game market into c# objects. I am fairly new to c# and haven't worked with API's before. Heres my code: using System; using System.Net; using System.IO; using Newtonsoft.Json.Linq; using System.Collections.Generic; namespace HttpsApiTest { class Program { public class ForQuery { public static bool bid { get; set; } public static List<int> types { get; set; } public static List<object> regions { get; set; } public static List<object>

Using integer instead of decimal

这一生的挚爱 提交于 2019-12-13 08:19:53
问题 I'm having trouble with a particular homework assignment of mine. It almost seems impossible. The question goes like this... "In the future, you may work with other programming languages that do not have a type like decimal which supports precise monetary calculations. In those languages, you should perform such calculations using integers. Modify the application to use only integers to calculate the compound interest. Treat all monetary amounts as integral numbers of pennies. Then break the

Java : How to use scanner.hasNextLine without Ctrl+Z in a console program

亡梦爱人 提交于 2019-12-13 08:07:14
问题 Say I have the below code Scanner scanner = new Scanner(System.in); while (scanner.hasNextLine()) { line = scanner.nextLine(); //do something } And my input in the console is goes like this. Wayne Rooney Luis Nani Shinji Kagawa I want to read this line by line. But the problem is the method hasNextLine blocks waiting for the input after the third line as the input from the keyboard (System.in) never reaches EOF. Now, how do I reach EOF just by pressing enter key? because I don't want to tell

Trying to make a bookshelf console application but having some trouble with lists. (C# Beginner)

纵饮孤独 提交于 2019-12-13 07:50:14
问题 I am trying to make a bookshelf application but I am having trouble with using lists. What I am hoping for is after the user specifies how many books they would like to add, the for-loop should hopefully repeat the method in the specified amount. After the first run through of the method, the more titles added will add onto the list. class Shelf { public void Program() { Book book = new Book(); int bookAmount; Console.WriteLine("How many books are you adding."); bookAmount = int.Parse(Console