private void Form1_Load(object sender, EventArgs e) { #if !DEBUG // TopMost = true; fonctionne pas :( SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS); #endif try { string[] args = Environment.GetCommandLineArgs(); if (args.Length < 3) { throw new Exception("Nombre d'argument insuffisant"); } doPiece = args[3]; BaseCialAbstract.setDefaultParams(args[1], args[2]); InterMagRepos = new InterMagRepository(); InterMagRepos.Log += new InterMagRepository.LogEventHandler(Log); Text = label1.Text = "Envoi de la commande " + doPiece; DbSelector.DataSource = InterMagRepos.getDbListFromContext().Where(d => d.name != InterMagRepos.dbName && d.isMag == true).ToList(); DbSelector.DisplayMember = "name"; DbSelector.ValueMember = "name"; // Récupère la commande Log("Vérification de la commande..."); dsCde = InterMagRepos.getCommande(doPiece); string message = InterMagRepos.valideCommande(dsCde.Tables[0]); if (message != String.Empty) { Log($"{InterMagRepos.dbName}::Erreur Doc {doPiece} : {message}"); } else { Log("Commande OK."); EnvoyerBtn.Enabled = true; DbSelector.Enabled = true; typeCde = InterMagRepos.getTypeCde(dsCde); if (typeCde == InterMagRepository.TYPE_DEPOT) { // Auto selectionne le magasin cible sur une commande dépot DbSelector.SelectedIndex = DbSelector.FindString((string)dsCde.Tables[0].Rows[0]["CT_Classement"]); DbSelector.Enabled = false; } typeCdelabel.Text = InterMagRepos.typeCdeLabels[typeCde]; string MagRef = (string)dsCde.Tables[0].Rows[0]["magasin_referent"]; MagReflabel.Text = ""; if (typeCde == InterMagRepository.TYPE_RETRO && MagRef != "") { // Auto selectionne le magasin cible sur une commande rétro MagReflabel.Text = (string)dsCde.Tables[0].Rows[0]["magasin_referent"]; #if DEBUG MagRef += "DEV"; #endif DbSelector.SelectedIndex = DbSelector.FindString(MagRef); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }