Beispiel #1
0
        private void CheckInternetConnectionFileAndFolder()
        {
            try
            {
                try
                {
                    using (var client = new WebClient())
                    {
                        using (var stream = client.OpenRead("http://www.google.com"))
                        {
                        }
                    }
                }
                catch
                {
                    Messaggi.ShowError("Controllare la connessione internet e riprovare");
                    Environment.Exit(0);
                }

                if (!Directory.Exists(DIR_FOLDER_PROGRAMS))
                {
                    Directory.CreateDirectory(DIR_FOLDER_PROGRAMS);
                    Messaggi.ShowWarning("Cartella programmi non trovata all'indirizzo " + DIR_FOLDER_PROGRAMS + ". Cartella creata");
                }
            }
            catch (Exception ex)
            {
                Messaggi.ShowError("Errore al controllo iniziale: " + ex.Message);
            }
        }
Beispiel #2
0
        private void button_update_Click(object sender, EventArgs e)
        {
            try
            {
                List <int> indexToUpdate = new List <int>();
                for (int i = 0; i < checkedListBox_appList.Items.Count; i++)
                {
                    if (checkedListBox_appList.GetItemCheckState(i).Equals(CheckState.Checked))
                    {
                        indexToUpdate.Add(i);
                    }
                }

                if (indexToUpdate.Count() > 0)
                {
                    foreach (int index in indexToUpdate)
                    {
                        if (!String.IsNullOrEmpty(appList[index].Url) && !String.IsNullOrWhiteSpace(appList[index].Url))
                        {
                            Process.Start(appList[index].Url);
                        }
                        else
                        {
                            Messaggi.ShowWarning("Nessun link valido per " + appList[index].AppName);
                        }
                    }
                }
                else
                {
                    Messaggi.ShowWarning("Nessuna App da aggiornare");
                }
            }
            catch (Exception ex)
            {
                Messaggi.ShowError("Errore all'update: " + ex.Message);
            }
        }