public async void SaveRoutesInFile(string text)
        {
            string file = Routes.Aggregate <Route, string>(null, (current, route) => current + (route.FlightLeg + Environment.NewLine));

            if (text.Length == 0 || text == "" || file.Length == 0 || file == "")
            {
                return;
            }
            await RemoteSave.SaveContentToFtp(file, text, RemoteSave.State.ROUTE);

            _viewModel.Routes = null;
            FileList          = model.GetFiles();
        }
Exemple #2
0
        internal async void Start(List <object> websiteMembers, List <Route> flightLeg, DateTimeOffset?dep, DateTimeOffset?arr, string path)
        {
            string conf = websiteMembers.Cast <TemplateTable>().Aggregate <TemplateTable, string>(null, (current, member) => current + (member.Name + ";"));

            conf += Environment.NewLine;
            conf  = flightLeg.Aggregate(conf, (current, route) => current + (route.Departure + route.Delimeter + route.Arrival + ";"));
            conf += Environment.NewLine;
            if (dep != null)
            {
                if (arr != null)
                {
                    conf += $"{dep:yyyy-MM-dd}" + ";" + $"{arr:yyyy-MM-dd}" + Environment.NewLine;
                }
            }
            conf += path + Environment.NewLine;
            var t = Task.Run(async() =>
            {
                await RemoteSave.SaveContentToFtp(conf, "conf", RemoteSave.State.INTERMEDIATE);
            });

            t.Wait();

            StorageFolder folder = ApplicationData.Current.LocalFolder;
            StorageFile   file   = await folder.GetFileAsync("WebsiteCrawler.exe");

            bool success = false;
            var  n       = Task.Run(async() =>
            {
                LauncherOptions options = new LauncherOptions
                {
                    TreatAsUntrusted     = false,
                    DesiredRemainingView = ViewSizePreference.UseMinimum, DisplayApplicationPicker = true,
                };
                success = await Launcher.LaunchFileAsync(file, options);
            });

            n.Wait();
        }