Skip to content

Commit

Permalink
221106_1
Browse files Browse the repository at this point in the history
  • Loading branch information
Tynab committed Nov 6, 2022
1 parent 5aa0b97 commit 66733d7
Show file tree
Hide file tree
Showing 15 changed files with 561 additions and 197 deletions.
28 changes: 7 additions & 21 deletions Loginside FYAN Bot GUI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@
using System;
using System.Threading;
using static Loginside_FYAN_Bot_GUI.Properties.Resources;
using static Loginside_FYAN_Bot_GUI.Script.Constant;
using static System.GC;
using static System.IO.File;
using static System.Windows.Forms.Application;
using static System.Windows.Forms.MessageBoxButtons;
using static System.Windows.Forms.MessageBoxIcon;
using static YANF.Script.YANConstant.MsgBoxLang;
using static YANF.Script.YANMessageBox;

namespace Loginside_FYAN_Bot_GUI
{
Expand All @@ -21,23 +15,15 @@ internal static class Program
[STAThread]
private static void Main()
{
if (!Exists(CONFIG_ADR))
var mutex = new Mutex(true, app_name, out var result);
if (!result)
{
_ = Show("LỖI", "Quá trình cài đặt bot service không thành công!", OK, Error, VIE);
Exit();
}
else
{
var mutex = new Mutex(true, uniq_app_id, out var result);
if (!result)
{
return;
}
EnableVisualStyles();
SetCompatibleTextRenderingDefault(false);
Run(new FrmMain());
KeepAlive(mutex);
return;
}
EnableVisualStyles();
SetCompatibleTextRenderingDefault(false);
Run(new FrmMain());
KeepAlive(mutex);
}
}
}
18 changes: 9 additions & 9 deletions Loginside FYAN Bot GUI/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Loginside FYAN Bot GUI/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@
<value>Tmr_In</value>
<comment>tên setting timer check in</comment>
</data>
<data name="uniq_app_id" xml:space="preserve">
<value>TG9naW5zaWRlIEZZQU4gQm90</value>
<comment>id app duy nhất</comment>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="pOff" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pOff.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
Expand All @@ -176,4 +172,8 @@
<data name="sPress" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sPress.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="day_chg_pwd" xml:space="preserve">
<value>Day_Chg_Pwd</value>
<comment>ngày đổi password</comment>
</data>
</root>
54 changes: 27 additions & 27 deletions Loginside FYAN Bot GUI/Screen/FrmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 83 additions & 30 deletions Loginside FYAN Bot GUI/Screen/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
using static Loginside_FYAN_Bot_GUI.Script.Constant;
using static Loginside_FYAN_Bot_GUI.Script.Constant.ServSts;
using static System.Drawing.Color;
using static System.IO.File;
using static System.Windows.Forms.MessageBoxButtons;
using static System.Windows.Forms.MessageBoxIcon;
using static YANF.Script.YANConstant.MsgBoxLang;
using static YANF.Script.YANEvent;

namespace Loginside_FYAN_Bot_GUI.Screen
Expand Down Expand Up @@ -45,12 +49,17 @@ public FrmMain()
lbl.MouseMove += MoveFrm_MouseMove;
lbl.MouseUp += MoveFrm_MouseUp;
}
// option
GetServSyncDisp();
// display
nbInHour.Value = GetHourConfig(tmr_in);
nbInMin.Value = GetMinConfig(tmr_in);
nbOutHour.Value = GetHourConfig(tmr_out);
nbOutMin.Value = GetMinConfig(tmr_out);
txtId.String = _appConfigService.Getter(id_ins);
txtPwd.String = _appConfigService.Getter(pwd_ins);
txtSecKey.String = _appConfigService.Getter(sec_key);
txtPwdPrev.String = _appConfigService.Getter(pwd_prev);
var dayChgPwd = _appConfigService.Getter(day_chg_pwd);
nbDayChgPwd.Value = string.IsNullOrWhiteSpace(dayChgPwd) ? 15 : int.TryParse(dayChgPwd, out var _) ? decimal.Parse(dayChgPwd) : 15;
pnlMain.Select();
}
#endregion
Expand All @@ -59,12 +68,21 @@ public FrmMain()
// frm shown
private void FrmMain_Shown(object sender, EventArgs e)
{
// display effect
pnlMain.ShowAnimat(ScaleAndRotate, ANIMAT_SPD);
pnlIn.ShowAnimatAsync(VertSlide, ANIMAT_SPD);
pnlOut.ShowAnimatAsync(VertSlide, ANIMAT_SPD);
btnCl.ShowAnimatAsync(Rotate, ANIMAT_SPD);
pnlIns.ShowAnimatAsync(ScaleAndHorizSlide, ANIMAT_SPD);
GetServSyncDisp();
//sound
SND_PRS.Play();
// is missing data
if (!Exists(CONFIG_ADR))
{
YANMessageBox.Show("LỖI", "Quá trình cài đặt bot service không thành công!", OK, Error, VIE);
Close();
}
}

// frm closing
Expand All @@ -73,41 +91,80 @@ private void FrmMain_Shown(object sender, EventArgs e)
// btn Apply click
private void BtnAdm_Click(object sender, EventArgs e)
{
// sound
SND_NEXT.Play();

// set timer in
_appConfigService.Setter(tmr_in, nbInHour.Value.ToString("00") + ":" + nbInMin.Value.ToString("00"));
// set timer out
_appConfigService.Setter(tmr_out, nbOutHour.Value.ToString("00") + ":" + nbOutMin.Value.ToString("00"));
// set id
var sId = txtId.String;
if (!string.IsNullOrWhiteSpace(sId))
{
_appConfigService.Setter(id_ins, sId);
}
// set password
var sPwd = txtPwd.String;
if (!string.IsNullOrWhiteSpace(sPwd))
{
_appConfigService.Setter(pwd_ins, sPwd);
}
// set secret key
var sSecKey = txtSecKey.String;
if (!string.IsNullOrWhiteSpace(sSecKey))
{
_appConfigService.Setter(sec_key, sSecKey);
}
// set password preventive
var sPwdPrev = txtPwdPrev.String;
if (!string.IsNullOrWhiteSpace(sPwdPrev))
{
_appConfigService.Setter(pwd_prev, sPwdPrev);
}
// set day changed
_appConfigService.Setter(day_chg_pwd, nbDayChgPwd.Value.ToString());
// apply
RstServ(bot_name, TIME_OUT);
}

// btn Active click
private void BtnAct_Click(object sender, EventArgs e)
{
// sound
SND_NEXT.Play();
switch (GetServSts(serv_name))
// check status for action
switch (GetServSts(bot_name))
{
case Started:
{
StopServ(serv_name, TIME_OUT);
StopServ(bot_name, TIME_OUT);
break;
}
case Stoped:
{
StrtServ(serv_name, TIME_OUT);
StrtServ(bot_name, TIME_OUT);
break;
}
}
GetServSyncDisp();
// re-sync
GetServStsSyncBtn();
}

// btn Close click
private void BtnCl_Click(object sender, EventArgs e)
{
// action
Close();
// sound
SND_NEXT.PlaySync();
}

// Mod MoveFrm event
private void MoveFrmMod_MouseDown(object sender, MouseEventArgs e)
{
// base
MoveFrm_MouseDown(sender, e);
// sound
SND_CHG.Play();
}
#endregion
Expand All @@ -116,38 +173,34 @@ private void MoveFrmMod_MouseDown(object sender, MouseEventArgs e)
// Get service sync display
private void GetServSyncDisp()
{
var sts = GetServSts(serv_name);
if (sts == NotFd)
{
if (btnAdm.Visible)
{
btnAdm.HideAnimatAsync(Particles, ANIMAT_SPD);
}
if (btnAct.Visible)
{
btnAct.HideAnimatAsync(Particles, ANIMAT_SPD);
}
}
else
if (GetServSts(bot_name) != NotFd)
{
GetServStsSyncBtn();
// show btn apply
if (!btnAdm.Visible)
{
btnAdm.ShowAnimatAsync(VertBlind, ANIMAT_SPD);
}
// show btn active
if (!btnAct.Visible)
{
btnAct.ShowAnimatAsync(VertBlind, ANIMAT_SPD);
}
if (sts == Started)
{
btnAct.Text = "Dừng Bot";
btnAct.BackColor = FromArgb(56, 73, 89);
}
else
{
btnAct.Text = "Chạy Bot";
btnAct.BackColor = FromArgb(133, 193, 93);
}
}
}

// Get service status sync button active
private void GetServStsSyncBtn()
{
if (GetServSts(bot_name) == Started)
{
btnAct.Text = "Dừng Bot";
btnAct.BackColor = FromArgb(56, 73, 89);
}
else
{
btnAct.Text = "Chạy Bot";
btnAct.BackColor = FromArgb(133, 193, 93);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Loginside FYAN Bot GUI/Screen/FrmMain.resx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
<metadata name="panel4.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nbDateChgPwd.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="nbDayChgPwd.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
Expand Down
Loading

0 comments on commit 66733d7

Please sign in to comment.