AIParkingApplication.csproj - add class ExtensitionMethods. Util - Remove extensition methods.
This commit is contained in:
parent
740858693e
commit
d6d87b2ec8
|
@ -120,6 +120,7 @@
|
|||
<Compile Include="Camera.cs" />
|
||||
<Compile Include="EngineApiController.cs" />
|
||||
<Compile Include="Enums.cs" />
|
||||
<Compile Include="ExtensitionMethods.cs" />
|
||||
<Compile Include="IDoorControlAccess.cs" />
|
||||
<Compile Include="ILane.cs" />
|
||||
<Compile Include="LaneIn.cs">
|
||||
|
|
76
AIParkingApplication/ExtensitionMethods.cs
Normal file
76
AIParkingApplication/ExtensitionMethods.cs
Normal file
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AIParkingApplication
|
||||
{
|
||||
public static class ExtensitionMethods
|
||||
{
|
||||
public static void DisableSelected(this ToolStripMenuItem toolStripMenuItem)
|
||||
{
|
||||
toolStripMenuItem.Checked = true;
|
||||
toolStripMenuItem.Enabled = false;
|
||||
}
|
||||
|
||||
public static string GetTimeFormatted(this DateTime dateTime)
|
||||
{
|
||||
return dateTime.ToString(AppConstant.DATETIME_FORMAT);
|
||||
}
|
||||
|
||||
public static void UpdateImage(this PictureBox pictureBox, Bitmap image)
|
||||
{
|
||||
if (pictureBox.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pictureBox.Invoke(new Action(() =>
|
||||
{
|
||||
pictureBox.Image?.Dispose();
|
||||
pictureBox.Image = image;
|
||||
}));
|
||||
}
|
||||
|
||||
public static void UpdateLabel(this Label label, string text, Color backColor, Color foreColor)
|
||||
{
|
||||
if (label.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
label.Invoke(new Action(() =>
|
||||
{
|
||||
label.Text = text;
|
||||
label.BackColor = backColor;
|
||||
label.ForeColor = foreColor;
|
||||
}));
|
||||
}
|
||||
|
||||
public static void UpdateLabel(this Label label, string text, Color backColor)
|
||||
{
|
||||
if (label.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
label.Invoke(new Action(() =>
|
||||
{
|
||||
label.Text = text;
|
||||
label.BackColor = backColor;
|
||||
}));
|
||||
}
|
||||
|
||||
public static void UpdateLabel(this Label label, string text)
|
||||
{
|
||||
if (label.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
label.Invoke(new Action(() =>
|
||||
{
|
||||
label.Text = text;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,9 +6,7 @@ using System.Drawing;
|
|||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AIParkingApplication
|
||||
{
|
||||
|
@ -54,62 +52,6 @@ namespace AIParkingApplication
|
|||
return sf.GetMethod().Name;
|
||||
}
|
||||
|
||||
public static void UpdateImage(this PictureBox pictureBox, Bitmap image)
|
||||
{
|
||||
if (pictureBox.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pictureBox.Invoke(new Action(() =>
|
||||
{
|
||||
pictureBox.Image?.Dispose();
|
||||
pictureBox.Image = image;
|
||||
}));
|
||||
}
|
||||
|
||||
public static void UpdateLabel(this Label label, string text, Color backColor, Color foreColor)
|
||||
{
|
||||
if (label.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
label.Invoke(new Action(() =>
|
||||
{
|
||||
label.Text = text;
|
||||
label.BackColor = backColor;
|
||||
label.ForeColor = foreColor;
|
||||
}));
|
||||
}
|
||||
|
||||
public static void UpdateLabel(this Label label, string text, Color backColor)
|
||||
{
|
||||
if (label.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
label.Invoke(new Action(() =>
|
||||
{
|
||||
label.Text = text;
|
||||
label.BackColor = backColor;
|
||||
}));
|
||||
}
|
||||
|
||||
public static void UpdateLabel(this Label label, string text)
|
||||
{
|
||||
if (label.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
label.Invoke(new Action(() =>
|
||||
{
|
||||
label.Text = text;
|
||||
}));
|
||||
}
|
||||
|
||||
public static Bitmap ConvertFromBase64Image(string base64ImageString)
|
||||
{
|
||||
byte[] imageData = Convert.FromBase64String(base64ImageString);
|
||||
|
@ -120,11 +62,6 @@ namespace AIParkingApplication
|
|||
}
|
||||
}
|
||||
|
||||
public static string GetTimeFormatted(this DateTime dateTime)
|
||||
{
|
||||
return dateTime.ToString(AppConstant.DATETIME_FORMAT);
|
||||
}
|
||||
|
||||
public static void ExecuteCommand(string command)
|
||||
{
|
||||
var processInfo = new ProcessStartInfo("cmd.exe", "/c " + command);
|
||||
|
@ -198,12 +135,6 @@ namespace AIParkingApplication
|
|||
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tAddOrUpdateAppSettings\t{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public static void DisableSelected(this ToolStripMenuItem toolStripMenuItem)
|
||||
{
|
||||
toolStripMenuItem.Checked = true;
|
||||
toolStripMenuItem.Enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class PlateRequestEngineModel
|
||||
|
|
Loading…
Reference in New Issue
Block a user