Запуск графической программы с параметрами из командной строки - C#
Формулировка задачи:
Пишу примитивный нотифер, нужно что бы через консоль можно было передавать текст в label и listbox. И почему-то не работает анимация плавного закрытия программы.
Если все раскомментировать, но запинается на одной ошибке:
using System;
using System.Drawing;
using System.Windows.Forms;
namespace notification
{
public partial class notificationForm : Form
{
public string ncaption;
public string ntext;
public notificationForm() //(string [] args)
{
InitializeComponent();
this.StartPosition = FormStartPosition.Manual;
this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - this.Width - 20, Screen.PrimaryScreen.Bounds.Height - this.Height - 20);
// string ncaption = args[0];
//string ntext = args[1];
}
private void start()
{
Opacity = 0;
System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer();
timer1.Tick += new EventHandler((sender1, e1) =>
{
if ((Opacity += 0.05) == 1)
timer1.Stop();
});
timer1.Interval = 1;
timer1.Start();
}
private void stop()
{
Opacity = 1;
System.Windows.Forms.Timer timer2 = new System.Windows.Forms.Timer();
timer2.Tick -= new EventHandler((sender2, e2) =>
{
if ((Opacity -= 0.05) == 0)
timer2.Stop();
});
timer2.Interval = 1;
timer2.Start();
this.Close();
}
private void notificationForm_Load(object sender, EventArgs e)
{
// CaptionLabel.Text = ncaption;
// notificationText.Text = ntext;
start();
}
private void timer1_Tick(object sender, EventArgs e)
{
stop();
}
}
}Ошибка CS7036 Отсутствует аргумент, соответствующий требуемому формальному параметру "args" из "notificationForm.notificationForm(string[])". notification C:\Users\kondratiev_ms\Documents\Visual Studio 2015\Projects\notification\notification\Program.cs 19 Активно
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace notification
{
static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new notificationForm()); // <---
}
}
}Решение задачи: «Запуск графической программы с параметрами из командной строки»
textual
Листинг программы
CaptionLabel.Text = arguments [1]; notificationText.Text = arguments[2];