示例#1
0
        public MainWindow()
        {
            InitializeComponent();
            try
            {
                countries.ListCou = new List <Country>();
                Log.L("Вход в режим пользователя; " + DateTime.Now);

                var Pat = System.Reflection.Assembly.GetExecutingAssembly().Location;
                var p   = "Map.png";
                image.Source = new BitmapImage(new Uri(System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Pat) + "/Map/", p)));

                if (File.Exists("../../allcountries.xml"))
                {
                    countries = Ser.DeSerialize(countries);
                    Sort.C(countries.ListCou);
                    foreach (var item in countries.ListCou)
                    {
                        AllCou.Items.Add(item.Name);

                        foreach (var s in item.LSight)
                        {
                            Sort.S(item.LSight);
                            sights.Add(s);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Warning);
                Log.L("Ошибка! " + ex.Message);
            }
        }
        public CountryAd()
        {
            InitializeComponent();
            try {
                countries.ListCou = new List <Country>();

                if (File.Exists("../../allcountries.xml"))
                {
                    countries = Ser.DeSerialize(countries);

                    Sort.C(countries.ListCou);
                    foreach (var item in countries.ListCou)
                    {
                        AllCouAd.Items.Add(item.Name);
                        foreach (var s in item.LSight)
                        {
                            Sort.S(item.LSight);
                            sights.Add(s);
                        }
                    }
                    Sort.S(sights);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Warning);
                Log.L("Ошибка! " + ex.Message);
            }
        }
示例#3
0
        /*НА СТРАНИЧКУ ДЛЯ ПОЛЬЗОВАТЕЛЯ */
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MainPage.Visibility      = Visibility.Visible;
                Admin.Visibility         = Visibility.Hidden;
                AdditionalInf.Visibility = Visibility.Visible;
                AllCou.Items.Clear();
                sights.Clear();

                if (File.Exists("../../allcountries.xml"))
                {
                    countries = Ser.DeSerialize(countries);
                    foreach (var item in countries.ListCou)
                    {
                        AllCou.Items.Add(item.Name);

                        foreach (var s in item.LSight)
                        {
                            Sort.S(item.LSight);
                            sights.Add(s);
                        }
                    }
                }

                Log.L("Вход в режим пользователя; " + DateTime.Now);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Warning);
                Log.L("Ошибка! " + ex.Message);
            }
        }