- [C#] Hướng dẫn fix lỗi Visual Studio 2022 not Support Target Net Framework 4.5.2
- [C#] Giới thiệu thư viện Sunny UI thiết kế giao diện trên Winform
- [DATABASE] Hướng dẫn thêm và cập nhật Extended Property Column trong Table Sqlserver
- [DEVEXPRESS] Hướng dẫn sử dụng Vertical Gridview để hiển thị thông tin sản phẩm
- [C#] Hướng dẫn sử dụng Json Schema để Validate chuỗi string có phải json
- [C#] Hướng dẫn sử dụng công cụ Clean Code trên Visual Studio
- [C#] Hướng dẫn Drag and Drop File vào RichTextBox
- [C#] Hướng dẫn tạo hiệu ứng Karaoke Text Effect Winform
- [C#] Sử dụng thư viện ZedGraph vẽ biểu đồ Line, Bar, Pie trên Winform
- [DATABASE] Hướng dẫn sort sắp xếp địa chỉ IP trên sqlserver sử dụng hàm PARSENAME
- [C#] Theo dõi sử kiện process Start hay Stop trên Winform
- [ASP.NET] Chia sẻ source code chụp hình sử dụng camera trên website
- [C#] Chạy ứng dụng trên Virtual Desktop (màn hình ảo) Winform
- [C#] Mã hóa và giải mã Data Protection API trên winform
- [C#] Hướng dẫn tạo Gradient Background trên Winform
- [DATABASE] Hướng dẫn convert Epoch to DateTime trong sqlserver
- [DATABASE] Hướng dẫn sử dụng STRING_AGG và CONCAT_WS trong sqlserver 2017
- [C#] Hướng dẫn Copy With All Property in Class Object
- [DEVEXPRESS] Hướng dẫn load Json DataSource vào GridView
- [C#] Hướng dẫn tạo chữ ký trên winform Signature Pad
[DEVEXPRESS] Auto Demo Trainning ứng dụng Sử dụng thư viện Tutorials
Xin chào các bạn, bài viết hôm nay mình sẽ hướng dẫn các bạn viết một ứng dụng tự động trainning phần mềm sử dụng thư viện Tutorials của Devexpress C#.
[DEVEXPRESS] Auto Demo Tranning Application
Trong lập trình ứng dụng, khi các bạn bàn giao phần mềm, thì thường có phần hướng dẫn sử dụng và cách thao tác phần mềm.
Bài viết này, mình viết đơn giản khi click vào button Action Demo, thì phần mềm sẽ tự động và hướng dẫn sử dụng phần mềm.
Dưới đây, là phần mềm demo Auto Demo Trainning C#:
Những bước thực hiện dưới hình này này là tự động.
Để sử dụng được các bạn cần import thư viện: Devexpress.Tutorials.dll
vào nhé.
Trong thư viện này có một class ActiveDemo, cung cấp cho chúng ta các action: MouseMoveToPoint, MouseClick, MouseDoubleClick, MouseUp, MouseDown, SendString, SendKey...
với những hành động này, ta có thể sử dụng để cho phần mềm tự động chạy.
Và có sử dụng thuộc tính ActiveActions.Delay(1000);
để chờ thời gian thực hiện giữa các bước.
Code Auto Demo Tranning Application C#:
using DevExpress.ActiveDemos;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ActiveDemoApp
{
public partial class Form1 : DevExpress.XtraEditors.XtraForm
{
public Form1()
{
InitializeComponent();
}
ActiveDemo activedemo;
private void simpleButton1_Click(object sender, EventArgs e)
{
ClearTextBox();
activedemo = new ActiveDemo();
var point = new Point(10, txt_name.Height / 2);
activedemo.ShowMessage("Bắt đầu thêm thông tin.");
activedemo.Actions.MoveMousePointTo(txt_name, point);
activedemo.Actions.MouseClick(txt_name, point);
activedemo.ShowMessage("Nhập họ và tên.");
activedemo.Actions.Dispose();
SendKeys.SendWait("Nguyễn Thảo");
point = new Point(10, txt_job.Height / 2);
activedemo.Actions.MoveMousePointTo(txt_job, point);
activedemo.Actions.MouseClick(txt_job, point);
activedemo.ShowMessage("Nhập ngành nghề.");
ActiveActions.Delay(1000);
SendKeys.SendWait("Cài Win dạo, code dạo...");
ActiveActions.Delay(1000);
point = new Point(10, txt_address.Height / 2);
activedemo.Actions.MoveMousePointTo(txt_address, point);
activedemo.Actions.MouseClick(txt_address, point);
activedemo.ShowMessage("Nhập địa chỉ vào đây.");
ActiveActions.Delay(1000);
SendKeys.SendWait("Trung Thành, Quảng Thành, Châu Đức, Bà Rịa Vũng Tàu");
ActiveActions.Delay(1000);
point = new Point(10, txt_email.Height / 2);
activedemo.Actions.MoveMousePointTo(txt_email, point);
activedemo.Actions.MouseClick(txt_email, point);
activedemo.ShowMessage("Nhập địa chỉ email");
ActiveActions.Delay(1000);
SendKeys.SendWait("nguyenthao_it@hotmail.com.vn");
ActiveActions.Delay(1000);
point = new Point(10, txt_phone.Height / 2);
activedemo.Actions.MoveMousePointTo(txt_phone, point);
activedemo.Actions.MouseClick(txt_phone, point);
activedemo.ShowMessage("Nhập số điện thoại");
ActiveActions.Delay(1000);
SendKeys.SendWait("0933913122");
}
private void ClearTextBox()
{
txt_name.Text = "";
txt_job.Text = "";
txt_email.Text = "";
txt_address.Text = "";
txt_phone.Text = "";
}
}
}
Thanks for watching!