ChangeEnglishLettersToGreek() public static method

public static ChangeEnglishLettersToGreek ( string temp ) : string
temp string
return string
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);


            Stop newStop = e.Parameter as Stop;

            pageStopName.Text     = newStop.stopName;
            myListBox.ItemsSource = newStop.OtherStops;

            for (int i = 0; i < newStop.OtherStops.Count; i++)
            {
                newStop.OtherStops[i] = App.ChangeEnglishLettersToGreek(newStop.OtherStops[i]);
            }

            //ContentRoot.Children.Add(new ListBox()
            //    {
            //        ItemTemplate = Resources["stopsRepresentation"] as DataTemplate,
            //        ItemContainerStyle = Resources["styleOfListBoxSO"] as Style,
            //        ItemsSource = newStop.OtherStops
            //    });
        }
Beispiel #2
0
        private void pivotDays_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (hasSchedule)
            {
                int selectedIndex      = pivotDays.SelectedIndex;
                int whitespacePosition = busNumber.Text.IndexOf(" ");
                //pivotDays.SelectedIndex = selectedIndex;
                //(sender as Pivot).SelectedIndex = selectedIndex;

                if (e.AddedItems.Count > 0)
                {
                    PivotItem currentItem = e.AddedItems[0] as PivotItem;

                    if (currentItem != null)
                    {
                        (currentItem.Header as TextBlock).Foreground = App.pivotHeaderColors[0];
                    }
                }

                if (e.RemovedItems.Count > 0)
                {
                    PivotItem currentItem = e.RemovedItems[0] as PivotItem;

                    if (currentItem != null)
                    {
                        (currentItem.Header as TextBlock).Foreground = App.pivotHeaderColors[1];
                    }
                }

                //PivotItem pivotTemp = (PivotItem)pivotDays.SelectedItem;
                //pivotTemp.Header = new SolidColorBrush(Colors.White);

                busNumber.Text  = App.ChangeEnglishLettersToGreek(busNumber.Text.Substring(0, whitespacePosition));
                busNumber.Text += " - " + startPositions[selectedIndex];
            }
            //titleScrollViewer.ScrollToHorizontalOffset(0);
        }
Beispiel #3
0
        /// <summary>
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// <para>
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="NavigationHelper.LoadState"/>
        /// and <see cref="NavigationHelper.SaveState"/>.
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        /// </para>
        /// </summary>
        /// <param name="e">Provides data for navigation methods and event
        /// handlers that cannot cancel the navigation request.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.navigationHelper.OnNavigatedTo(e);
            //Dispatcher.Invoke(new Action(() => { }), DispatcherPriority.ContextIdle, null);

            string currentBusNumber = (from b in App.activeBus
                                       select b.FirstAttribute.Value).ToList()[0];
            string stopName = "";

            SolidColorBrush scb = new SolidColorBrush(Colors.Transparent);
            TextBlock       tbHeader;

            ListBox listBox1 = new ListBox();

            listBox1.Background         = scb;
            listBox1.ItemTemplate       = Resources["stopsRepresentation"] as DataTemplate;
            listBox1.ItemContainerStyle = Resources["styleOfListBoxSO"] as Style;
            //listBox1.Tapped += listBox1_Tapped;

            //var xd = XDocument.Load("all.xml");
            //var bus = from el in xd.Descendants("Bus")
            //          where el.Attribute("lineNumber").Value == currentBusNumber
            //          select el;


            int stopsCount = App.activeBus.Descendants("Stops").Count();



            var         listFromStart = App.activeBus.Descendants("Stops").Take(1).Elements("Stop").ToList();
            List <Stop> myList1       = new List <Stop>();

            for (int i = 0; i < listFromStart.Count; i++)
            {
                stopName = listFromStart[i].Attribute("stopName").Value;

                var           aaaaa    = listFromStart[i].Elements("C").ToList();
                List <string> tempList = new List <string>();

                foreach (var innerStop in aaaaa)
                {
                    tempList.Add(innerStop.Value);
                }

                if (i == 0)
                {
                    myList1.Add(new Stop(stopName, tempList, tempList.Count, -1));
                }
                else if (i == listFromStart.Count - 1)
                {
                    myList1.Add(new Stop(stopName, tempList, tempList.Count, 1));
                }
                else
                {
                    myList1.Add(new Stop(stopName, tempList, tempList.Count, 0));
                }
                //myList1.Add(new Stop(stopName, tempList, tempList.Count));
            }


            listBox1.ItemsSource = myList1;
            listBox1.Tapped     += listBox1_Tapped;
            currentBusNumber     = App.ChangeEnglishLettersToGreek(currentBusNumber);
            if (stopsCount == 1)
            {
                tbHeader = new TextBlock {
                    Text = "Κυκλική \"" + currentBusNumber + "\"", FontSize = 28
                };
            }
            else
            {
                tbHeader = new TextBlock {
                    Text = "Αφετηρία \"" + currentBusNumber + "\"", FontSize = 28
                };
            }
            pivotStops.Items.Add(new PivotItem()
            {
                Name    = "PivotItem1",
                Header  = tbHeader,
                Content = listBox1
            });

            if (stopsCount == 2)
            {
                //currentBusNumber = (string)e.Parameter;
                ListBox listBox2 = new ListBox();
                listBox2.Background         = scb;
                listBox2.ItemTemplate       = Resources["stopsRepresentation"] as DataTemplate;
                listBox2.ItemContainerStyle = Resources["styleOfListBoxSO"] as Style;

                var listFromFinal = App.activeBus.Descendants("Stops").Reverse().Take(1).Elements("Stop").ToList();

                List <Stop> myList2 = new List <Stop>();

                for (int i = 0; i < listFromFinal.Count; i++)
                {
                    stopName = listFromFinal[i].Attribute("stopName").Value;

                    var           aaaaa    = listFromFinal[i].Elements("C").ToList();
                    List <string> tempList = new List <string>();

                    foreach (var innerStop in aaaaa)
                    {
                        tempList.Add(innerStop.Value);
                    }

                    //myList2.Add(new Stop(stopName, tempList, tempList.Count, 0));

                    if (i == 0)
                    {
                        myList2.Add(new Stop(stopName, tempList, tempList.Count, -1));
                    }
                    else if (i == listFromFinal.Count - 1)
                    {
                        myList2.Add(new Stop(stopName, tempList, tempList.Count, 1));
                    }
                    else
                    {
                        myList2.Add(new Stop(stopName, tempList, tempList.Count, 0));
                    }
                }
                listBox2.ItemsSource = myList2;
                listBox2.Tapped     += listBox1_Tapped;
                currentBusNumber     = App.ChangeEnglishLettersToGreek(currentBusNumber);

                tbHeader = new TextBlock {
                    Text = "Τέρμα \"" + currentBusNumber + "\"", FontSize = 28
                };
                pivotStops.Items.Add(new PivotItem()
                {
                    Name    = "PivotItem2",
                    Header  = tbHeader,
                    Content = listBox2
                });
            }
            currentBusNumber = "";
        }