Files
Mapo-IOB-WIN/IOB-WIN/MainForm.cs
T
2017-12-19 16:32:16 +01:00

107 lines
2.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AutoUpdaterDotNET;
using IOB_UT;
using NLog;
using NLog.Targets;
using NLog.Config;
namespace IOB_WIN
{
public partial class MainForm : Form
{
/// <summary>
/// URL stringa di UPDATE...
/// </summary>
protected string updateUrl
{
get
{
//string branchName = utils.CRS("appVers");
return string.Format("http://seriate.steamware.net:8083/SWS/MAPO/IOB-WIN/{0}/manifest.xml", branchName);
}
}
/// <summary>
/// Ramo applicazione (x update)
/// </summary>
protected string branchName = "develop";
public MainForm()
{
InitializeComponent();
myInit();
}
protected void myInit()
{
loadIniFile(utils.defConfFilePath);
}
/// <summary>
/// Carica file ini della configurazione richiesta
/// </summary>
/// <param name="iniConfFile"></param>
private void loadIniFile(string iniConfFile)
{
#if false
displayTaskAndLog(string.Format("Loading iniConfFile: {0}", iniConfFile));
#endif
IniFile fIni = new IniFile(iniConfFile);
// salvo branchName...
branchName = fIni.ReadString("BRANCH", "NAME", "develop");
// se NON sono in DEBUG faccio check update...
#if !(DEBUG)
// avvio autoupdater...
AutoUpdater.Start(updateUrl);
#endif
}
private void mCheckUpdates_Click(object sender, EventArgs e)
{
AutoUpdater.ShowSkipButton = false;
AutoUpdater.ShowRemindLaterButton = false;
AutoUpdater.Start(updateUrl);
}
protected void closeActiveChild()
{
if (this.HasChildren)
{
try
{
this.ActiveMdiChild.Close();
this.LayoutMdi(MdiLayout.TileHorizontal);
}
catch
{ }
}
}
protected void openChild()
{
TestForm child = new TestForm();
child.MdiParent = this;
child.Show();
this.LayoutMdi(MdiLayout.TileHorizontal);
}
private void closeChildToolStripMenuItem_Click(object sender, EventArgs e)
{
closeActiveChild();
}
private void openChildToolStripMenuItem_Click(object sender, EventArgs e)
{
openChild();
}
}
}