// Include code to be executed when the system has transitioned from the splash screen to the extended splash screen (application's first view).
        async void DismissedEventHandler(SplashScreen sender, object e)
        {
            dismissed = true;

            //AppStorage.ModificationDate.RemoveValue();
            //FileManagement.DeleteFile("MissingPeople.json");

            if (WindowsStore.Connectivity.Connectivity.ConnectedToTheInternet())
            {
                string UniqueID = AppStorage.UniqueAppID.SetValue(Guid.NewGuid().ToString());

                string ModificationDate = AppStorage.ModificationDate.GetValue();

                string result = "";

                try
                {
                    IMissingsService ms = new MissingsService(AzureUrl.GetUrl());

                    if (ModificationDate != "")
                    {
                        result = await ms.GetLatestMissings(ModificationDate);
                    }
                    else
                    {
                        result = await ms.GetLatestMissings();
                    }

                    var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

                    ReceivedInfo receivedInfo = JsonData.IncomingJson(result);

                    AppStorage.ModificationDate.SaveValue(receivedInfo.timestamp);


                    if (!receivedInfo.missings.Equals(null) && receivedInfo.missingsString != "")
                    {
                        FileManagement.SaveFile("MissingPeople.json", receivedInfo.missingsString);

                        List <string> ImagesList = receivedInfo.ImagesList;

                        if (ImagesList.Count() != 0)
                        {
                            foreach (var imageName in ImagesList)
                            {
                                string[] number = imageName.Split('.');
                                if (Convert.ToInt32(number[0]) >= 0 && Convert.ToInt32(number[0]) <= 37)
                                {
                                    FileManagement.SaveImageAsync(imageName);
                                }
                            }
                        }
                    }
                    if (receivedInfo.found.Count() != 0)
                    {
                        AppStorage.SkippedItems.Merge(receivedInfo.found);
                    }
                }
                catch (Exception)
                {
                }
            }
            else if (WindowsStore.Connectivity.Connectivity.ConnectedToTheInternet() == false)
            {
                var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

                localSettings.Values["Popup"] = "true";
            }

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                rootFrame.Navigate(typeof(MainPage));
                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            });
        }
예제 #2
0
        private async void RefreshBar_Click(object sender, RoutedEventArgs e)
        {
            if (WindowsStore.Connectivity.Connectivity.ConnectedToTheInternet())
            {
                string UniqueID         = AppStorage.UniqueAppID.SetValue(Guid.NewGuid().ToString());
                string ModificationDate = AppStorage.ModificationDate.GetValue();

                string result = "";

                try
                {
                    IMissingsService ms = new MissingsService(AzureUrl.GetUrl());

                    if (ModificationDate != "")
                    {
                        result = await ms.GetLatestMissings(ModificationDate);

                        //result = await ms.GetLatestMissings("2043");
                    }
                    else
                    {
                        result = await ms.GetLatestMissings();
                    }


                    ReceivedInfo receivedInfo = JsonData.IncomingJson(result);

                    AppStorage.ModificationDate.SaveValue(receivedInfo.timestamp);

                    if (!receivedInfo.missings.Equals(null) && receivedInfo.missingsString != "")
                    {
                        FileManagement.SaveFile("MissingPeople.json", receivedInfo.missingsString);

                        List <string> ImagesList = receivedInfo.ImagesList;

                        if (ImagesList.Count() != 0)
                        {
                            foreach (var imageName in ImagesList)
                            {
                                string[] number = imageName.Split('.');
                                if (Convert.ToInt32(number[0]) >= 0 && Convert.ToInt32(number[0]) <= 37)
                                {
                                    FileManagement.SaveImageAsync(imageName);
                                }
                            }
                        }
                    }
                    if (receivedInfo.found.Count() != 0)
                    {
                        AppStorage.SkippedItems.Merge(receivedInfo.found);
                    }

                    string ResultJson = "[" + receivedInfo.missingsString + "]";

                    List <MissingPerson> Mis = new List <MissingPerson>();

                    Mis = JsonData.MissingPeopleList("el", ResultJson, navigationParameter).OrderByDescending(x => x.DateMissing).ToList <MissingPerson>();


                    if (Mis.Count() != 0)
                    {
                        txt.Visibility          = Visibility.Collapsed;
                        itemGridView.Visibility = Visibility.Visible;
                        string SkippedItemsString = AppStorage.SkippedItems.Get();

                        String[] Skipped = SkippedItemsString.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                        if (Skipped.Count() != 0)
                        {
                            foreach (var item in Skipped)
                            {
                                Int32 Intitem       = Convert.ToInt32(item);
                                var   stuffToRemove = Mis.SingleOrDefault(s => s.ID == Intitem);
                                if (stuffToRemove != null)
                                {
                                    Mis.Remove(stuffToRemove);
                                }
                            }
                        }
                        int i = 0;
                        foreach (MissingPerson item in Mis)
                        {
                            oc.Insert(i, item);
                            i++;
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            else if (WindowsStore.Connectivity.Connectivity.ConnectedToTheInternet() == false)
            {
                MessageDialog dialog = new MessageDialog("Δεν υπάρχει ενεργή σύνδεση στο διαδίκτυο.", "Σφάλμα σύνδεσης");
                await dialog.ShowAsync();
            }
        }
예제 #3
0
        private async void RefreshBar_Click(object sender, RoutedEventArgs e)
        {
            if (WindowsStore.Connectivity.Connectivity.ConnectedToTheInternet() == true)
            {
                string UniqueID         = AppStorage.UniqueAppID.SetValue(Guid.NewGuid().ToString());
                string ModificationDate = AppStorage.ModificationDate.GetValue();

                string result = "";

                try
                {
                    IMissingsService ms = new MissingsService(AzureUrl.GetUrl());

                    if (ModificationDate != "")
                    {
                        result = await ms.GetLatestMissings(ModificationDate);
                    }
                    else
                    {
                        result = await ms.GetLatestMissings();
                    }


                    ReceivedInfo receivedInfo = JsonData.IncomingJson(result);

                    AppStorage.ModificationDate.SaveValue(receivedInfo.timestamp);

                    if (!receivedInfo.missings.Equals(null) && receivedInfo.missingsString != "")
                    {
                        FileManagement.SaveFile("MissingPeople.json", receivedInfo.missingsString);

                        List <string> ImagesList = receivedInfo.ImagesList;

                        if (ImagesList.Count() != 0)
                        {
                            foreach (var imageName in ImagesList)
                            {
                                string[] number = imageName.Split('.');
                                if (Convert.ToInt32(number[0]) >= 0 && Convert.ToInt32(number[0]) <= 37)
                                {
                                    FileManagement.SaveImageAsync(imageName);
                                }
                            }
                        }
                    }
                    if (receivedInfo.found.Count() != 0)
                    {
                        AppStorage.SkippedItems.Merge(receivedInfo.found);
                    }
                    EnableLiveTile.CreateLiveTile.ShowliveTile();
                }
                catch (Exception)
                {
                }
            }
            else if (WindowsStore.Connectivity.Connectivity.ConnectedToTheInternet() == false)
            {
                MessageDialog dialog = new MessageDialog("Δεν υπάρχει ενεργή σύνδεση στο διαδίκτυο.", "Σφάλμα σύνδεσης");
                await dialog.ShowAsync();
            }
        }