Ejemplo n.º 1
0
        /// <summary>
        /// 添加组合框
        /// </summary>
        /// <param name="textName"></param>
        /// <param name="isIndependent"></param>
        public ComboBox GetComboBox(List <String> childTextName, int index, SelectionChangedEventHandler selectionChangedEvent)
        {
            ComboBox cb = new ComboBox();

            cb.SelectedIndex   = 0;
            cb.FontSize        = 16;
            cb.BorderThickness = new Thickness(2);
            cb.Foreground      = new SolidColorBrush(Colors.White);
            cb.Background      = new SolidColorBrush(Color.FromRgb(43, 43, 43));
            cb.BorderBrush     = new SolidColorBrush(Color.FromRgb(31, 31, 31));
            cb.Padding         = new Thickness(10, 5, 10, 5);
            //cb.Margin = new Thickness(16, 0, 0, 0);
            foreach (String child in childTextName)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.SetResourceReference(StyleProperty, "ComboBoxItemStyle1");
                item.Foreground = new SolidColorBrush(Colors.White);
                item.FontSize   = 16;
                item.SetResourceReference(ContentProperty, child);
                cb.Items.Add(item);
            }
            cb.SelectedIndex = index;
            if (selectionChangedEvent != null)
            {
                cb.SelectionChanged += selectionChangedEvent;
            }
            return(cb);
        }
        private void cbOrigin_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cbOrigin.SelectedItem != null)
            {
                cbDestination.Items.Clear();

                Airport origin = (Airport)cbOrigin.SelectedItem;

                Route.RouteType type = this.Airliner.Airliner.Type.TypeAirliner == AirlinerType.TypeOfAirliner.Cargo ? Route.RouteType.Cargo : Route.RouteType.Passenger;

                var routes = this.Airliner.Airliner.Airline.Routes.Where(r => r.Type == type && (r.Destination1 == origin || r.Destination2 == origin));//.Select(r => r.Destination1 == origin ? r.Destination2 : r.Destination1);

                foreach (Route route in routes)
                {
                    Airport destination = route.Destination1 == origin ? route.Destination2 : route.Destination1;

                    ComboBoxItem itemRoute = new ComboBoxItem();
                    itemRoute.SetResourceReference(ComboBoxItem.ContentTemplateProperty, "AirportIATACountryItem");
                    itemRoute.Tag     = route;
                    itemRoute.Content = destination;
                    cbDestination.Items.Add(itemRoute);
                }


                cbDestination.SelectedIndex = 0;
            }
        }
Ejemplo n.º 3
0
        void UC_ImportLan_Loaded(object sender, RoutedEventArgs e)
        {
            this.txtLanPwd.LostFocus += txtLanPwd_LostFocus;

            ComboBoxItem item = new ComboBoxItem();

            item.DataContext = Enums.ImportOperationType.Refresh;
            item.Content     = TryFindResource("ImportOperationRefersh").ToString();
            item.SetResourceReference(ComboBoxItem.StyleProperty, "ControlBaseStyle");
            cmbImoprtOptions.Items.Add(item);

            item             = new ComboBoxItem();
            item.DataContext = Enums.ImportOperationType.Update;
            item.SetResourceReference(ComboBoxItem.ContentProperty, "ImportOperationUpdate");
            item.SetResourceReference(ComboBoxItem.StyleProperty, "ControlBaseStyle");
            cmbImoprtOptions.Items.Add(item);

            item             = new ComboBoxItem();
            item.DataContext = Enums.ImportOperationType.Append;
            item.SetResourceReference(ComboBoxItem.ContentProperty, "ImportOperationAppend");
            item.SetResourceReference(ComboBoxItem.StyleProperty, "ControlBaseStyle");
            cmbImoprtOptions.Items.Add(item);
            btnBrowse.Click += btnBrowse_Click;
        }
Ejemplo n.º 4
0
 private void CreateItems(string elements)
 {
     Items.Clear();
     string[] labels = elements.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
     foreach (string label in labels)
     {
         if (label.Length > 0)
         {
             var cbi = new ComboBoxItem();
             cbi.SetResourceReference(StyleProperty, "ComboBoxItemStyle");
             cbi.Content = label;
             Items.Add(cbi);
         }
     }
 }
Ejemplo n.º 5
0
        private void InitComboBoxLabel()
        {
            ComboBox_Languages.SelectionChanged -= ComboBox_Languages_SelectionChanged;
            String languages = GetKey("languages");

            if (!String.IsNullOrEmpty(languages))
            {
                _lang_array = languages.Split(',');
                for (int i = 0; i < _lang_array.Length; i++)
                {
                    ComboBoxItem item = new ComboBoxItem();
                    item.SetResourceReference(ComboBoxItem.ContentProperty, "_" + _lang_array[i]);
                    ComboBox_Languages.Items.Add(item);
                }
            }
            ComboBox_Languages.Text              = FindResource("_Culture_Lang").ToString();
            ComboBox_Languages.SelectionChanged += ComboBox_Languages_SelectionChanged;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加组合框
        /// </summary>
        /// <param name="textName"></param>
        /// <param name="isIndependent"></param>
        public void AddTitleAndComboBox(String titleName, List <String> childTextName, SelectionChangedEventHandler selectionChangedEvent)
        {
            ComboBox cb = new ComboBox();

            cb.SelectedIndex = 0;
            cb.FontSize      = 16;
            cb.Background    = new SolidColorBrush(Color.FromArgb(255, 240, 240, 240));
            cb.Foreground    = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
            cb.Margin        = new Thickness(0, 10, 0, 0);
            if (selectionChangedEvent != null)
            {
                cb.SelectionChanged += selectionChangedEvent;
            }
            foreach (String child in childTextName)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.SetResourceReference(ContentProperty, child);
                cb.Items.Add(item);
            }
            _UI.Add(cb);
        }
Ejemplo n.º 7
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_cbDisplayMode_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // e_40 element
     ComboBoxItem e_40 = new ComboBoxItem();
     e_40.Name = "e_40";
     e_40.SetResourceReference(ComboBoxItem.ContentProperty, "FullscreenText");
     items.Add(e_40);
     // e_41 element
     ComboBoxItem e_41 = new ComboBoxItem();
     e_41.Name = "e_41";
     e_41.SetResourceReference(ComboBoxItem.ContentProperty, "WindowedText");
     items.Add(e_41);
     // e_42 element
     ComboBoxItem e_42 = new ComboBoxItem();
     e_42.Name = "e_42";
     e_42.SetResourceReference(ComboBoxItem.ContentProperty, "BorderlessText");
     items.Add(e_42);
     return items;
 }
Ejemplo n.º 8
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_cbLanguage_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // e_32 element
     ComboBoxItem e_32 = new ComboBoxItem();
     e_32.Name = "e_32";
     e_32.Tag = "en";
     e_32.SetResourceReference(ComboBoxItem.ContentProperty, "EnglishText");
     items.Add(e_32);
     // e_33 element
     ComboBoxItem e_33 = new ComboBoxItem();
     e_33.Name = "e_33";
     e_33.Tag = "de";
     e_33.SetResourceReference(ComboBoxItem.ContentProperty, "GermanText");
     items.Add(e_33);
     // e_34 element
     ComboBoxItem e_34 = new ComboBoxItem();
     e_34.Name = "e_34";
     e_34.Tag = "fr";
     e_34.SetResourceReference(ComboBoxItem.ContentProperty, "FrenchText");
     items.Add(e_34);
     // e_35 element
     ComboBoxItem e_35 = new ComboBoxItem();
     e_35.Name = "e_35";
     e_35.Tag = "cs";
     e_35.SetResourceReference(ComboBoxItem.ContentProperty, "CzechText");
     items.Add(e_35);
     return items;
 }
Ejemplo n.º 9
0
 private static System.Collections.ObjectModel.ObservableCollection<object> Get_cbDifficulty_Items() {
     System.Collections.ObjectModel.ObservableCollection<object> items = new System.Collections.ObjectModel.ObservableCollection<object>();
     // e_28 element
     ComboBoxItem e_28 = new ComboBoxItem();
     e_28.Name = "e_28";
     e_28.SetResourceReference(ComboBoxItem.ContentProperty, "EasyDifficultyText");
     items.Add(e_28);
     // e_29 element
     ComboBoxItem e_29 = new ComboBoxItem();
     e_29.Name = "e_29";
     e_29.SetResourceReference(ComboBoxItem.ContentProperty, "NormalDifficultyText");
     items.Add(e_29);
     // e_30 element
     ComboBoxItem e_30 = new ComboBoxItem();
     e_30.Name = "e_30";
     e_30.SetResourceReference(ComboBoxItem.ContentProperty, "HardDifficultyText");
     items.Add(e_30);
     return items;
 }
Ejemplo n.º 10
0
        // Verified
        public UsersVM()
        {
            dbContext = AppDBContext.GetInstance();
            dbContext.UsersMs.Load();

            // Margin
            Thickness temp = new Thickness(5);

            // Назначение свойств пачке контролов
            // Лэйбл "Фамилия", назначение текста, строки и колонки в Grid
            Surname = new TextBlock();
            Surname.SetResourceReference(TextBlock.TextProperty, "Text_Surname");
            Grid.SetRow(Surname, 0);
            Grid.SetColumn(Surname, 0);

            // Лэйбл "Имя", назначение текста, строки и колонки в Grid
            Name = new TextBlock();
            Name.SetResourceReference(TextBlock.TextProperty, "Text_Name");
            Grid.SetRow(Name, 1);
            Grid.SetColumn(Name, 0);

            // Лэйбл "Отчество", назначение текста, строки и колонки в Grid
            Lastname = new TextBlock();
            Lastname.SetResourceReference(TextBlock.TextProperty, "Text_Lastname");
            Grid.SetRow(Lastname, 2);
            Grid.SetColumn(Lastname, 0);

            // Лэйбл "Пол", назначение текста, строки и колонки в Grid
            Sex = new TextBlock();
            Sex.SetResourceReference(TextBlock.TextProperty, "Text_Sex");
            Grid.SetRow(Sex, 3);
            Grid.SetColumn(Sex, 0);

            // Лэйбл "Дата рождения", назначение текста, строки и колонки в Grid
            Birthday = new TextBlock();
            Birthday.SetResourceReference(TextBlock.TextProperty, "Text_Birthday");
            Grid.SetRow(Birthday, 4);
            Grid.SetColumn(Birthday, 0);

            // Лэйбл "Логин", назначение текста, строки и колонки в Grid
            Login = new TextBlock();
            Login.SetResourceReference(TextBlock.TextProperty, "Text_Login");
            Grid.SetRow(Login, 5);
            Grid.SetColumn(Login, 0);

            // Лэйбл "Пароль", назначение текста, строки и колонки в Grid
            Password = new TextBlock();
            Password.SetResourceReference(TextBlock.TextProperty, "Text_Password");
            Grid.SetRow(Password, 6);
            Grid.SetColumn(Password, 0);

            // Лэйбл "Уровень доступа", назначение текста, строки и колонки в Grid
            Access = new TextBlock();
            Access.SetResourceReference(TextBlock.TextProperty, "Text_Access");
            Grid.SetRow(Access, 7);
            Grid.SetColumn(Access, 0);

            // Лэйбл "Денежный счёт", назначение текста, строки и колонки в Grid
            Bill = new TextBlock();
            Bill.SetResourceReference(TextBlock.TextProperty, "Text_Bill");
            Grid.SetRow(Bill, 8);
            Grid.SetColumn(Bill, 0);

            // Текстбокс "Фамилия", назначение отсутпа (Margin), строки и колонки в Grid
            surname        = new TextBox();
            surname.Margin = temp;
            Grid.SetRow(surname, 0);
            Grid.SetColumn(surname, 1);

            // Текстбокс "Имя", назначение отсутпа (Margin), строки и колонки в Grid
            name        = new TextBox();
            name.Margin = temp;
            Grid.SetRow(name, 1);
            Grid.SetColumn(name, 1);

            // Текстбокс "Отчество", назначение отсутпа (Margin), строки и колонки в Grid
            lastname        = new TextBox();
            lastname.Margin = temp;
            Grid.SetRow(lastname, 2);
            Grid.SetColumn(lastname, 1);

            // Комбобокс "Пол", назначение отсутпа (Margin), строки и колонки в Grid
            // А также, назначение элементов комбобокс: "Мужской" и "Женский"
            sex        = new ComboBox();
            sex.Margin = temp;
            Grid.SetRow(sex, 3);
            Grid.SetColumn(sex, 1);

            // Вытягивание полов из ресурсов
            ComboBoxItem male = new ComboBoxItem();

            male.SetResourceReference(ComboBoxItem.ContentProperty, "Text_Male");

            ComboBoxItem female = new ComboBoxItem();

            female.SetResourceReference(ComboBoxItem.ContentProperty, "Text_Female");

            // Назначение элементов комбобокс
            sex.Items.Insert(0, male);
            sex.Items.Insert(1, female);
            sex.SelectedIndex = 0;

            // Текстбокс "Дата рождения", назначение отсутпа (Margin), строки и колонки в Grid
            birthday        = new TextBox();
            birthday.Margin = temp;
            Grid.SetRow(birthday, 4);
            Grid.SetColumn(birthday, 1);

            // Текстбокс "Логин", назначение отсутпа (Margin), строки и колонки в Grid
            login        = new TextBox();
            login.Margin = temp;
            Grid.SetRow(login, 5);
            Grid.SetColumn(login, 1);

            // Текстбокс "Пароль", назначение отсутпа (Margin), строки и колонки в Grid
            password        = new TextBox();
            password.Margin = temp;
            Grid.SetRow(password, 6);
            Grid.SetColumn(password, 1);

            // Комбобокс "Уровень доступа", назначение отсутпа (Margin), строки и колонки в Grid
            // А также, назначение элементов комбобокс: "Админ" и "Юзер"
            access        = new ComboBox();
            access.Margin = temp;
            Grid.SetRow(access, 7);
            Grid.SetColumn(access, 1);

            // Вытягивание access'ов из ресурсов
            ComboBoxItem admin = new ComboBoxItem();

            admin.SetResourceReference(ComboBoxItem.ContentProperty, "Text_Admin");

            ComboBoxItem user = new ComboBoxItem();

            user.SetResourceReference(ComboBoxItem.ContentProperty, "Text_User");

            // Назначение элементов комбобокс
            access.Items.Insert(0, admin);
            access.Items.Insert(1, user);
            access.SelectedIndex = 0;

            // Текстбокс "Денежный счёт", назначение отсутпа (Margin), строки и колонки в Grid
            bill        = new TextBox();
            bill.Margin = temp;
            Grid.SetRow(bill, 8);
            Grid.SetColumn(bill, 1);

            SourceList = dbContext.UsersMs.Local.ToBindingList();
        }