private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            // clear
            PanelCountries.Children.Clear();
            TextBlockOrga.Text    = "";
            TextBlockTitle.Text   = "";
            TextBlockFurther.Text = "";

            // acccess
            var data = this.DataContext as DocumentEntity;

            if (data == null)
            {
                // uups!
                return;
            }

            // set contries
            if (data.CountryCodes != null)
            {
                foreach (var cc in data.CountryCodes)
                {
                    if (cc != null && cc.Trim().Length > 0)
                    {
                        var codeStr = cc.Trim().ToUpper();
                        foreach (var ev in (CountryFlag.CountryCode[])Enum.GetValues(typeof(CountryFlag.CountryCode)))
                        {
                            if (Enum.GetName(typeof(CountryFlag.CountryCode), ev)?.Trim().ToUpper() == codeStr)
                            {
                                var cf = new CountryFlag.CountryFlag();
                                cf.Code  = ev;
                                cf.Width = 20;
                                PanelCountries.Children.Add(cf);
                                break;
                            }
                        }
                    }
                }
            }

            // set orga
            TextBlockOrga.Text = "" + data.Organization;

            // set title
            TextBlockTitle.Text = "" + data.Title;

            // set further
            TextBlockFurther.Text = "" + data.FurtherInfo;

            // Image to be (later) shown
            if (data.ImgContainer != null)
            {
                BorderPlaceholder.Background      = Brushes.White;
                BorderPlaceholder.BorderThickness = new Thickness(1);
                BorderPlaceholder.BorderBrush     = Brushes.DarkGray;
                BorderPlaceholder.Child           = data.ImgContainer;
            }
        }
예제 #2
0
        //=======================

        public void ResetCountryRadioButton(RadioButton radio, CountryFlag.CountryCode code)
        {
            if (radio != null && radio.Content != null && radio.Content is WrapPanel wrap)
            {
                wrap.Children.Clear();
                var cf = new CountryFlag.CountryFlag();
                cf.Code  = code;
                cf.Width = 30;
                wrap.Children.Add(cf);
            }
        }
예제 #3
0
        private void country_listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                ListBox lst = sender as ListBox;
                CountryFlag.CountryFlag code = (lst.SelectedItem as ListBoxItem).Content as CountryFlag.CountryFlag;
                pf.Country = code.Code.ToString();
            }
            catch (Exception ex)
            {
            }

            // MessageBox.Show(code.Code.ToString());
        }