Files
cms_thermo_active/Step.Client/Browser_Tools/BrowserJSObject.cs
T
CMS3762\carminatini 2a28a201be Added C# CMS Client
2017-12-01 16:51:09 +01:00

131 lines
3.6 KiB
C#

using CefSharp;
using CMS_Client.Config;
using CMS_Client.View;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CMS_Client.Browser_Tools
{
public class BrowserJSObject
{
//The first letter of All PUBLIC Variables and Methods must be Lower-Case (CEF Settings)
private MainForm mainForm;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region CONSTRUCTOR_METHOD
//Constructor Method
public BrowserJSObject(MainForm f)
{
mainForm = f;
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region FORM_BEHAVIOUR_METHODS
//Minimize Main Window
public void minimizeForm()
{
//Invoke method if is needed or call the method in STD mode
if (mainForm.InvokeRequired)
mainForm.Invoke((MethodInvoker)delegate () {
mainForm.WindowState = FormWindowState.Minimized;
});
else
{
mainForm.WindowState = FormWindowState.Minimized;
}
}
//Maximize Main Window
public void maximizeForm()
{
//Invoke method if is needed or call the method in STD mode
if (mainForm.InvokeRequired)
mainForm.Invoke((MethodInvoker)delegate () {
mainForm.WindowState = FormWindowState.Maximized;
});
else
{
mainForm.WindowState = FormWindowState.Maximized;
}
}
//Close Main Window
public void closeForm()
{
//If the mainform is disposed do nothing
if (mainForm.IsDisposed)
return;
//Invoke method if is needed or call the method in STD mode
if (mainForm.InvokeRequired)
mainForm.Invoke((MethodInvoker)delegate () {
mainForm.Close();
});
else
{
mainForm.Close();
}
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region NC_BEHAVIOUR_METHODS
//Move NC Window
public void moveNcWindow(int X,int Y)
{
if (CMSConfiguration.HMINcPresent)
NcWindow.MoveNcWindow(X, Y);
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region CHROMIUM_METHODS
//Get the Version of Chromium
public String getChromiumVersion()
{
return Cef.ChromiumVersion;
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#region STEP_METHODS
//Get the ID of STEP Client
public ushort getClientID()
{
return CMSConfiguration.IDClient;
}
public void forceStepFocus()
{
NcWindow.ForceStepFocus();
}
#endregion
}
}