コード例 #1
0
        public async Task <List <FipeMake> > GetMakes(FipeType type)
        {
            try
            {
                List <FipeMake> makes    = new List <FipeMake>();
                string          url      = /*await*/ UrlBuilder(_getMakesUrl, new string[] { _refTable, ((int)type).ToString() });
                string          jsonList = await WebFile.HttpRequestAsync(url);

                if (String.IsNullOrEmpty(jsonList))
                {
                    throw new WebException(JsonConvert.SerializeObject(new Relatório(2, "", "Sem acesso à internet")));
                }
                else
                {
                    if (jsonList.StartsWith("["))//tests if string is a json list (starts with '[')... "{\"codigo\":\"3\",\"erro\":\"Código fipe inválido\"}" , "{\"codigo\":\"0\",\"erro\":\"Nada encontrado\"}")
                    {
                        makes = JsonConvert.DeserializeObject <List <FipeMake> >(jsonList);
                    }
                    else
                    {
                        throw new WebException(jsonList);
                    }
                }
                return(makes);
            }
            catch (Exception ex)
            {
                Relatório.ExHandler(ex);
                return(new List <FipeMake>());
            }
        }
コード例 #2
0
 public Home()
 {
     InitializeComponent();
     try
     {
         Relatório.Home = this;
         for (int i = DateTime.Now.Year; i >= 1981; i--)
         {
             anoFabric.Items.Add(i.ToString());
         }
         anoFabric.SelectedIndex = -1;
         //tipo1.Checked = true;
         data.Value                       = DateTime.Now;
         danosMateriais.Text              =
             danosCorporais.Text          =
                 danosMorais.Text         = APPMorte.Text = APPInvalidez.Text = equipamento.Text = carroceria.Text =
                     franqBasica.Text     =
                         vistaBasica.Text = franqReduz.Text = vistaReduz.Text = valorFipe.Text = "0";
         labelValorFipe.Text              = "Valor na Fipe no mês " + DateTime.Today.ToString("M/yyyy") + ":";
         List <FipeModel> modelos = new List <FipeModel>();
         anoModeloFipe.DataSource = modelos;
     }
     catch (Exception ex)
     {
         Relatório.ExHandler(ex, "Home_Load");
     }
 }
コード例 #3
0
        public async Task <List <FipeModel> > QueryYear_modelsByFipeCode(string code)//QueryByFipeCode(Tipo t, string code)
        {
            try
            {
                int numcode = -1;
                if (code == "" || !Int32.TryParse(code.Replace("-", ""), out numcode) || numcode == 0 || numcode > 9999999)
                {
                    throw new WebException(JsonConvert.SerializeObject(new Relatório(3)));
                }

                code = numcode.ToString("000000-0");

                List <FipeModel> models = await GetModels(code);

                if (models.Count == 0)
                {
                    return(models);
                }

                List <Task <string> > requests = new List <Task <string> >();
                foreach (FipeModel model in models)
                {
                    string url = /*await*/ UrlBuilder(_queryByFipeCodeUrl, new string[] { _refTable, ((int)model.TipoVeiculo).ToString(), model.AnoModelo, model.TipoCombustivel, _vehicleTypes[(int)model.TipoVeiculo], code, _queryTypes[0] });
                    requests.Add(WebFile.HttpRequestAsync(url));
                }

                string[] responses = await TaskEx.WhenAll(requests);

                if (responses.Length == 0 || String.IsNullOrEmpty(responses[0]))
                {
                    throw new WebException(JsonConvert.SerializeObject(new Relatório(4)));
                }

                foreach (string json in responses)
                {
                    if (Array.IndexOf(responses, json) == 0)                                //insert mockup in position 0
                    {
                        FipeModel mockup = JsonConvert.DeserializeObject <FipeModel>(json); //mockup: "Selecione o ano/modelo:"
                        mockup.Label = "Selecione o ano/modelo:";
                        mockup.Value = "0";
                        mockup.Valor = null;
                        models.Insert(0, mockup);
                    }

                    FipeModel model = JsonConvert.DeserializeObject <FipeModel>(json);
                    model.Label = models.ElementAt(Array.IndexOf(responses, json) + 1).Label;
                    model.Value = models.ElementAt(Array.IndexOf(responses, json) + 1).Value;
                    models[Array.IndexOf(responses, json) + 1] = model;
                }
                return(models);
            }
            catch (Exception ex)
            {
                Relatório.ExHandler(ex);
                return(new List <FipeModel>());
            }
        }
コード例 #4
0
        private async Task <List <FipeModel> > GetModels(string code)
        {
            try
            {
                string url = /*await*/ UrlBuilder(_getModelsUrl, new string[] { _refTable, "1", _vehicleTypes[1], code, _queryTypes[0] });
                //if (_refTable == "0")
                //  throw new WebException(JsonConvert.SerializeObject(new Relatório(0, "Fipe indisponível")));

                List <Task <string> > requests = new List <Task <string> >();
                foreach (int type in Enum.GetValues(typeof(FipeType)).OfType <object>().Where(o => (int)o > 0))//Autodetection FipeType
                {
                    url = /*await*/ UrlBuilder(_getModelsUrl, new string[] { _refTable, type.ToString(), _vehicleTypes[type], code, _queryTypes[0] });
                    requests.Add(WebFile.HttpRequestAsync(url));
                }

                string[] responses = await TaskEx.WhenAll(requests);

                if (responses.Length == 0 || String.IsNullOrEmpty(responses[0]) || String.IsNullOrEmpty(responses[1]) || String.IsNullOrEmpty(responses[2]))
                {
                    throw new WebException(JsonConvert.SerializeObject(new Relatório(2, "", "Sem acesso à internet")));
                }

                List <FipeModel> models = new List <FipeModel>();
                foreach (string jsonList in responses)
                {
                    if (jsonList.StartsWith("["))//tests if string is a json list (stars with '[')... "{\"codigo\":\"3\",\"erro\":\"Código fipe inválido\"}" , "{\"codigo\":\"0\",\"erro\":\"Nada encontrado\"}")
                    {
                        models = JsonConvert.DeserializeObject <List <FipeModel> >(jsonList);
                        foreach (FipeModel model in models)
                        {
                            model.TipoVeiculo = (FipeType)(Array.IndexOf(responses, jsonList) + 1);
                        }
                    }
                    else
                    {
                        Relatório report = JsonConvert.DeserializeObject <Relatório>(jsonList);
                        if (report.Codigo != 0)
                        {
                            throw new WebException(jsonList);
                        }
                    }
                }
                if (models.Count == 0)
                {
                    throw new WebException(JsonConvert.SerializeObject(new Relatório(3)));
                }
                else
                {
                    return(models);
                }
            }
            catch (Exception ex)
            {
                Relatório.ExHandler(ex);
                return(new List <FipeModel>());
            }
        }
コード例 #5
0
        public static void Serialize(object o, string local)
        {
            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream(local, FileMode.Create, FileAccess.Write, FileShare.Read);

            try { formatter.Serialize(stream, o); }
            catch (Exception ex) { Relatório.ExHandler(ex); }
            finally { stream.Close(); }
        }
コード例 #6
0
        public static object Deserialize(string local)
        {
            IFormatter formatter = new BinaryFormatter();
            Stream     stream    = new FileStream(local, FileMode.Open, FileAccess.Read, FileShare.Read);

            try { return(formatter.Deserialize(stream)); }
            catch (Exception ex)
            {
                Relatório.ExHandler(ex);
                return(new object());
            }
            finally { stream.Close(); }
        }
コード例 #7
0
        public static async Task <bool> SendEmailAsync(MailMessage message)
        {
            if (!HasInternet())
            {
                return(false);
            }

            SmtpClient client = new SmtpClient()
            {
                Host                  = "smtp.gmail.com",
                Port                  = 587,
                EnableSsl             = true,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential(Email.Address, _password)
            };

            ServicePointManager.ServerCertificateValidationCallback =
                delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); };

            var tcs = new TaskCompletionSource <bool>();

            try
            {
                client.SendCompleted += (s, e) =>
                {
                    if (e.Error != null)
                    {
                        tcs.TrySetException(e.Error);
                    }
                    else
                    if (e.Cancelled)
                    {
                        tcs.TrySetCanceled();
                    }
                    else
                    {
                        tcs.TrySetResult(true);
                    }
                };

                client.SendAsync(message, null);
                return(await tcs.Task);
            }
            catch (Exception ex)
            {
                Relatório.ExHandler(ex);
                return(false);
            }
        }
コード例 #8
0
        /*public static async Task<DateTime> LastModified(string url)
         * {
         *  if (!HasInternet())
         *      return DateTime.MinValue;
         *
         *  var tcs = new TaskCompletionSource<WebResponse>();
         *  try
         *  {
         *      HttpWebRequest head = (HttpWebRequest)WebRequest.Create(url);
         *      head.Method = WebRequestMethods.Http.Head;
         *      head.BeginGetResponse(iar =>
         *      {
         *          try { tcs.TrySetResult(req.EndGetResponse(iar)); }
         *          catch (OperationCanceledException) { tcs.TrySetCanceled(); }
         *          catch (Exception ex) { tcs.TrySetException(ex); }
         *      }, null);
         *
         *      using (WebResponse response = await tcs.Task)
         *      {
         *          DateTime lastModified;
         *          if (DateTime.TryParse(response.Headers.Get("Last-Modified"), out lastModified))
         *              return lastModified;
         *          else
         *              return DateTime.MinValue;
         *      }
         *  }
         *  catch (Exception ex)
         *  {
         *      Relatório.ExHandler(ex);
         *      return DateTime.MinValue;
         *  }
         * }*/

        public static async Task <string> HttpRequestAsync(string url)
        {
            HttpWebRequest post = (HttpWebRequest)WebRequest.Create(url.Substring(0, url.IndexOf("?")));

            post.Method = WebRequestMethods.Http.Post;

            post.Accept      = "*/*";
            post.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
            post.Referer     = @"http://veiculos.fipe.org.br/api/veiculos/";
            post.UserAgent   = "Mozilla / 5.0(Windows NT 10.0; WOW64; rv: 40.0) Gecko / 20100101 Firefox / 40.0";
            post.Headers.Add("Accept-Encoding", "gzip, deflate");
            post.Headers.Add("Accept-Language", "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3");
            post.Headers.Add("X-Requested-With", "XMLHttpRequest");

            var tcsRequest  = new TaskCompletionSource <Stream>();
            var tcsResponse = new TaskCompletionSource <WebResponse>();

            try
            {
                post.BeginGetRequestStream(iar =>
                {
                    try { tcsRequest.TrySetResult(post.EndGetRequestStream(iar)); }
                    catch (OperationCanceledException) { tcsRequest.TrySetCanceled(); }
                    catch (Exception ex) { tcsRequest.TrySetException(ex); }
                }, null);

                byte[] body = Encoding.UTF8.GetBytes(url.Substring(url.IndexOf("?") + 1));
                using (Stream request = await tcsRequest.Task)
                    request.Write(body, 0, body.Length);

                post.BeginGetResponse(iar =>
                {
                    try { tcsResponse.TrySetResult(post.EndGetResponse(iar)); }
                    catch (OperationCanceledException) { tcsResponse.TrySetCanceled(); }
                    catch (Exception ex) { tcsResponse.TrySetException(ex); }
                }, null);

                string output;
                using (WebResponse response = await tcsResponse.Task)
                    using (StreamReader stream = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
                        output = stream.ReadToEnd();

                return(output);
            }
            catch (Exception ex)
            {
                Relatório.ExHandler(ex);
                return(null);
            }
        }
コード例 #9
0
        public static bool HasInternet()
        {
            try
            {
                using (Ping ping = new Ping())
                {
                    PingReply reply = ping.Send("8.8.8.8", 1000);//ping google public dns server

                    if (reply.Status == IPStatus.Success)
                    {
                        return(true);
                    }
                    else
                    {
                        throw new PingException(JsonConvert.SerializeObject(new Relatório(2, reply.Status.ToString())));
                    }
                }
            }
            catch (Exception ex)
            {
                Relatório.ExHandler(ex);
                return(false);
            }
        }
コード例 #10
0
 private void opcaoValidadeCot_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         if (opcaoValidadeCot.Checked)
         {
             //Código refletido na função limpar
             dataValidadeCot.Enabled = true;
             DateTime hoje    = DateTime.Now;
             DateTime comdias = hoje.AddDays(5);
             dataValidadeCot.Value = comdias;
         }
         else
         {
             dataValidadeCot.Enabled = false;
         }
         preferencias.Validade = opcaoValidadeCot.Checked;
         WebFile.Prefs         = preferencias;
     }
     catch (Exception ex)
     {
         Relatório.ExHandler(ex, "Validade pressionada antes do status ser carregado");
     }
 }
コード例 #11
0
        public Cotacao(FipeType tiposeg, string cliente, DateTime data, string seguradora, string modelo, string anoFabricacao, string anoModelo,
                       string marca, string valorFipe, string porContratada, string danosMateriais, string danosCorporais, string danosMorais,
                       string appMorte, string appInvalidez, string franquiaBasica, string valFranqBasicaAVista, string franquiaReduzida,
                       string valFranqReduzidaAVista, string observacoes, bool nomeFuncionario, string funcionario,
                       bool debitobb, bool rcf, string equipamento, string carroceria, bool vd, bool mostrarvalidade, DateTime validade, Fill preenchimento)
        {
            try
            {
                var segerrada = new FormatException();
                Tipo    = tiposeg;
                Cliente = cliente;
                Data    = data;
                if (seguradora != "")
                {
                    Seguradora = seguradora;
                }
                else
                {
                    throw segerrada;
                }
                Modelo        = modelo;
                AnoFabricacao = Convert.ToInt32(anoFabricacao);
                AnoModelo     = anoModelo;
                Marca         = marca;
                ValorFipe     = Decimal.Parse(valorFipe, NumberStyles.Currency, CultureInfo.CurrentCulture);
                if (porContratada != "")
                {
                    PorContratada = Decimal.Parse(porContratada);
                }
                else
                {
                    PorContratada = 0.0m;
                }
                Rcf                    = rcf;
                DanosMateriais         = Decimal.Parse(danosMateriais, NumberStyles.Currency, CultureInfo.CurrentCulture);
                DanosCorporais         = Decimal.Parse(danosCorporais, NumberStyles.Currency, CultureInfo.CurrentCulture);
                DanosMorais            = Decimal.Parse(danosMorais, NumberStyles.Currency, CultureInfo.CurrentCulture);
                APPMorte               = Decimal.Parse(appMorte, NumberStyles.Currency, CultureInfo.CurrentCulture);
                APPInvalidez           = Decimal.Parse(appInvalidez, NumberStyles.Currency, CultureInfo.CurrentCulture);
                FranquiaBasica         = Decimal.Parse(franquiaBasica, NumberStyles.Currency, CultureInfo.CurrentCulture);
                ValFranqBasicaAVista   = Decimal.Parse(valFranqBasicaAVista, NumberStyles.Currency, CultureInfo.CurrentCulture);
                FranquiaReduzida       = Decimal.Parse(franquiaReduzida, NumberStyles.Currency, CultureInfo.CurrentCulture);
                ValFranqReduzidaAVista = Decimal.Parse(valFranqReduzidaAVista, NumberStyles.Currency, CultureInfo.CurrentCulture);
                if (FranquiaBasica + ValFranqBasicaAVista + FranquiaReduzida + ValFranqReduzidaAVista == 0.0m)
                {
                    throw segerrada;
                }

                NomeFuncionario = nomeFuncionario;
                Funcionario     = funcionario;
                Observacoes     = observacoes;

                DebitoBB      = debitobb;
                ErroDeFormato = false;

                if (nomeFuncionario == true)
                {
                    Home.preferencias.NomeFuncionario = funcionario;
                    WebFile.Prefs = Home.preferencias;
                }

                Equipamento     = Decimal.Parse(equipamento, NumberStyles.Currency, CultureInfo.CurrentCulture);
                Carroceria      = Decimal.Parse(carroceria, NumberStyles.Currency, CultureInfo.CurrentCulture);
                Vd              = vd;
                MostrarValidade = mostrarvalidade;
                Validade        = validade;
                Preenchimento   = preenchimento;
            }
            catch (FormatException)
            {
                Relatório.AdicionarAoRelatorio("Campos preenchidos incorretamente");
                MessageBox.Show("Algum campo foi preenchido incorretamente.\r\nCorrija-o e tente novamente.",
                                "Carta de Cotação",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                ErroDeFormato = true;
            }

            TabelaParcelamento = new List <Parcelamento>();
            int max = maxParcelas;

            if (Seguradora == "Allianz")
            {
                max = 6; //Ajusta o número máximo de parcelas conforme a seguradora;
            }
            for (int i = 0; i < max; i++)
            {
                foreach (string tipo in tiposFranq)
                {
                    foreach (string forma in formasPagto)
                    {
                        try
                        {
                            object o = WebFile.Extras.CreateInstance("CartaDeCotacao.Parcelamento");
                            o.GetType().GetConstructors()[1].Invoke(o, new object[] { Seguradora, forma, tipo, ValFranqBasicaAVista, ValFranqReduzidaAVista });
                            o.GetType().GetMethod("CalculaParcela").Invoke(o, new object[] { 1 + i });

                            Parcelamento parc = new Parcelamento()
                            {
                                Seguradora  = (string)o.GetType().GetProperty("Seguradora").GetValue(o, null),
                                FormaPagto  = (string)o.GetType().GetProperty("FormaPagto").GetValue(o, null),
                                TipoFranq   = (string)o.GetType().GetProperty("TipoFranq").GetValue(o, null),
                                Basica      = (decimal)o.GetType().GetProperty("Basica").GetValue(o, null),
                                Reduzida    = (decimal)o.GetType().GetProperty("Reduzida").GetValue(o, null),
                                NumParcelas = (int)o.GetType().GetProperty("NumParcelas").GetValue(o, null),
                                Descricao   = (string)o.GetType().GetProperty("Descricao").GetValue(o, null),
                                ValParcela  = (decimal)o.GetType().GetProperty("ValParcela").GetValue(o, null)
                            };

                            TabelaParcelamento.Add(parc);
                        }
                        catch (Exception ex)
                        {
                            Relatório.ExHandler(ex, "Uso do parcelamento");
                        }
                    }
                }

                if (i == 0) //Começa no zero (Á vista)
                {
                    i++;
                }

                if (i == 1)
                {
                    i++;
                }

                if (Seguradora == "Allianz" && i == 3)
                {
                    i++;
                }
            }
        }
コード例 #12
0
        /*public static async Task<string> DownloadStringAsync(string url)
         * {
         *  if (!HasInternet())
         *      return null;
         *
         *  var tcs = new TaskCompletionSource<string>();
         *  try
         *  {
         *      using (var client = new WebClient())
         *      {
         *          client.DownloadStringCompleted += (s, e) =>
         *          {
         *              if (e.Error != null)
         *                  tcs.TrySetException(e.Error);
         *              else
         *                  if (e.Cancelled)
         *                      tcs.TrySetCanceled();
         *                  else
         *                      tcs.TrySetResult(e.Result);
         *          };
         *          client.DownloadStringAsync(new Uri(url));
         *      }
         *      return await tcs.Task;
         *  }
         *  catch (Exception ex)
         *  {
         *      Relatório.ExHandler(ex);
         *      return null;
         *  }
         * }*/

        public static async Task <bool> DownloadFileAsync(string url, string local)
        {
            if (!HasInternet())
            {
                return(false);
            }

            HttpWebRequest get = (HttpWebRequest)WebRequest.Create(url);

            get.Method = WebRequestMethods.Http.Get;

            var tcs = new TaskCompletionSource <WebResponse>();

            try
            {
                get.BeginGetResponse(iar =>
                {
                    try { tcs.TrySetResult(get.EndGetResponse(iar)); }
                    catch (OperationCanceledException) { tcs.TrySetCanceled(); }
                    catch (Exception ex) { tcs.TrySetException(ex); }
                }, null);

                using (WebResponse response = await tcs.Task)
                {
                    using (Stream rs = response.GetResponseStream())
                    {
                        int    bytesRead = 0;
                        byte[] buffer    = new byte[4096];

                        MemoryStream ms = new MemoryStream();
                        while ((bytesRead = rs.Read(buffer, 0, buffer.Length)) > 0)
                        {
                            ms.Write(buffer, 0, bytesRead);
                        }

                        ms.Position = 0;

                        var    md5        = MD5.Create();
                        byte[] localHash  = new byte[16];
                        byte[] remoteHash = md5.ComputeHash(ms);

                        if (File.Exists(local))
                        {
                            using (FileStream fs = new FileStream(local, FileMode.Open, FileAccess.Read, FileShare.Read))
                                localHash = md5.ComputeHash(fs);
                        }

                        if (!remoteHash.SequenceEqual(localHash))
                        {
                            ms.Position = 0;
                            using (FileStream fs = new FileStream(local, FileMode.Create, FileAccess.Write, FileShare.Read))
                                while ((bytesRead = ms.Read(buffer, 0, buffer.Length)) > 0)
                                {
                                    fs.Write(buffer, 0, bytesRead);
                                }
                        }
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                Relatório.ExHandler(ex);
                return(false);
            }
        }
コード例 #13
0
        private async void Home_Load(object sender, EventArgs e)
        {
            try
            {
                //if (!File.Exists(WebFile.AppData + "Status.dat") && !await WebFile.HasInternet())
                //throw new Exception("Sem internet e Status não encontrado");

                await WebFile.CheckAppFilesAsync();

                preferencias  = WebFile.Prefs;
                status        = WebFile.Status;
                tipo1.Checked = true;
                opcaoNomeFuncionario.Checked = true;
                //seguradora.DataSource = status.Segs;
                if (preferencias.Validade)
                {
                    opcaoValidadeCot.Checked = true;
                }
                else
                {
                    opcaoValidadeCot.Checked = true;
                    opcaoValidadeCot.Checked = false;
                }

                if (await Relatório.PrimeiroUso())
                {
                    Relatório.MoverDadosAntigos();
                    if (novaVersaoLabel2.Text != "" && novaVersaoLabel2.Text != " ")
                    {
                        novaVersao.Location = new Point(171, 207);
                        novaVersao.Size     = new Size(503, 229);
                        novaVersao.Visible  = true;
                    }
                }

                if (status.VersoesFunc.FirstOrDefault(v => v.VersionNum == Application.ProductVersion) == null)
                {
                    Relatório.PostMessage(new Relatório(5));
                }

                if (Atualizacao.VerificarAtualizacoes(status))
                {
                    AtualizarPrograma();
                }

                if (status.VersoesFunc.FirstOrDefault(v => v.VersionNum == Application.ProductVersion) == null)
                {
                    Close();
                }

                if (!status.ProgDisp)
                {
                    Relatório.PostMessage(new Relatório(6));
                    Environment.Exit(1);
                }

                if (status.Mensagem != "")
                {
                    mensagem.ForeColor = Color.FromName(status.CorMsg);
                    mensagem.Text      = status.Mensagem.Replace("|", "\r\n");
                    mensagem.Visible   = true;
                }

                if (!status.Fipe)
                {
                    modoManual.Checked = true;
                    modoManual.Visible = false;
                    fipe = false;
                }
                else
                {
                    fipe = true;
                }
                if (File.Exists(WebFile.AppData + "Restauração.bin"))
                {
                    fill = (Fill)WebFile.Deserialize(WebFile.AppData + "Restauração.bin");

                    if (File.GetCreationTime(WebFile.AppData + "Restauração.bin").Date == DateTime.Now.Date &&
                        fill.Cliente != "")
                    {
                        if (
                            MessageBox.Show(
                                "Você deseja restaurar o preenchimento salvo\r\nde quando ocorreu um erro no programa?",
                                "Carta de Cotação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                            DialogResult.Yes)
                        {
                            mensagem.ForeColor = Color.Blue;
                            mensagem.Text      =
                                "Verifique se o preenchimento restaurado foi\r\ninserido corretamente antes de gerar a carta.";
                            PreencherFill();
                        }
                    }

                    File.Delete(WebFile.AppData + "Restauração.bin");
                }
                //Código para destacar novos recursos:

                /*DateTime dataArquivo = File.GetLastWriteTime(WebFile.AppData + "Versão.dat");
                 * TimeSpan dif = DateTime.Now - dataArquivo;
                 * if (dif.Days <= 3)
                 * {
                 *  label1.Visible = true;
                 *  arquivoToolStripMenuItem.ForeColor = Color.Blue;
                 *  editarCartaToolStripMenuItem.ForeColor = Color.Blue;
                 * }*/
                await Relatório.VerificarEnvio();

                exemploToolStripMenuItem.Enabled = true;
                limparToolStripMenuItem.Enabled  = true;
                botaoLimpar.Enabled = true;
                seguradora.Enabled  = true;
                carregando.Visible  = false;
            }
            catch (Exception ex)
            {
                if (File.Exists(WebFile.AppData + "Status.dat"))
                {
                    Relatório.ExHandler(ex, "Home_Load");
                }
                else
                {
                    MessageBox.Show("ATENÇÃO:\r\nNão foi possível baixar os arquivos necessários para o programa funcionar.\r\n"
                                    + "Verifique se seu Windows está atualizado (IMPORTANTE).\r\n"
                                    + "Verifique sua conexão com a internet ou se o acesso à internet pelo programa está sendo bloqueado.\r\n"
                                    + "\r\nErro interno:\r\n"
                                    + ex.Message, "Carta de Cotação", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Relatório.AdicionarAoRelatorio("Status não encontrado");
                    Environment.Exit(1);
                }
            }
        }