상속: Windows.UI.Xaml.Controls.Primitives.Selector, IComboBox, IComboBoxOverrides
예제 #1
0
        protected override async void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _dayComboBox = (ComboBox)GetTemplateChild("DayComboBox");
            _monthComboBox = (ComboBox)GetTemplateChild("MonthComboBox");
            _yearComboBox = (ComboBox)GetTemplateChild("YearComboBox");
            _dayComboBox.SelectionChanged += OnDaySelectionChanged;
            _monthComboBox.SelectionChanged += OnMonthSelectionChanged;
            _yearComboBox.SelectionChanged += OnYearSelectionChanged;
            ApplyComboBoxStyle(ComboBoxStyle);

            if (_preventReentrancy)
                return;

            _preventReentrancy = true;
            try
            {
                await PopulateDropdowns(SelectedDate, MinDate, MaxDate);
            }
            finally
            {
                _preventReentrancy = false;
            }
        }
예제 #2
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _primarySelector = GetTemplateChild("PrimarySelector") as ComboBox;
            _secondarySelector = GetTemplateChild("SecondarySelector") as ComboBox;
            _tertiarySelector = GetTemplateChild("TertiarySelector") as ComboBox;
        }
        public async Task<String> signup(String username, String email, String password, ComboBox gender, DatePicker birthdate, ProgressBar progressBar)
        {
            HttpResponseMessage response = null;
            String responseString = null;

            _progressBar = progressBar;

            try
            {
                String formatted_gender = "";
                if (gender.SelectedIndex != -1)
                {
                    formatted_gender = ((ComboBoxItem)gender.SelectedItem).Content.ToString();
                }

                if (password != "")
                {
                    password = h.sha512(password);
                }

                String year = birthdate.Date.Year.ToString();
                String month = birthdate.Date.Month.ToString().PadLeft(2, '0');
                String day = birthdate.Date.Day.ToString().PadLeft(2, '0');
                String formatted_birthdate = year + "-" + month + "-" + day;
                var values = new Dictionary<string, string>
            {
                    { "username", username },
                    { "email", email },
                    { "password", password },
                    { "gender", formatted_gender },
                    { "birthdate", formatted_birthdate }
            };

                HttpFormUrlEncodedContent formContent = new HttpFormUrlEncodedContent(values);

                IProgress<HttpProgress> progress = new Progress<HttpProgress>(ProgressHandler);
                _progressBar.Visibility = Windows.UI.Xaml.Visibility.Visible;
                response = await httpClient.PostAsync(new Uri(settings.API + "/register/"), formContent).AsTask(cts.Token, progress);
                responseString = await response.Content.ReadAsStringAsync();
                Debug.WriteLine("register | responseString: " + responseString);
            }
            catch (TaskCanceledException)
            {
                Debug.WriteLine("register | Canceled");
            }
            catch (Exception ex)
            {
                Debug.WriteLine("register | Error: " + ex.StackTrace);
            }
            finally {
                Debug.WriteLine("register | Completed");
                resetProgressBar();
            }

            return responseString;
        }
예제 #4
0
 private static string ReadSelectString(ComboBox box)
 {
     var select = box.SelectedValue as ComboBoxItem;
     if (select != null)
     {
         return select.Content.ToString();
     }
     else
     {
         return string.Empty;
     }
 }
예제 #5
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            yearTextBox = GetTemplateChild(ElementYearTextBox) as YearTextBox;
            monthComboBox = GetTemplateChild(ElementMonthComboBox) as ComboBox;
            dayComboBox = GetTemplateChild(ElementDayComboBox) as ComboBox;

            yearTextBox.TextChanged += YearTextBoxOnTextChanged;
            monthComboBox.SelectionChanged += MonthComboBoxOnSelectionChanged;
            dayComboBox.SelectionChanged += DayComboBoxOnSelectionChanged;

            InitializeForDate(DateTime.Today);
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///MainPage.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            ContentRoot = (Windows.UI.Xaml.Controls.Grid)this.FindName("ContentRoot");
            Header = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("Header");
            ContentPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("ContentPanel");
            cboSelectFile = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboSelectFile");
            btnCalculateTotal = (Windows.UI.Xaml.Controls.Button)this.FindName("btnCalculateTotal");
            LblReadFile = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("LblReadFile");
            LblReadOriginalFile = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("LblReadOriginalFile");
        }
예제 #7
0
        //  public static void LoadXml(ComboBox ComboBoxTestowy)
        //  {
        //      List<Waluta> lista = new List<Waluta>();
        //      XmlReader xmlreader = XmlReader.Create("http://www.nbp.pl/kursy/xml/c148z150803.xml");
        //      while (xmlreader.Read())
        //      {
        //          Waluta _nowa = new Waluta();
        //          xmlreader.ReadToFollowing("nazwa_waluty");
        //          if(xmlreader.IsStartElement()){
        //                  switch (xmlreader.Name)
        //                  {
        //                      case "nazwa_waluty":
        //                          if (xmlreader.Read()) _nowa.nazwaWaluty = xmlreader.Value.Trim();
        //                          break;
        //                      case "przelicznik":
        //                          if (xmlreader.Read()) _nowa.przelicznik = int.Parse(xmlreader.Value.Trim());
        //                          break;
        //                      case "kod_waluty":
        //                          if (xmlreader.Read()) _nowa.kodWaluty = xmlreader.Value.Trim();
        //                          break;
        //                      case "kurs_kupna":
        //                          if (xmlreader.Read()) _nowa.kursKupna = decimal.Parse(xmlreader.Value.Trim());
        //                          break;
        //                      case "kurs_sprzedazy":
        //                          if (xmlreader.Read()) _nowa.kursSprzedazy = decimal.Parse(xmlreader.Value.Trim());
        //                          break;
        //                      default:
        //                          break;
        //                  }
        //                  lista.Add(_nowa);
        //              ComboBoxTestowy.Items.Add(_nowa);
        //
        //              }
        //      }
        //     // MessageDialog msg = new MessageDialog(lista[6].kodWaluty);
        //     // msg.ShowAsync();
        //  }
        public static void LoadXml(ComboBox ComboBoxTestowy)
        {
            int licznik = 0;
               using (XmlReader reader = XmlReader.Create("http://www.nbp.pl/kursy/xml/c148z150803.xml"))
               {
               string _nazwaWaluty = "polski złoty";
               int _przelicznik = 1;
               string _kodWaluty = "PLN";
               decimal _kursKupna = 1;
               decimal _kursSprzedazy = 1;
               while (reader.Read())
               {
                   if (reader.IsStartElement())
                   {
                       switch (reader.Name.ToString())
                       {
                           case "pozycja":
                               Waluta _nowa = new Waluta(_nazwaWaluty,_przelicznik,_kodWaluty,_kursKupna,_kursSprzedazy);
                               ComboBoxTestowy.Items.Add(_nowa);
                               licznik++;
                               break;
                           case "nazwa_waluty":
                               _nazwaWaluty = reader.ReadElementContentAsString();
                               break;
                           case "przelicznik":
                               _przelicznik = int.Parse(reader.ReadElementContentAsString());
                               break;
                           case "kod_waluty":
                               _kodWaluty = reader.ReadElementContentAsString();
                               break;
                           case "kurs_kupna":
                               _kursKupna = decimal.Parse(reader.ReadElementContentAsString());
                               break;
                           case "kurs_sprzedazy":
                               _kursSprzedazy = decimal.Parse(reader.ReadElementContentAsString());
                               break;
                       }
                  }

                }

               }
               MessageDialog msg = new MessageDialog(licznik.ToString());
               msg.ShowAsync();
        }
예제 #8
0
        public override FrameworkElement buildFieldView()
        {
            ComboBox comboBox = new ComboBox();
            comboBox.FontSize = getSkin().getFieldFontSize();
            comboBox.FontFamily = getSkin().getFieldFont();
            //note - do not set color - should be according to wp theme

            List<String> optionsList = convertOptionsIntoList();
            if (optionsList != null)
            {
                comboBox.ItemsSource = optionsList;
            }
            if (getField().getFieldInfo().isReadOnly())
            {
                comboBox.IsEnabled = false;
            }
            return comboBox;
        }
        private void ButtonSendTileNotification_Click(object sender, RoutedEventArgs e)
        {
            TileBindingContentAdaptive bindingContent = new TileBindingContentAdaptive()
            {
            Children =
            {
            GenerateEmailGroup("Jennifer Parker", "Photos from our trip"),
            GenerateEmailGroup("Steve Bosniak", "Want to go out for dinner after Build tonight?")
            }
            };

            TileBinding binding = new TileBinding()
            {
            Content = bindingContent
            };

            TileContent content = new TileContent()
            {
            Visual = new TileVisual()
            {
            TileMedium = binding
            }
            };

            DataPackage dp = new DataPackage();
            dp.SetText(content.GetContent());
            Clipboard.SetContent(dp);
            return;

            string xmlAsString = content.GetContent();
            TileNotification notification = new TileNotification(content.GetXml());

            content.Visual.TileMedium = new TileBinding()
            {
                Branding = TileBranding.Logo,

                Content = new TileBindingContentAdaptive()
            };

            ComboBox comboBox = new ComboBox();
            //var tileContent = NotificationsExtensions.GenerateTileContent();
            //TileNotification notif = new TileNotification(null);
            //ITileSquareText01 tileContent = TileContentFactory.CreateTileSquareText01();
        }
예제 #10
0
        public void CreateField(DetailFormHelper helper, FieldData fieldData)
        {
            var dropDownField = fieldData as DropDownFieldData;
            if (dropDownField == null)
            {
                throw new ArgumentNullException(nameof(dropDownField));
            }

            int rowNr;
            helper.AddRow(fieldData, out rowNr);

            var itemsSource = dropDownField.values.Select(x => new DropDownItem(x)).ToList();
            var dropDown = new ComboBox
            {
                ItemsSource = itemsSource,
                Margin = new Thickness(5),
                Width = 200
            };

            // Tries to find the selected element
            var value = DetailFormHelper.GetValue(helper.DataElement, fieldData.name, fieldData.defaultValue);
            var found = itemsSource.FirstOrDefault(x => x.value == value);
            dropDown.SelectedItem = found;

            Grid.SetColumn(dropDown, 1);
            Grid.SetRow(dropDown, rowNr);

            helper.GridFields.Children.Add(dropDown);

            helper.BindingActions.Add(
                () =>
                {
                    var selectedValue = dropDown.SelectedValue as DropDownItem;
                    if (selectedValue != null)
                    {
                        helper.DataElement.set(fieldData.name, selectedValue?.value);
                    }
                    else
                    {
                        helper.DataElement.unset(fieldData.name);
                    }
                });
        }
예제 #11
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _selectedMonth = Value.Month - 1;
            _selectedDay = Value.Day;
            _selectedYear = Value.Year;

            _months = GetTemplateChild("Months") as ComboBox;
            if (_months != null) _months.ItemsSource = MonthsNames;
            _days = GetTemplateChild("Days") as ComboBox;
            _years = GetTemplateChild("Years") as ComboBox;
            if (_years != null) _years.ItemsSource = Enumerable.Range(DateTime.Now.Year - 100, 200);

            UpdateByDateTime(Value);

            OnPropertyChanged("SelectedDay");
            OnPropertyChanged("SelectedMonthName");
            OnPropertyChanged("SelectedYear");

        }
예제 #12
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.  The Parameter
        /// property is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Add some custom (non-AppBarButton) content
            leftPanel = rootPage.FindName("LeftPanel") as StackPanel;

            foreach (UIElement element in leftPanel.Children)
            {
                leftItems.Add(element);
            }
            leftPanel.Children.Clear();

            // Create a combo box
            ComboBox cb = new ComboBox();
            cb.Height = 32.0;
            cb.Width = 100.0;
            cb.Items.Add("Baked");
            cb.Items.Add("Fried");
            cb.Items.Add("Frozen");
            cb.Items.Add("Chilled");

            cb.SelectedIndex = 0;

            leftPanel.Children.Add(cb);

            // Create a text box
            TextBox tb = new TextBox();
            tb.Text = "Search for desserts.";
            tb.Width = 300.0;
            tb.Height = 30.0;
            tb.Margin = new Thickness(10.0, 0.0, 0.0, 0.0);
            tb.GotFocus += tb_GotFocus;

            leftPanel.Children.Add(tb);

            // Add a button
            Button b = new Button();
            b.Content = "Search";
            b.Click += b_Click;

            leftPanel.Children.Add(b);
        }
        public static int SetupAudioChannel(ComboBox comboBox)
        {
            List<ComboBoxData> audioChannelList = new List<ComboBoxData>();
            audioChannelList.Add(new ComboBoxData() { DataName = "1", DataValueInt = 1 });
            audioChannelList.Add(new ComboBoxData() { DataName = "2", DataValueInt = 2 });
            audioChannelList.Add(new ComboBoxData() { DataName = "3", DataValueInt = 3 });
            audioChannelList.Add(new ComboBoxData() { DataName = "4", DataValueInt = 4 });
            audioChannelList.Add(new ComboBoxData() { DataName = "5", DataValueInt = 5 });
            audioChannelList.Add(new ComboBoxData() { DataName = "6", DataValueInt = 6 });
            comboBox.ItemsSource = audioChannelList;

            AppSettings settings = new AppSettings();
            int audioChannelsSetting = settings.GetAppSettingInt("audio_channels");
            if (audioChannelsSetting == -1)
            {
                audioChannelsSetting = 6;
            }
            comboBox.SelectedItem = audioChannelList[GetSelectedIntItem(audioChannelList, audioChannelsSetting)];

            return audioChannelsSetting;
        }
예제 #14
0
        // A pointer back to the main page.  This is needed if you want to call methods in MainPage such
        // as NotifyUser()
        //MainPage rootPage = MainPage.Current;
        public SettingsFlyout()
        {
            this.InitializeComponent();

            ComboBoxItem light = new ComboBoxItem();
            light.Name = "Light";
            ComboBoxItem dark = new ComboBoxItem();
            dark.Name = "Dark";
            ComboBoxItem gators = new ComboBoxItem();
            gators.Name = "Gators";
            ThemeBox.Items.Add(light);
            ThemeBox.Items.Add(dark);
            ThemeBox.Items.Add(gators);

            FlyoutContent.Transitions = new TransitionCollection();
            FlyoutContent.Transitions.Add(new EntranceThemeTransition()
            {
                FromHorizontalOffset = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? ContentAnimationOffset : (ContentAnimationOffset * -1)
            });

            ThemeBox = new ComboBox();
        }
        // Fill the specified ComboBox with user data accounts.
        public async Task LoadDataAccountsAsync(ComboBox comboBox)
        {
            // Requires the email, contacts, or appointments capability in the app's manifest.
            UserDataAccountStore store = await UserDataAccountManager.RequestStoreAsync(UserDataAccountStoreAccessType.AllAccountsReadOnly);

            if (store != null)
            {
                IReadOnlyList<UserDataAccount> userDataAccounts = await store.FindAccountsAsync();
                comboBox.DataContext = new ObservableCollection<UserDataAccount>(userDataAccounts);

                if (userDataAccounts.Count > 0)
                {
                    comboBox.SelectedIndex = 0;
                }
            }
            else
            {
                // If the store is null, that means all access to Contacts, Calendar and Email data 
                // has been revoked.
                NotifyUser("Access to Contacts, Calendar and Email has been revoked", NotifyType.ErrorMessage);
            }
        }
        public static int SetupAudioBitrate(ComboBox comboBox)
        {
            List<ComboBoxData> audioBitrateItems = new List<ComboBoxData>();
            audioBitrateItems.Add(new ComboBoxData() { DataName = "720 K", DataValueInt = 720000 });
            audioBitrateItems.Add(new ComboBoxData() { DataName = "448 K", DataValueInt = 448000 });
            audioBitrateItems.Add(new ComboBoxData() { DataName = "320 K", DataValueInt = 320000 });
            audioBitrateItems.Add(new ComboBoxData() { DataName = "256 K", DataValueInt = 256000 });
            audioBitrateItems.Add(new ComboBoxData() { DataName = "196 K", DataValueInt = 196000 });
            audioBitrateItems.Add(new ComboBoxData() { DataName = "128 K", DataValueInt = 128000 });
            audioBitrateItems.Add(new ComboBoxData() { DataName = "96 K", DataValueInt = 96000 });
            audioBitrateItems.Add(new ComboBoxData() { DataName = "64 K", DataValueInt = 64000 });
            comboBox.ItemsSource = audioBitrateItems;

            AppSettings settings = new AppSettings();
            int audioBitrateSetting = settings.GetAppSettingInt("audio_bitrate");
            if (audioBitrateSetting == -1)
            {
                audioBitrateSetting = 128000;
            }
            comboBox.SelectedItem = audioBitrateItems[GetSelectedIntItem(audioBitrateItems, audioBitrateSetting)];

            return audioBitrateSetting;
        }
        public void InitializeComponent()
        {
            if (_contentLoaded)
                return;

            _contentLoaded = true;
            Application.LoadComponent(this, new System.Uri("ms-appx:///SampleProfile.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
 
            txtName = (Windows.UI.Xaml.Controls.TextBox)this.FindName("txtName");
            cboCountry = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboCountry");
            cboJob = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboJob");
            cboBirthdayDay = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboBirthdayDay");
            cboBirthdayMonth = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboBirthdayMonth");
            cboBirthdayYear = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboBirthdayYear");
            cboHobby = (Windows.UI.Xaml.Controls.ComboBox)this.FindName("cboHobby");
            backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
            pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
            ApplicationViewStates = (Windows.UI.Xaml.VisualStateGroup)this.FindName("ApplicationViewStates");
            FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
            Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
            FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
            Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
        }
 public void ComboBoxToPin(Pi2Pin pin, ComboBox cb)
 {
     if (cb.SelectedIndex == 0)
     {
         pin.InOut = Pi2InOutValue.In;
         pin.HiLow = Pi2HiLowValue.Low;
     }
     else if (cb.SelectedIndex == 1)
     {
         pin.InOut = Pi2InOutValue.In;
         pin.HiLow = Pi2HiLowValue.Hi;
     }
     else if (cb.SelectedIndex == 2)
     {
         pin.InOut = Pi2InOutValue.Out;
         pin.HiLow = Pi2HiLowValue.Low;
     }
     else if (cb.SelectedIndex == 3)
     {
         pin.InOut = Pi2InOutValue.Out;
         pin.HiLow = Pi2HiLowValue.Hi;
     }
 }
예제 #19
0
        /// <summary>
        /// Calculates scores for the different sets. We'll run this method twice: Once for Pungs, once for Kongs
        /// </summary>
        /// <param name="TerminalsHonorsCheckBoxes"></param>
        /// <param name="ConcealedCheckBoxes"></param>
        /// <param name="baseValue"></param>
        private int SetsScore(ComboBox setsComboBox, List<CheckBox> TerminalsHonorsCheckBoxes, List<CheckBox> ConcealedCheckBoxes, int baseValue)
        {
            int setsNum = setsComboBox.SelectedIndex;
            int finalSetsValue = 0;

            for (int i = 0; i < setsNum; i++)
            {
                int thisSetValue = baseValue;

                if (TerminalsHonorsCheckBoxes[i].IsChecked == true)
                    thisSetValue *= 2;

                if (ConcealedCheckBoxes[i].IsChecked == true)
                    thisSetValue *= 2;

                finalSetsValue += thisSetValue;
            }

            return finalSetsValue;
        }
        public static int SetupVideoMaxWidth(ComboBox comboBox)
        {
            List<ComboBoxData> videoMaxWidthItems = new List<ComboBoxData>();
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "1920", DataValueInt = 1920 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "1600", DataValueInt = 1600 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "1440", DataValueInt = 1440 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "1280", DataValueInt = 1280 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "1024", DataValueInt = 1024 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "800", DataValueInt = 800 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "720", DataValueInt = 720 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "640", DataValueInt = 640 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "560", DataValueInt = 560 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "480", DataValueInt = 480 });
            videoMaxWidthItems.Add(new ComboBoxData() { DataName = "376", DataValueInt = 376 });
            comboBox.ItemsSource = videoMaxWidthItems;

            AppSettings settings = new AppSettings();
            int videoMaxWidthSetting = settings.GetAppSettingInt("video_max_width");
            if (videoMaxWidthSetting == -1)
            {
                videoMaxWidthSetting = 1920;
            }
            comboBox.SelectedItem = videoMaxWidthItems[GetSelectedIntItem(videoMaxWidthItems, videoMaxWidthSetting)];

            return videoMaxWidthSetting;
        }
 private void VideoSizesLoaded(object sender, RoutedEventArgs e)
 {
     videoSizes = (ComboBox) sender;
     videoSizes.SelectedItem = ViewModel.VideoSizes[ViewModel.CurrentVideoSize];
     videoSizes.Width = contentWidth;
 }
예제 #22
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _minutes = GetTemplateChild("Minutes") as ComboBox;
            _minutes.ItemsSource = Enumerable.Range(0, 60);

            UpdateByDateTime(Value);

            OnPropertyChanged("SelectedMinutes");

        }
예제 #23
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            _listItems = GetTemplateChild(ListItemsName) as ListView;
            if (_listItems != null)
            {
                _listItems.SelectionChanged += ListItemsSelectionChanged;
            }

            _semanticZoom = GetTemplateChild(SemanticZoomName) as SemanticZoom;
            _listChampsRecherche = GetTemplateChild(ListChampsRechercheName) as ComboBox;
            _suggestBox = GetTemplateChild(SuggestBoxName) as AutoSuggestBox;

            //Construction de la liste des champs dispos pour la recherche
            CreateItemsListChampsRecherche();

            if (_suggestBox != null && _listChampsRecherche != null)
            {
                if (_listChampsRecherche.ItemsSource == null)
                {
                    _suggestBox.IsEnabled = false;
                    _listChampsRecherche.IsEnabled = false;
                }
                _suggestBox.TextChanged += SuggestBoxTextChanged;
                _suggestBox.SuggestionChosen += SuggestBoxSuggestionChosen;
                _suggestBox.QuerySubmitted += SuggestBoxQuerySubmitted;
                _suggestBox.ItemsSource = _searchResults;
            }

            //Construction des items groupés pour la liste
            CreateItemsSource();
        }
예제 #24
0
 private string ReadLoanYears(ComboBox box)
 {
     int length = box.Items.Count();
     int selectedIndex = box.SelectedIndex;
     if (selectedIndex < length - 1)
     {
         return ((ComboBoxItem)box.SelectedItem).Content.ToString();
     }
     else
     {
         return OtherYears.Text;
     }
 }
        private async void RatingDialog(Bobs_Parties item)
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
            {

                var dialog = new ContentDialog()
                {
                    Title = "Rating",
                };

                // Setup Content
                var panel = new StackPanel();

                panel.Children.Add(new TextBlock
                {
                    Text = "Uw rit is ten einde, hoeveel rating wilt u deze bob geven? ",
                    TextWrapping = TextWrapping.Wrap,
                    Margin = new Thickness(0, 0, 0, 15)
                });

                List<string> items = new List<string>();
                for (int i = 1; i < 5; i++)
                {
                    items.Add(i.ToString());
                }
                var cb = new ComboBox
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch
                };
                cb.ItemsSource = items;

                var txt = new TextBox
                {
                    TextWrapping = TextWrapping.Wrap,
                    HorizontalContentAlignment = HorizontalAlignment.Stretch
                };



                panel.Children.Add(cb);
                panel.Children.Add(txt);
                dialog.Content = panel;

                // Add Buttons
                dialog.PrimaryButtonText = "Ok";
                dialog.PrimaryButtonClick += async delegate
                {
                    double rating;
                    string text = cb.SelectedValue.ToString();
                    string comment = txt.Text;

                    double.TryParse(text, out rating);


                    item.Rating = rating;

                    Response res = await TripRepository.AddRating(item);
                    var ok = res.Success;

                    if (ok == true || ok == false)
                    {
                        Libraries.Socket socketSendToUser = new Libraries.Socket()
                        {
                            To = MainViewVM.USER.ID,
                            Status = true,
                        };

                        MainViewVM.socket.Emit("trip_DONE:send", JsonConvert.SerializeObject(socketSendToUser));
                        
                        this.Map.MapElements.Clear();
                    }

                       
                 

                };



                // Show Dialog
                var result = await dialog.ShowAsync();
                if (result == ContentDialogResult.None)
                {

                }
            });
        }
        /// <summary>
        /// Helper Method to Create UI inside the ListBox for adding Productwise order details
        /// like Quantity
        /// </summary>
        void CreateBillUI()
        {
            stkPnlContainer = new StackPanel();
            stkPnlContainer.Orientation = Orientation.Horizontal;
            stkPnlContainer.Width = lstContainer.Width;
            stkPnlContainer.Height = 50;

            cmbProducts = new ComboBox();
            cmbProducts.ItemsSource = Products;
            cmbProducts.Width = 150;
            cmbProducts.Height = 50;
            cmbProducts.DisplayMemberPath = "ProductName";
            cmbProducts.SelectedValuePath = "ProductID";
            //Register to the event to generate Product details
            cmbProducts.SelectionChanged += cmbProducts_SelectionChanged;
            stkPnlContainer.Children.Add(cmbProducts);

            txtUnitPrice = new TextBox();
            txtUnitPrice.Width = 150;
            txtUnitPrice.Height = 50;
            txtUnitPrice.IsEnabled = false;
            txtUnitPrice.Text = "000";
            stkPnlContainer.Children.Add(txtUnitPrice);

            txtQuantity = new TextBox();
            txtQuantity.Width = 150;
            txtQuantity.Height = 50;
            txtQuantity.Text = "000";
            //Register to the event to generate bill for a Product
            txtQuantity.LostFocus += txtQuantity_LostFocus;
            stkPnlContainer.Children.Add(txtQuantity);

            txtProductwiseBill = new TextBox();
            txtProductwiseBill.Width = 150;
            txtProductwiseBill.Height = 50;
            txtProductwiseBill.Text = "000";
            txtProductwiseBill.IsEnabled = false;
            stkPnlContainer.Children.Add(txtProductwiseBill);

            ListBoxItem lst = new ListBoxItem();
            lst.Content = stkPnlContainer;
            lstContainer.Items.Add(lst);
        }
        // Button clicked events for Item Details, ratings, and shipping ***************************
        //


        /// <summary>
        /// On load of the quantity selection box, fill the box with the correct amount of options
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void quantityBox_Loaded(object sender, RoutedEventArgs e)
        {
            ComboBox box = (ComboBox)sender;

            // set page variable for accessing this box later
            quantityBox = box;

            if (listing.quantity > 1)
            {
                for (int i = 0; i < listing.quantity; i++)  // start at 1
                    quantityBox.Items.Add(i + 1);               // Add the quantity options to the dropdown
                quantityBox.SelectedIndex = 0;
            }
            else// hide the quantity options if there's only 1 available, and display text saying as much
            {
                quantityBox.Visibility = Visibility.Collapsed;
                if (listing.quantity == 1)
                    quantityBlock.Text = "1 available";
                else
                {
                    quantityBlock.Foreground = new SolidColorBrush(Colors.Red);
                    quantityBlock.Text = "sold out";
                }
            }
        }
예제 #28
0
        /// <summary>
        /// Set up possible kongs. This will change based on how many Pungs have been selected
        /// and resets the combo box when pungs are set
        /// </summary>
        /// <param name="pungComboBox"></param>
        private void InitializePossibleKongs(ComboBox pungComboBox)
        {
            PossibleKongs = new List<Set>();
            PossibleKongs.Add(noSets = new Set());

            if (pungCountComboBox.SelectedItem != null)
            {
                for (var i = 0; i < (4 - pungComboBox.SelectedIndex); i++)
                {
                    PossibleKongs.Add(PossiblePungs[i + 1]);
                }
            }
            kongCountComboBox.ItemsSource = PossibleKongs;
        }
예제 #29
0
        void GetPresetProfile(ComboBox combobox)
        {
            _Profile = null;
            VideoEncodingQuality videoEncodingProfile = VideoEncodingQuality.Wvga;
            switch (combobox.SelectedIndex)
            {
                case 0:
                    videoEncodingProfile = VideoEncodingQuality.HD1080p;
                    break;
                case 1:
                    videoEncodingProfile = VideoEncodingQuality.HD720p;
                    break;
                case 2:
                    videoEncodingProfile = VideoEncodingQuality.Wvga;
                    break;
                case 3:
                    videoEncodingProfile = VideoEncodingQuality.Ntsc;
                    break;
                case 4:
                    videoEncodingProfile = VideoEncodingQuality.Pal;
                    break;
                case 5:
                    videoEncodingProfile = VideoEncodingQuality.Vga;
                    break;
                case 6:
                    videoEncodingProfile = VideoEncodingQuality.Qvga;
                    break;
            }

            switch(_OutputType)
            {
                case "AVI":
                    _Profile = MediaEncodingProfile.CreateAvi(videoEncodingProfile);
                    break;
                case "WMV":
                    _Profile = MediaEncodingProfile.CreateWmv(videoEncodingProfile);
                    break;
                default:
                    _Profile = Windows.Media.MediaProperties.MediaEncodingProfile.CreateMp4(videoEncodingProfile);
                    break;
            }

            /*
            For transcoding to audio profiles, create the encoding profile using one of these APIs:
                MediaEncodingProfile.CreateMp3(audioEncodingProfile)
                MediaEncodingProfile.CreateM4a(audioEncodingProfile)
                MediaEncodingProfile.CreateWma(audioEncodingProfile)
                MediaEncodingProfile.CreateWav(audioEncodingProfile)

            where audioEncodingProfile is one of these presets:
                AudioEncodingQuality.High
                AudioEncodingQuality.Medium
                AudioEncodingQuality.Low
            */
        }
예제 #30
0
        /// <summary>
        /// Sets up the check boxes for pungs and kongs
        /// </summary>
        /// <param name="comboBox"></param>
        private void ShowSetCheckBoxes(ComboBox comboBox)
        {

            if (GetRoundWinner().CurrentWind == game.PrevailingWind)
                VisualStateManager.GoToState(this, "DoubleLuckyWind", true);
            else
                VisualStateManager.GoToState(this, "RegularLuckyWind", true);

            if (comboBox.Name == "pungCountComboBox")
            {
                ResetSetCheckBoxes("pung", comboBox.SelectedIndex);
                switch (comboBox.SelectedIndex)
                {
                    case -1:
                        VisualStateManager.GoToState(this, "NoPungsSelected", true);
                        break;
                    case 0:
                        VisualStateManager.GoToState(this, "NoPungsSelected", true);
                        break;
                    case 1:
                        VisualStateManager.GoToState(this, "OnePungSelected", true);
                        break;
                    case 2:
                        VisualStateManager.GoToState(this, "TwoPungsSelected", true);
                        break;
                    case 3:
                        VisualStateManager.GoToState(this, "ThreePungsSelected", true);
                        break;
                    case 4:
                        VisualStateManager.GoToState(this, "FourPungsSelected", true);
                        break;
                    default:
                        VisualStateManager.GoToState(this, "NoPungsSelected", true);
                        break;
                }
            } else if (comboBox.Name == "kongCountComboBox")
            {
                ResetSetCheckBoxes("kong", comboBox.SelectedIndex);

                switch (comboBox.SelectedIndex)
                {
                    case -1:
                        VisualStateManager.GoToState(this, "NoKongsSelected", true);
                        break;
                    case 0:
                        VisualStateManager.GoToState(this, "NoKongsSelected", true);
                        break;
                    case 1:
                        VisualStateManager.GoToState(this, "OneKongSelected", true);
                        break;
                    case 2:
                        VisualStateManager.GoToState(this, "TwoKongsSelected", true);
                        break;
                    case 3:
                        VisualStateManager.GoToState(this, "ThreeKongsSelected", true);
                        break;
                    case 4:
                        VisualStateManager.GoToState(this, "FourKongsSelected", true);
                        break;
                    default:
                        VisualStateManager.GoToState(this, "NoKongsSelected", true);
                        break;
                }
            }
        }
예제 #31
0
 public DropDownLayouter(ComboBox combo, PopupBase popup)
 {
     _combo = combo;
     _popup = popup;
 }
예제 #32
0
 private void TextSubmitted(Windows.UI.Xaml.Controls.ComboBox sender, ComboBoxTextSubmittedEventArgs args)
 {
 }