private void SaveBinary(ClassDataQR qRData, string pathFile) // บันทึกข้อมูลลงไปในไฟล์ ไบนารี่ { using (Stream stream = File.Open(pathFile, FileMode.Create)) { var binaryFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); binaryFormatter.Serialize(stream, qRData); stream.Close(); } }
private void SaveXml(ClassDataQR qRData, string pathFile) //สร้างฟังชั่นสำหรับบันทึกข้อมูลลงไฟล์ XML { using (StreamWriter strWriter = new StreamWriter(pathFile, false)) { var bs = new XmlSerializer(qRData.GetType()); //ใช้ข้อมูลจากคาสมาเขียน bs.Serialize(strWriter, qRData); } }
private void Form1_Load(object sender, EventArgs e) { //classDataQRBindingSource.DataSource = QRData; // TODO: This line of code loads data into the 'dBxDataSet.FLData' table. You can move, or remove it, as needed. this.fLDataTableAdapter.FillBy1(this.dBxDataSet.FLData, Properties.Settings.Default.McNo); labelVer.Text = Properties.Settings.Default.Version; menuStrip1.ForeColor = Color.White; string sourceFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "xmlData.txt"); // button1.BackgroundImage = test2.Properties.Resources.PictureBoxButtonLotEndGreen; เปลี่ยนรูปพื้นหลัง if (File.Exists(sourceFile)) { ClassDataQR classData = LoadXml(AppDomain.CurrentDomain.BaseDirectory + "/xmlData.txt"); ClassLog.SaveLog("Restore Lot ", "Lot No.:" + classData.LotNo, classData.McNo, classData.EmpNo); if (classData.LotSetting.HasValue == true) { labelStatus.Text = "Status : Wait Start Lot"; button1.Enabled = false; button1.BackgroundImage = test2.Properties.Resources.input_gray; buttonCancelLot.Visible = true; pictureBox1.Visible = true; pictureBox2.Visible = false; } if (classData.LotStart.HasValue == true) { labelStatus.Text = "Status : Lot Running"; buttonStart.Enabled = false; button1.Enabled = false; button1.BackgroundImage = test2.Properties.Resources.input_gray; buttonStart.BackgroundImage = test2.Properties.Resources.Start_gray; buttonCancelLot.Visible = false; pictureBox1.Visible = false; pictureBox2.Visible = true; } if (classData.LotClose.HasValue == true) { labelStatus.Text = "Status : Wait Setting Lot"; buttonLotEnd.Enabled = false; buttonStart.Enabled = false; buttonStart.BackgroundImage = test2.Properties.Resources.Start_gray; buttonLotEnd.BackgroundImage = test2.Properties.Resources.End_gray; button1.Enabled = true; button1.BackgroundImage = test2.Properties.Resources.input_blue; pictureBox1.Visible = false; pictureBox2.Visible = false; return; } QRData = classData; } classDataQRBindingSource.DataSource = QRData; }
private void button2_Click(object sender, EventArgs e) { ClassDataQR classData = LoadXml(AppDomain.CurrentDomain.BaseDirectory + "/xmlData.txt"); // ClassLog.SaveLog("Click Restore Lot Button", "Lot No.:" + classData.LotNo, classData.EmpNo); if (classData.LotStart.HasValue == true) { buttonStart.Enabled = false; button1.Enabled = false; } if (classData.LotClose.HasValue == true) { MessageBox.Show("Lot End : " + classData.LotClose); buttonLotEnd.Enabled = false; buttonStart.Enabled = false; button1.Enabled = true; return; } QRData = classData; ShowData(QRData); }
private void ShowData(ClassDataQR dataQR) { classDataQRBindingSource.ResetBindings(true); classDataQRBindingSource.DataSource = QRData; //Binding data from class }
public Form1() { InitializeComponent(); QRData = new ClassDataQR(); labelMcNo.Text = Properties.Settings.Default.McNo; }
public FormEmpEnd() { InitializeComponent(); DataQR = new ClassDataQR(); }
public FormEmpEnd(ClassDataQR data) { InitializeComponent(); DataQR = data; }
public FormInpuQty(ClassDataQR dataQR) { InitializeComponent(); DataQR = dataQR; }
public FormDataRecord(ClassDataQR qRData) { InitializeComponent(); DataQR = qRData; }
public FormInpuQty() { InitializeComponent(); DataQR = new ClassDataQR(); }
public FormScanEmp(ClassDataQR dataQR) { DataQR = dataQR; InitializeComponent(); }
public FormScanEmp() { InitializeComponent(); DataQR = new ClassDataQR(); }
public FormSetting(ClassDataQR dataQR) { InitializeComponent(); DataQR = dataQR; }
//public string LotNo { get; set; } public FormSetting() { InitializeComponent(); DataQR = new ClassDataQR(); }