Exemplo n.º 1
0
        private async void share()
        {
            string text;

            var s = await DisplayActionSheet("Condividi", "Annulla", null, "Visualizza PDF", "Condividi PDF", "Condividi Testo");

            if (s.Contains("PDF"))                //devo creare il PDF

            {
                if (_viewModel.Group)
                {
                    ListGroupToString();
                    text = _listStringGroup;                      //lista corsi raggruppati
                }
                else
                {
                    text = string.Join("\n", _viewModel.ListOrari);                      //lista corsi
                }
                PdfFile pdf = new PdfFile()
                {
                    Title = "Orario completo", TitleFacolta = _viewModel.LaureaString, TitleInfo = _viewModel.AnnoSemestre, Text = text
                };
                pdf.CreateCompleto();

                await pdf.Save();

                if (s.Contains("Condividi"))                  //Condividi PDF
                {
                    DependencyService.Get <IFile> ().Share(pdf._filename);
                }
                else
                {
                    await pdf.Display();                      //visualizza PDF
                }
            }
            else
            {
                if (_viewModel.Group)
                {
                    text = ListGroupToString();
                }
                else
                {
                    text = _viewModel.ToString();
                }
                text += Settings.Firma;
                DependencyService.Get <IMethods> ().Share(text);                 //condividi testo
            }

            //Insights.Track("Share", new Dictionary <string,string>{
            //	{"Orario", "Completo_" + s},
            //});
        }
        private async void share4()
        {
            string text;

            var s = await DisplayActionSheet("Condividi", "Annulla", null, "Visualizza PDF", "Condividi PDF", "Condividi Testo");

            if (s.Contains("PDF"))
            { //devo creare il PDF
                //if (_viewModel.Group)
                //{
                //    ListGroupToString();
                //    text = _listStringGroup;  //lista corsi raggruppati
                //}
                //else
                text = string.Join("\n", _viewModel.ListOrari); //lista corsi

                PdfFile pdf = new PdfFile()
                {
                    Title = "Elenco corsi suggeriti", TitleFacolta = _viewModel.LaureaString, TitleInfo = _viewModel.AnnoSemestre, Text = text
                };
                pdf.CreateCompleto();

                await pdf.Save();

                if (s.Contains("Condividi")) //Condividi PDF
                {
                    DependencyService.Get <IFile>().Share(pdf._filename);
                }
                else
                {
                    resetView = false;   //non voglio resettare le view
                    await pdf.Display(); //visualizza PDF
                }
            }
            else
            {
                //if (_viewModel.Group)
                //    text = ListGroupToString();
                //else
                text  = _viewModel.ToString();
                text += Settings.Firma;
                DependencyService.Get <IMethods>().Share(text); //condividi testo
            }
        }