diff --git a/IOB-WIN/IOB-UT/baseUtils.cs b/IOB-WIN/IOB-UT/baseUtils.cs
index 5efd26d..a4838e5 100644
--- a/IOB-WIN/IOB-UT/baseUtils.cs
+++ b/IOB-WIN/IOB-UT/baseUtils.cs
@@ -572,18 +572,18 @@ namespace IOB_UT
public enum tipoAdapter
{
- ///
- /// Adapter DB
- ///
- DB,
+ /////
+ ///// Adapter DB
+ /////
+ //DB,
///
/// Adapter generico/demo
///
DEMO,
- ///
- /// Adapter ESAGV (SCM)
- ///
- ESAGV,
+ /////
+ ///// Adapter ESAGV (SCM)
+ /////
+ //ESAGV,
///
/// adapter FANUC (CMS)
///
@@ -592,10 +592,10 @@ namespace IOB_UT
/// Adapter non specificato
///
ND,
- ///
- /// Adapter OSAI
- ///
- OSAI,
+ /////
+ ///// Adapter OSAI
+ /////
+ //OSAI,
///
/// Adapter SIEMENS (CMS)
///
diff --git a/IOB-WIN/IOB-WIN/App.config b/IOB-WIN/IOB-WIN/App.config
index 5057b59..38ef20f 100644
--- a/IOB-WIN/IOB-WIN/App.config
+++ b/IOB-WIN/IOB-WIN/App.config
@@ -5,7 +5,6 @@
-
diff --git a/IOB-WIN/IOB-WIN/DATA/CONF/IOB.ini b/IOB-WIN/IOB-WIN/DATA/CONF/IOB.ini
index c38b1d1..297c6a0 100644
--- a/IOB-WIN/IOB-WIN/DATA/CONF/IOB.ini
+++ b/IOB-WIN/IOB-WIN/DATA/CONF/IOB.ini
@@ -1,11 +1,12 @@
-[IOB]
-CNC_TYPE=FANUC
+;Configurazione IOB-WIN
+[IOB]
+CNCTYPE=FANUC
[CNC]
IP=127.0.0.1
PORT=8193
[MEMORY]
-BIT_RED=Y8.4
-BIT_YELLOW=Y8.5
-BIT_GREEN=Y8.6
\ No newline at end of file
+BITRED=Y8.4
+BITYELLOW=Y8.5
+BITGREEN=Y8.6
\ No newline at end of file
diff --git a/IOB-WIN/IOB-WIN/IOB-WIN.csproj b/IOB-WIN/IOB-WIN/IOB-WIN.csproj
index cf329fe..0be1b82 100644
--- a/IOB-WIN/IOB-WIN/IOB-WIN.csproj
+++ b/IOB-WIN/IOB-WIN/IOB-WIN.csproj
@@ -83,7 +83,9 @@
Always
-
+
+ Always
+
Designer
diff --git a/IOB-WIN/IOB-WIN/MainForm.Designer.cs b/IOB-WIN/IOB-WIN/MainForm.Designer.cs
index e8b2fae..00b8d1f 100644
--- a/IOB-WIN/IOB-WIN/MainForm.Designer.cs
+++ b/IOB-WIN/IOB-WIN/MainForm.Designer.cs
@@ -38,9 +38,10 @@
this.lblStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.FileTSMI = new System.Windows.Forms.ToolStripMenuItem();
- this.lOADADAPTERCONFToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.mLoadConf = new System.Windows.Forms.ToolStripMenuItem();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.trayMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.lblCurrIOB = new System.Windows.Forms.Label();
this.statusStrip1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@@ -104,18 +105,19 @@
// FileTSMI
//
this.FileTSMI.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.lOADADAPTERCONFToolStripMenuItem});
+ this.mLoadConf});
this.FileTSMI.Name = "FileTSMI";
this.FileTSMI.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F)));
this.FileTSMI.Size = new System.Drawing.Size(47, 24);
this.FileTSMI.Text = "&FILE";
//
- // lOADADAPTERCONFToolStripMenuItem
+ // mLoadConf
//
- this.lOADADAPTERCONFToolStripMenuItem.Name = "lOADADAPTERCONFToolStripMenuItem";
- this.lOADADAPTERCONFToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.L)));
- this.lOADADAPTERCONFToolStripMenuItem.Size = new System.Drawing.Size(282, 26);
- this.lOADADAPTERCONFToolStripMenuItem.Text = "LOAD ADAPTER CONF";
+ this.mLoadConf.Name = "mLoadConf";
+ this.mLoadConf.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.L)));
+ this.mLoadConf.Size = new System.Drawing.Size(214, 26);
+ this.mLoadConf.Text = "LOAD CONF";
+ this.mLoadConf.Click += new System.EventHandler(this.mLoadConf_Click);
//
// notifyIcon1
//
@@ -128,14 +130,27 @@
//
this.trayMenu.ImageScalingSize = new System.Drawing.Size(20, 20);
this.trayMenu.Name = "trayMenu";
- this.trayMenu.Size = new System.Drawing.Size(176, 32);
+ this.trayMenu.Size = new System.Drawing.Size(61, 4);
this.trayMenu.ItemClicked += new System.Windows.Forms.ToolStripItemClickedEventHandler(this.trayMenu_ItemClicked);
//
+ // lblCurrIOB
+ //
+ this.lblCurrIOB.Dock = System.Windows.Forms.DockStyle.Top;
+ this.lblCurrIOB.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblCurrIOB.Location = new System.Drawing.Point(0, 28);
+ this.lblCurrIOB.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+ this.lblCurrIOB.Name = "lblCurrIOB";
+ this.lblCurrIOB.Size = new System.Drawing.Size(643, 32);
+ this.lblCurrIOB.TabIndex = 65;
+ this.lblCurrIOB.Text = "IOB loaded: N.A.";
+ this.lblCurrIOB.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ //
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(643, 468);
+ this.Controls.Add(this.lblCurrIOB);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
@@ -166,6 +181,7 @@
private System.Windows.Forms.ToolStripStatusLabel lblComStats;
private System.Windows.Forms.ToolStripStatusLabel lblStatus;
private System.Windows.Forms.ToolStripMenuItem FileTSMI;
- private System.Windows.Forms.ToolStripMenuItem lOADADAPTERCONFToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem mLoadConf;
+ private System.Windows.Forms.Label lblCurrIOB;
}
}
\ No newline at end of file
diff --git a/IOB-WIN/IOB-WIN/MainForm.cs b/IOB-WIN/IOB-WIN/MainForm.cs
index 1a7bc27..cc45225 100644
--- a/IOB-WIN/IOB-WIN/MainForm.cs
+++ b/IOB-WIN/IOB-WIN/MainForm.cs
@@ -44,7 +44,7 @@ namespace IOB_WIN
///
/// timer base in avvio
///
- protected int startTimerMs = 250;
+ protected int startTimerMs = 250;
///
/// ultimo tentativo riavvio...
///
@@ -124,6 +124,9 @@ namespace IOB_WIN
#region gestione form e visibilità
+ ///
+ /// Avvio MainForm
+ ///
public MainForm()
{
InitializeComponent();
@@ -179,8 +182,8 @@ namespace IOB_WIN
tipoScelto = tipoAdapter.ND;
#if false
adpConf = new AdapterConf();
- loadAdapterType();
#endif
+ loadAdapterType();
displayTaskAndWait("Waiting for config file selection");
}
@@ -201,16 +204,24 @@ namespace IOB_WIN
WindowState = FormWindowState.Minimized;
}
displayTaskAndWait("Minimized");
- }
+ }
displayTaskAndWait("Main Form OK");
}
-
+ ///
+ /// Fase chiusura Form
+ ///
+ ///
+ ///
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
closeAdapter();
}
-
+ ///
+ /// Mostrata form
+ ///
+ ///
+ ///
private void MainForm_Shown(object sender, EventArgs e)
{
// avvio minimizzato se richiesto
@@ -221,11 +232,20 @@ namespace IOB_WIN
}
displayTaskAndWait("Main Form SHOWN");
}
-
+ ///
+ /// COmpletato resize form
+ ///
+ ///
+ ///
private void MainForm_Resize(object sender, EventArgs e)
{
checkFormVisibility();
}
+
+ #endregion
+
+ #region gestione tray
+
///
/// crea menù tray x applicazione
///
@@ -318,6 +338,14 @@ namespace IOB_WIN
}
}
}
+
+ #endregion
+
+ #region gestione metodi specifici FORM
+
+ ///
+ /// Chiusura adapter
+ ///
private void closeAdapter()
{
fermaTutto(true, false);
@@ -348,7 +376,131 @@ namespace IOB_WIN
#endif
}
}
+
+ ///
+ /// Carica file ini della configurazione richiesta
+ ///
+ ///
+ private void loadIniFile(string iniConfFile)
+ {
+ displayTaskAndWait(string.Format("Loading iniConfFile: {0}", iniConfFile));
+
+ IniFile fIni = new IniFile(iniConfFile);
+
+ tipoScelto = (tipoAdapter)Enum.Parse(typeof(tipoAdapter), fIni.ReadString("IOB", "CNCTYPE", "DEMO"));
+ string IP = fIni.ReadString("CNC", "IP", "ND");
+ string PORT = fIni.ReadString("CNC", "PORT", "ND");
+ lblCurrIOB.Text= string.Format("CNC {0} ({1}:{2})", tipoScelto,IP, PORT);
+#if false
+ // Read the configuration object from a file
+ adpConf = AdapterConf.Deserialize(iniConfFile);
+
+ // indico quale sia il tipo di adapter
+ tipoScelto = adpConf.TipoAdapt;
+#endif
+ loadAdapterType();
+#if false
+ // carico file XML in web browser...
+ wbXmlConf.DocumentText = AdapterConf.rawXml(iniConfFile);
+ displayTaskAndWait("XML loaded");
+
+#endif
+ // avvio macchina con adapter specificato...
+ if (utils.CRB("autoStartOnLoad"))
+ {
+ displayTaskAndWait("Auto Starting...");
+#if false
+ // avvio!
+ avviaAdapter();
+#endif
+ displayTaskAndWait("Auto Started!");
+ }
+ }
+
#endregion
+ private void mLoadConf_Click(object sender, EventArgs e)
+ {
+ // mostro selettore file x leggere adapter..
+ OpenFileDialog openFileDial = new OpenFileDialog();
+
+ // directory iniziale
+ openFileDial.InitialDirectory = utils.confDir; // string.Format(@"{0}\{1}", Application.StartupPath, utils.CRS("dataConfPath"));
+ // Set filter options and filter index.
+ openFileDial.Filter = "INI Files (.ini)|*.ini|All Files (*.*)|*.*";
+ openFileDial.FilterIndex = 1;
+ // altre opzioni
+ openFileDial.Multiselect = false;
+
+ // Call the ShowDialog method to show the dialog box.
+ DialogResult userClickedOK = openFileDial.ShowDialog();
+
+ // Process input if the user clicked OK.
+ if (userClickedOK == DialogResult.OK)
+ {
+ string iniConfFile = openFileDial.FileName;
+ loadIniFile(iniConfFile);
+ lg.Info("INI LOADED");
+#if false
+ loadPersistLayer(defPersLayerFile);
+ lg.Info("PersLayerFile READ");
+ agObj.loadPersData();
+ lg.Info("PersLayerFile LOADED");
+#endif
+ }
+ }
+
+ ///
+ /// carica adapter richiesto
+ ///
+ private void loadAdapterType()
+ {
+ //switch (tipoScelto)
+ //{
+ // case tipoAdapter.DEMO:
+ // agObj = new AdapterDemo(this, adpConf);
+ // EnableTab(tabCtrlMain.TabPages[1], true);
+ // EnableTab(tabCtrlMain.TabPages[2], true);
+ // start.Enabled = true;
+ // break;
+ // case tipoAdapter.ESAGV:
+ // agObj = new AdapterESA(this, adpConf);
+ // EnableTab(tabCtrlMain.TabPages[1], true);
+ // EnableTab(tabCtrlMain.TabPages[2], false);
+ // start.Enabled = true;
+ // break;
+ // case tipoAdapter.FANUC:
+ // agObj = new AdapterFanuc(this, adpConf);
+ // EnableTab(tabCtrlMain.TabPages[1], true);
+ // EnableTab(tabCtrlMain.TabPages[2], false);
+ // start.Enabled = true;
+ // break;
+ // case tipoAdapter.OSAI:
+ // agObj = new AdapterOsai(this, adpConf);
+ // EnableTab(tabCtrlMain.TabPages[1], true);
+ // EnableTab(tabCtrlMain.TabPages[2], false);
+ // start.Enabled = true;
+ // break;
+ // case tipoAdapter.SIEMENS:
+ // agObj = new AdapterSiemens(this, adpConf);
+ // EnableTab(tabCtrlMain.TabPages[1], true);
+ // EnableTab(tabCtrlMain.TabPages[2], false);
+ // start.Enabled = true;
+ // break;
+ // case tipoAdapter.ND:
+ // default:
+ // agObj = new AdapterDemo(this, adpConf);
+ // EnableTab(tabCtrlMain.TabPages[1], false);
+ // EnableTab(tabCtrlMain.TabPages[2], false);
+ // start.Enabled = false;
+ // break;
+ //}
+ //lblCurrAdapt.Text = string.Format("Adapter loaded: {0}", tipoScelto.ToString().ToUpper());
+
+ //// carico i default values su interfaccia
+ //setDefaults();
+
+ displayTaskAndWait(string.Format("Caricata conf per adapter {0}", tipoScelto));
+ }
}
}