コード例 #1
0
        /// <summary>
        /// charge un groupe de fichiers Click-Once
        /// </summary>
        /// <param name="groupName">nom du groupe à charger</param>
        /// <param name="autoClose">fermer la fenêtre automatiquement lorsque l'opération est terminée</param>
        /// <returns>OK si le groupe a été installé (ou l'est déjà), Abort si opération annulée</returns>
        public static DialogResult Download(string groupName, bool autoClose)
        {
            if (!ApplicationDeployment.IsNetworkDeployed)
            {
                return(DialogResult.None);
            }

            if (ApplicationDeployment.CurrentDeployment.IsFileGroupDownloaded(groupName))
            {
                return(DialogResult.OK);
            }

            using (FormDownload dlg = new FormDownload())
            {
                dlg.groupName = groupName;
                dlg.autoClose = autoClose;

                DialogResult r = DialogResult.OK;
                try
                {
                    r = dlg.ShowDialog();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }
                finally
                {
                    dlg.RemoveHandlers();
                }
                return(r);
            }
        }
コード例 #2
0
        private void toolStripButtonDownload_Click(object sender, EventArgs e)
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                InputBoxResult ibr = InputBox.Show("Entrez le nom du groupe de photos:", "Vérification");

                if (ibr.ReturnCode != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                // ne faisons pas trop compliqué...
                if (ibr.Text.ToLower() != "barbaggio")
                {
                    return;
                }

                //ApplicationDeployment.CurrentDeployment.DownloadFileGroup("Famille");
                FormDownload.Download("Famille", false);

                if (Properties.Settings.Default.PhotosSupp == null)
                {
                    Properties.Settings.Default.PhotosSupp = new System.Collections.Specialized.StringCollection();
                }
                Properties.Settings.Default.PhotosSupp.Add("Famille");
                Properties.Settings.Default.Save();

                Enfants.Recharge();
                FormEnfants_Load(null, null);       // recharge le listView
            }
        }
コード例 #3
0
        private void FormCalculs_Load(object sender, EventArgs e)
        {
            this.Text = Application.ProductName;

            /*
             * if (DateTime.Now.CompareTo(new DateTime(2012, 07, 1)) > 0)
             * {
             *  MessageBox.Show("L'application est périmée. Obtenez une mise à jour auprès de l'auteur ou téléchargez la dernière version.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Stop);
             *
             *  if (ApplicationDeployment.IsNetworkDeployed)
             *  {
             *      miseÀJourToolStripMenuItem_Click(null, EventArgs.Empty);
             *  }
             *
             *  this.Close();
             *  return;
             * }
             */

            if (ApplicationDeployment.IsNetworkDeployed)
            {
                miseAJourToolStripMenuItem.Enabled = true;
                //miseÀJourToolStripMenuItem.ToolTipText = string.Format("Dernière recherche: {0}", ApplicationDeployment.CurrentDeployment.TimeOfLastUpdateCheck);

                this.Text += string.Format(" - version {0}", ApplicationDeployment.CurrentDeployment.CurrentVersion);

                if (ApplicationDeployment.CurrentDeployment.IsFirstRun)
                {
                    MessageBox.Show(@"Merci d'utiliser CalculsCE1 !

Le chronomètre et l'étoile récompensent les plus rapides.
Nouveau module pour apprendre l'écriture des nombres en français.
Contrôle hebdomadaire des mises à jour en tâche de fond ou avec le menu.
Le bouton + permet de gérer la liste des prénoms et photos.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);

                    // recharge les photos en ressources le cas échéant
                    if (Properties.Settings.Default.PhotosSupp != null)
                    {
                        foreach (var i in Properties.Settings.Default.PhotosSupp)
                        {
                            FormDownload.Download(i, true);
                        }
                    }
                }
            }
            else
            {
                miseAJourToolStripMenuItem.Enabled = false;
            }

            Historique.Add(DateTime.Now.ToString());
        }