Exemplo n.º 1
0
        /// <summary>
        /// creates a new tab when a item from the CBox is selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CbCountry_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Country selected;

            try
            {
                selected = (Country)CbCountry.SelectedItem;

                if (selected == null || CbCountry.SelectedIndex == 0)
                {
                    return;
                }

                if (!network)
                {
                    selected = dataService.QueryCountry(selected.Alpha3Code);
                }

                //creates the UserControl
                var newTab = new ShowCountryDetails(selected);

                //adds the selected item name(country) and the usercontrol page to the viewModel to be presented in the tab
                CountryTab tab = new CountryTab(selected.Name, newTab);

                CountryMainViewModel.AddTab(tab);

                CountryTabs.SelectedItem = tab;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Event click Button About
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnAbout_Click(object sender, RoutedEventArgs e)
        {
            string name = "About";

            About page = new About();

            AboutTab tab = new AboutTab(name, page);

            CountryMainViewModel.AddTab(tab);

            CountryTabs.SelectedItem = tab;
        }
Exemplo n.º 3
0
        /// <summary>
        /// creates an help page and displays it
        /// </summary>
        private void HelpPageLoad()
        {
            string name = "Help";

            HelpPage page = new HelpPage();

            HelpTab tab = new HelpTab(name, page);

            CountryMainViewModel.AddTab(tab);

            CountryTabs.SelectedItem = tab;
        }
        private void Hyperlink_Click(object sender, RoutedEventArgs e)
        {
            SQLService fast = new SQLService();

            Hyperlink hp = (Hyperlink)e.Source;

            var search = fast.QueryCountry(hp.DataContext.ToString());

            ShowCountryDetails border = new ShowCountryDetails(search);

            CountryTab newTab = new CountryTab(search.Name, border);

            CountryMainViewModel.AddTab(newTab);
        }
Exemplo n.º 5
0
        public MainWindow()
        {
            #region Init Attributes
            countriesTab = new CountryMainViewModel();
            Countries    = new List <Country>();
            dataService  = new SQLService();
            network      = true;
            firstRun     = true;
            filtered     = new List <Country>();
            Regions      = new List <string>();
            SubRegions   = new List <string>();
            #endregion

            InitializeComponent();

            StartClock();

            DataContext = countriesTab;

            HelpPageLoad();

            LoadContent();
        }