Exemplo n.º 1
0
        private async void OnSuitcaseSorted(object sender, EventArgs e)
        {
            LuggageEventArgs lea = (LuggageEventArgs)e;

            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                        () =>
            {
                //Inserts the Luggage with its own parameters into the Collection
                if (lea.Luggage.Destination == "Bornholm")
                {
                    SortedSuitcasesBornholm.Insert(0, lea.Luggage);
                }
                else if (lea.Luggage.Destination == "Kairo")
                {
                    SortedSuitcasesKairo.Insert(0, lea.Luggage);
                }
                else if (lea.Luggage.Destination == "Paris")
                {
                    SortedSuitcasesParis.Insert(0, lea.Luggage);
                }
                else if (lea.Luggage.Destination == "Rom")
                {
                    SortedSuitcasesRom.Insert(0, lea.Luggage);
                }
                Suitcases.Remove(lea.Luggage);
            });
        }
Exemplo n.º 2
0
        private async void OnSuitcaseArrived(object sender, EventArgs e)
        {
            LuggageEventArgs lea = (LuggageEventArgs)e;

            //No idea what this does, but it fixes the crash
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                                                                        () =>
            {
                //Inserts the Luggage with its own parameters into the Collection
                Suitcases.Insert(0, lea.Luggage);
            });
        }