Skip to content

Commit

Permalink
Bug fixes and small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mihaifm committed Nov 13, 2022
1 parent e3ed153 commit 2add207
Show file tree
Hide file tree
Showing 17 changed files with 3,600 additions and 419 deletions.
26 changes: 16 additions & 10 deletions ElegantRecorder/AutomationEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public virtual bool FillMouseMoveAction(ref UIAction uiAction, ref string status

RECT boundingRect = new RECT();

if (App.ElegantOptions.MouseMoveRelative)
if (App.Options.MouseMoveRelative)
{
if (activeWinHwnd != IntPtr.Zero)
boundingRect = App.WinAPI.GetBoundingRect(activeWinHwnd);
Expand Down Expand Up @@ -81,27 +81,27 @@ public virtual void ReplayAction(UIAction action, ref string status)
if (action.EventType == "click")
{
result = ReplayClickAction(action, ref status);
App.PlayAction();
App.PlayAction(result);
}
else if (action.EventType == "mousemove")
{
result = ReplayMouseMoveAction(action, ref status);
App.PlayAction();
App.PlayAction(result);
}
else if (action.EventType == "mousewheel")
{
result = ReplayMouseWheelAction(action, ref status);
App.PlayAction();
App.PlayAction(result);
}
else if (action.EventType == "keypress")
{
result = ReplayKeypressAction(action, ref status);
App.PlayAction();
App.PlayAction(result);
}
else if (action.EventType == "clipboard")
{
result = ReplayClipboardAction(action, ref status);
App.PlayAction();
App.PlayAction(result);
}
else if (action.EventType == "mousepath")
{
Expand All @@ -117,7 +117,7 @@ public virtual bool ReplayMouseMoveAction(UIAction action, ref string status)

RECT boundingRect = new RECT();

if (App.ElegantOptions.MouseMoveRelative && activeWinHwnd != IntPtr.Zero)
if (App.Options.MouseMoveRelative && activeWinHwnd != IntPtr.Zero)
{
boundingRect = App.WinAPI.GetBoundingRect(activeWinHwnd);
}
Expand Down Expand Up @@ -151,13 +151,19 @@ private void PlayMousePathStep()
{
mousePathTimer.Stop();

if (App.ReplayInterrupted)
{
App.PlayAction(true);
return;
}

currentMousePathStep++;

if (currentMousePathStep <= mousePathAction.MoveData.Length - 1)
{
if (mousePathAction.MoveData[currentMousePathStep].T > 0)
{
mousePathTimer.Interval = ElegantOptions.GetPlaybackSpeed(App.ElegantOptions.PlaybackSpeed, mousePathAction.MoveData[currentMousePathStep].T);
mousePathTimer.Interval = Options.GetPlaybackSpeed(App.Options.PlaybackSpeed, mousePathAction.MoveData[currentMousePathStep].T);
mousePathTimer.Start();
}
else
Expand All @@ -167,13 +173,13 @@ private void PlayMousePathStep()
}
else
{
App.PlayAction();
App.PlayAction(true);
}
}

private void MousePathTimer_Tick(object? sender, EventArgs e)
{
if (App.ElegantOptions.MouseMoveRelative)
if (App.Options.MouseMoveRelative)
{
if (currentMousePathStep == 0)
{
Expand Down
95 changes: 95 additions & 0 deletions ElegantRecorder/ElegantMessage.Designer.cs

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

48 changes: 48 additions & 0 deletions ElegantRecorder/ElegantMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Windows.Forms;

namespace ElegantRecorder
{
public partial class ElegantMessage : Form
{
public ElegantMessage()
{
InitializeComponent();
}

public static DialogResult Show(string message, string caption = "Elegant Message")
{
var elegantMessage = new ElegantMessage();
elegantMessage.Text = caption;
elegantMessage.labelMessage.Text = message;
elegantMessage.TopMost = true;
elegantMessage.labelMessage.Left = (elegantMessage.Width - elegantMessage.labelMessage.Width) / 2;
return elegantMessage.ShowDialog();
}

public static DialogResult Info(string message, string caption = "Elegant Message")
{
var elegantMessage = new ElegantMessage();
elegantMessage.Text = caption;
elegantMessage.labelMessage.Text = message;
elegantMessage.TopMost = true;
elegantMessage.labelMessage.Left = (elegantMessage.Width - elegantMessage.labelMessage.Width) / 2;

elegantMessage.buttonOk.Left = (elegantMessage.Width - elegantMessage.buttonOk.Width) / 2;
elegantMessage.Controls.Remove(elegantMessage.buttonCancel);
return elegantMessage.ShowDialog();
}

private void buttonCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}

private void buttonOk_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
Close();
}
}
}
File renamed without changes.
Loading

0 comments on commit 2add207

Please sign in to comment.