using System; using System.Windows.Forms; using Com.Piwigo.Lib.DTO; using System.Collections.Generic; using Com.Piwigo.Uploader.DTO; using Com.Piwigo.Uploader.Service; using Com.Piwigo.Uploader.Helper; using System.IO; namespace Com.Piwigo.Uploader { public partial class MainForm : Form { public MainForm() { InitializeComponent(); selectedPwgAlbumListBindingSource.DataSource = ModelManager.Instance.lstCat; modelManagerBaseBindingSource.DataSource = ModelManager.Instance; } private void MainForm_Load(object sender, EventArgs e) { string[] args = Environment.GetCommandLineArgs(); foreach (string arg in args) { if (Directory.Exists(arg)) { try { ModelManager.Instance.directoryName = arg; ServiceFactory.GetByType().runService(); } catch (ApplicationException aex) { MainAppHelper.showdErrorMessageBox(aex); } } } MainAppHelper.BuildAlbumTree(AlbumsTV, ModelManager.Instance.lstAlbumLocaux); } private void Connect_Click(object sender, EventArgs e) { try { String strUri= tbServer.Text.Replace("\\","/"); if (!strUri.StartsWith("http")) { strUri = "http://" + strUri; } if (!strUri.EndsWith("/ws.php")) { if (!strUri.EndsWith("/")) { strUri += "/"; } strUri += "ws.php"; } Uri uriServeur; if (Uri.TryCreate(strUri, UriKind.Absolute,out uriServeur)) { ModelManager.Instance.serveurName = uriServeur; ModelManager.Instance.userName = tbUser.Text; ModelManager.Instance.password = tbPassword.Text; ServiceFactory.GetByType().runService(); } } catch (ApplicationException aex) { MainAppHelper.showdErrorMessageBox(aex); } } private void Telecharger_Click(object sender, EventArgs e) { try { ServiceFactory.GetByType().runService(); } catch (ApplicationException aex) { MainAppHelper.showdErrorMessageBox(aex); } } private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { try { if (ModelManager.Instance.isConnected) { ServiceFactory.GetByType().runService(); } } catch (ApplicationException aex) { MainAppHelper.showdErrorMessageBox(aex); } } private void modelManagerBindingSource_CurrentChanged(object sender, EventArgs e) { } } }