using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace ЭкранПотребителя
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Screen[] sc = Screen.AllScreens;
Form1 fr1 = new Form1();
fr1.Location = sc[0].Bounds.Location;
Application.EnableVisualStyles();
string path = @"C:\Users\inbox\OneDrive\Рабочий стол\Учеба С шарп\ЭкранПотребителя\ЭкранПотребителя\bin\Debug";
string filename = "*.txt";
FileSystemWatcher watcher = new FileSystemWatcher(path, filename);
watcher.NotifyFilter = NotifyFilters.Attributes
| NotifyFilters.CreationTime
| NotifyFilters.DirectoryName
| NotifyFilters.FileName
| NotifyFilters.LastAccess
| NotifyFilters.LastWrite
| NotifyFilters.Security
| NotifyFilters.Size;
watcher.Changed += OnChanged;
watcher.Created += OnCreated;
watcher.Deleted += OnDeleted;
watcher.Filter = "*.txt";
watcher.IncludeSubdirectories = true;
watcher.EnableRaisingEvents = true;
}
}
public class Reader
{
public static string read1()
{
string[] st = File.ReadAllLines("p.txt");
return st[0];
}
public static string read2()
{
string[] st = File.ReadAllLines("p.txt");
return st[1];
}
}
}
using System;
using System.IO;
namespace ЭкранПотребителя
{
public partial class Form1
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором форм Windows
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
public void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.product = new System.Windows.Forms.Label();
this.Itog = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.ImageLocation = "";
this.pictureBox1.Location = new System.Drawing.Point(37, 106);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(950, 556);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// product
//
this.product.Font = new System.Drawing.Font("Calibri", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.product.Location = new System.Drawing.Point(0, 21);
this.product.Name = "product";
this.product.Size = new System.Drawing.Size(1024, 62);
this.product.TabIndex = 1;
this.product.Text = "label1";
this.product.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.product.Visible = false;
//
// Itog
//
this.Itog.Font = new System.Drawing.Font("Calibri", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.Itog.Location = new System.Drawing.Point(0, 684);
this.Itog.Name = "Itog";
this.Itog.Size = new System.Drawing.Size(1024, 62);
this.Itog.TabIndex = 2;
this.Itog.Text = "label1";
this.Itog.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.Itog.Visible = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1024, 768);
this.Controls.Add(this.Itog);
this.Controls.Add(this.product);
this.Controls.Add(this.pictureBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form1";
this.Text = "Главное окно";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
public void OnChanged(object sender, FileSystemEventArgs e)
{
string st = Reader.read1();
string st2 = Reader.read2();
this.product.Text = st;
this.Itog.Text = st2;
}
public void OnCreated(object sender, FileSystemEventArgs e)
{
string st = Reader.read1();
string st2 = Reader.read2();
this.product.Text = st;
this.Itog.Text = st2;
this.product.Visible = true;
this.Itog.Visible = true;
}
public void OnDeleted(object sender, FileSystemEventArgs e)
{
this.product.Text = "";
this.Itog.Text = "";
this.product.Visible = false;
this.Itog.Visible = false;
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label product;
private System.Windows.Forms.Label Itog;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace ЭкранПотребителя
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Screen[] sc = Screen.AllScreens;
Form1 fr1 = new Form1();
fr1.Location = sc[0].Bounds.Location;
Application.EnableVisualStyles();
string path = @"C:\Users\inbox\OneDrive\Рабочий стол\Учеба С шарп\ЭкранПотребителя\ЭкранПотребителя\bin\Debug";
string filename = "p.txt";
FileSystemWatcher watcher = new FileSystemWatcher(path, filename);
watcher.NotifyFilter = NotifyFilters.Attributes
| NotifyFilters.CreationTime
| NotifyFilters.DirectoryName
| NotifyFilters.FileName
| NotifyFilters.LastAccess
| NotifyFilters.LastWrite
| NotifyFilters.Security
| NotifyFilters.Size;
watcher.Changed += OnChanged;
watcher.Created += OnCreated;
watcher.Deleted += OnDeleted;
watcher.Filter = "*.txt";
watcher.IncludeSubdirectories = true;
watcher.EnableRaisingEvents = true;
}
private static void OnChanged(object sender, FileSystemEventArgs e)
{
}
private static void OnCreated(object sender, FileSystemEventArgs e)
{
}
private static void OnDeleted(object sender, FileSystemEventArgs e)
{
}
}
public class Reader
{
public string read1()
{
string[] st = File.ReadAllLines("p.txt");
return st[0];
}
public string read2()
{
string[] st = File.ReadAllLines("p.txt");
return st[1];
}
}
}
namespace ЭкранПотребителя
{
partial class Form1
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Код, автоматически созданный конструктором форм Windows
/// <summary>
/// Требуемый метод для поддержки конструктора — не изменяйте
/// содержимое этого метода с помощью редактора кода.
/// </summary>
public void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.product = new System.Windows.Forms.Label();
this.Itog = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.ImageLocation = "";
this.pictureBox1.Location = new System.Drawing.Point(37, 106);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(950, 556);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// product
//
this.product.Font = new System.Drawing.Font("Calibri", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.product.Location = new System.Drawing.Point(0, 21);
this.product.Name = "product";
this.product.Size = new System.Drawing.Size(1024, 62);
this.product.TabIndex = 1;
this.product.Text = "label1";
this.product.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.product.Visible = false;
//
// Itog
//
this.Itog.Font = new System.Drawing.Font("Calibri", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.Itog.Location = new System.Drawing.Point(0, 684);
this.Itog.Name = "Itog";
this.Itog.Size = new System.Drawing.Size(1024, 62);
this.Itog.TabIndex = 2;
this.Itog.Text = "label1";
this.Itog.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.Itog.Visible = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1024, 768);
this.Controls.Add(this.Itog);
this.Controls.Add(this.product);
this.Controls.Add(this.pictureBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "Form1";
this.Text = "Главное окно";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label product;
private System.Windows.Forms.Label Itog;
}
}
Надеюсь вы не глупы, чтобы понять вышесказанное.