Example #1
0
        /// <summary>
        /// Gets the control pattern for the AutoCompleteBox that is associated
        /// with this AutoCompleteBoxAutomationPeer.
        /// </summary>
        /// <param name="patternInterface">The desired PatternInterface.</param>
        /// <returns>The desired AutomationPeer or null.</returns>
        public override object GetPattern(PatternInterface patternInterface)
        {
            object iface = null;
            AutoCompleteTextBox owner = OwnerAutoCompleteBox;

            if (patternInterface == PatternInterface.Value)
            {
                iface = this;
            }
            else if (patternInterface == PatternInterface.ExpandCollapse)
            {
                iface = this;
            }
            else if (owner.IsDropDownOpen && owner.SelectionAdapter != null)
            {
                // TODO: Consult UIA experts to determine whether the IsDropDownOpen
                // check should be present.

                AutomationPeer peer = owner.SelectionAdapter.CreateAutomationPeer();
                if (peer != null)
                {
                    iface = peer.GetPattern(patternInterface);
                }
            }

            if (iface == null)
            {
                iface = base.GetPattern(patternInterface);
            }

            return(iface);
        }
 private void HedgeContractUpdate(AutoCompleteTextBox hedgeContract)
 {
     if (hedgeContract != null && !string.IsNullOrEmpty(hedgeContract.Filter))
     {
         var hedgeVM = hedgeContract.DataContext as HedgeVM;
         if (hedgeVM != null)
         {
             string quote = hedgeContract.SelectedItem == null ? hedgeContract.Filter : hedgeContract.SelectedItem.ToString();
             var    list  = ClientDbContext.GetContractFromCache((int)ProductType.PRODUCT_FUTURE).Where(c => c.Exchange == hedgeVM.Exchange && c.ProductID == hedgeVM.Underlying);
             if (!list.Any((c) => string.Compare(c.Contract, quote, true) == 0))
             {
                 System.Windows.MessageBox.Show("输入合约" + quote + "不存在");
                 hedgeContract.Filter = hedgeVM.Contract;
                 return;
             }
             else
             {
                 var portfolio = portfolioCB.SelectedValue?.ToString();
                 if (portfolio != null)
                 {
                     hedgeVM.Contract = quote;
                     _otcOptionHandler.UpdateHedgeContracts(hedgeVM, portfolio);
                 }
             }
         }
     }
 }
 public void SetAutoComplite(AutoCompleteTextBox tb)
 {
     foreach (var dir in Directors)
     {
         tb.AddItem(dir.GetAutoCompliteEntityt());
     }
 }
Example #4
0
        private string ParseCurrencyInput(AutoCompleteTextBox autoComplete, FileType fileType)
        {
            try
            {
                string[] enteredCurrency = autoComplete.Text.Split(',');
                string   currencyFull    = enteredCurrency[0];
                string   currencyAbb     = enteredCurrency[1].Trim();
                Dictionary <string, string> collection = new Dictionary <string, string>();
                switch (fileType)
                {
                case FileType.SHARE:
                    collection = con.shares;
                    break;

                case FileType.CRYPTO_CURRENCY:
                    collection = con.cryptos;
                    break;

                case FileType.CURRENCY:
                    collection = con.currs;
                    break;
                }
                if (collection[currencyAbb].Equals(currencyFull))
                {
                    return(currencyAbb);
                }
            }
            catch
            {
            }
            return(string.Empty);
        }
        static TextSelectWholeBoundedWordDialog()
        {
            UIHelper <TextSelectWholeBoundedWordDialog> .Register();

            AutoCompleteTextBox.AddTagSuggestions(WHOLEWORDCOMPLETIONTAG, ALPHANUMERIC, STRING, WHITESPACE);
            AutoCompleteTextBox.AddTagSuggestions(BOUNDEDWORDCOMPLETIONTAG, STRING, WHITESPACE, ALPHANUMERIC);
        }
Example #6
0
 protected void SetContextKey()
 {
     auEmpleado.ContextKey = AutoCompleteTextBox.CreateContextKey(new[] { cbEmpresa.Selected },
                                                                  new[] { cbLinea.Selected },
                                                                  new[] { -1 },
                                                                  new[] { -1 },
                                                                  new[] { -1 },
                                                                  new[] { cbDepartamento.Selected });
 }
Example #7
0
        public string EA_Connect(EAAPI.Repository repository)
        {
            _mainViewModel = new MainViewModel(repository);

            AutoCompleteTextBox textbox = new AutoCompleteTextBox();

            _channelDataTransferHelper = new ChannelDataTransferHelper(repository);

            return("");
        }
Example #8
0
        protected void SetContextKey()
        {
            var data = FilterData.Get();

            txtEditEmpleados.ContextKey = AutoCompleteTextBox.CreateContextKey(new[] { data.Empresa },
                                                                               new[] { data.Linea },
                                                                               data.TiposEmpleados.ToArray(),
                                                                               new[] { -1 },
                                                                               data.CentrosCostos.ToArray(),
                                                                               data.Departamentos.ToArray());
        }
Example #9
0
        /// <summary>
        /// Initializes a new instance of the TextCellEditor class with default settings
        /// </summary>
        public AutoCompleteTextCellEditor(Field field, DataBase db)
            : base()
        {
            AutoCompleteTextBox textbox = new AutoCompleteTextBox();

            textbox.AutoSize    = false;
            textbox.BorderStyle = BorderStyle.None;
            textbox.DataBase    = db;

            this.Control = textbox;
        }
Example #10
0
        private void DosageCodes_SelectionChanged(object sender, RoutedEventArgs routedEventArgs)
        {
            ComboBox            box    = Common.FindChild <ComboBox>(TransactionGrd, "DosageCodes");
            AutoCompleteTextBox dosage = Common.FindChild <AutoCompleteTextBox>(TransactionGrd, "AutoCompleteTextBox");

            if (dosage == null || SalesVM.Instance.SelectedRxAbbrevation == null)
            {
                return;
            }

            dosage.Text = SalesVM.Instance.SelectedRxAbbrevation.Sentence;
            //
        }
Example #11
0
        public void RefreshControl(List<Location> locations, AutoCompleteTextBox textBox)
        {
            if (locations != null)
            {
                // clear old locations and entered text
                textBox.ClearSearchPool();
                textBox.ClearText();

                foreach (var location in locations)
                {
                    textBox.AddObject(location.Name, location);
                }
            }
        }
        void TextBoxElement_TextChanged(object sender, EventArgs e)
        {
            timer1.Stop();


            if (MapType == Enums.MAP_TYPE.NONE)
            {
                return;
            }
            try
            {
                aTxt = (AutoCompleteTextBox)sender;

                aTxt.ResetListBox();
                string text = aTxt.Text;
                if (text.Length > 2)
                {
                    if (aTxt.SelectedItem != null && aTxt.SelectedItem == aTxt.Text)
                    {
                        return;
                    }



                    StartAddressTimer(text);



                    if (aTxt.Name == "txtAddress1")
                    {
                        txtAddress2.SendToBack();
                    }
                    else if (aTxt.Name == "txtAddress2")
                    {
                        txtAddress2.BringToFront();
                    }

                    radPanel2.SendToBack();
                }
                else
                {
                    wc.CancelAsync();
                    aTxt.Values = null;
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #13
0
        protected virtual void SwitchEditModeShootingLocation(AutoCompleteTextBox targetControl, RichTextBox targetEditControl, List <Control> otherControls)
        {
            // hide the autocomplete textbox and show the edit textbox
            targetEditControl.Visibility = Visibility.Visible;
            targetControl.Visibility     = Visibility.Hidden;

            // disable the other controls
            DisableControls(otherControls);

            // set text to edit control
            var editedText = targetControl.GetCurrentText();

            targetEditControl.Document.Blocks.Clear();
            targetEditControl.Document.Blocks.Add(new Paragraph(new Run(editedText)));
        }
        /// <summary>
        /// Creates a Dto representing the settings to use to initialize
        /// the autocomplete functionalities for a textbox.
        /// It initializes the dto from an instance of
        /// <see cref="AutoCompleteTextBox"/>.
        /// </summary>
        /// <param name="autoCompleteTextBox">The <see cref="AutoCompleteTextBox"/>
        /// instance to use to initialize the Dto instance.</param>
        /// <returns>A Dto representing the settings to initialize
        /// an autocomplete control.</returns>
        internal static AutoCompleteSettingsDto GetDtoFrom(AutoCompleteTextBox autoCompleteTextBox)
        {
            AutoCompleteSettingsDto settings = new AutoCompleteSettingsDto();

            settings.ControlId         = autoCompleteTextBox.ClientID;
            settings.Url               = autoCompleteTextBox.JsonDataSourceUrl;
            settings.HttpMethod        = autoCompleteTextBox.HttpMethod;
            settings.MinChars          = autoCompleteTextBox.MinCharsRequired;
            settings.LabelField        = autoCompleteTextBox.LabelField;
            settings.ValueField        = autoCompleteTextBox.ValueField;
            settings.SelectionCallback = autoCompleteTextBox.OnClientSelection;
            settings.ErrorCallback     = autoCompleteTextBox.OnClientError;
            settings.ErrorMessage      = autoCompleteTextBox.ErrorMessage;
            settings.NoResultsMessage  = autoCompleteTextBox.NoResultsMessage;
            return(settings);
        }
Example #15
0
        public static List <string> AutoList(string input, AutoCompleteTextBox t)
        {
            List <string> f = new List <string>();

            f.Add("one");
            f.Add("two");
            f.Add("three");
            f.Add("four");
            f.Add("five");
            f.Add("Aone");
            f.Add("Btwo");
            f.Add("Cthree");
            f.Add("Dfour");
            f.Add("Efive");
            return(f);
        }
        //加载车站控件数据源
        public static void LoadedUserControlStation(AutoCompleteTextBox ctrlBox)
        {
            //sha|上海|SHH|shanghai|sh|10
            AutoCompleteEntry entry = null;

            foreach (String item in SystemCache._stationItems.Keys)
            {
                Station station = SystemCache._stationItems[item] as Station;
                entry = new AutoCompleteEntry(item, station.StationFullName);
                ctrlBox.AddItem(new AutoCompleteEntry(item, station.StationFullName));
            }
            //ctrlBox.Uid == "1";//出发站
            string url = ctrlBox.Uid == "1" ? "STARTSTATION" : "ENDSTATION";

            ctrlBox.Text = StringHelper.GetConfigValByKey(url);
        }
Example #17
0
 private static void OnHandleSelectionChangedEvent(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     ICommand command = e.NewValue as ICommand;
     if(command != null)
     {
         AutoCompleteTextBox actb = d as AutoCompleteTextBox;
         actb.Loaded += (ss, ee) =>
         {
             ListBox lb = actb.Template.FindName("PART_ListBox", actb) as ListBox;
             if (lb != null)
             {
                 lb.SelectionChanged += (sss, eee) =>
                 {
                     command.Execute(null);
                 };
             }
         };
     }
 }
 private static void OnHandleSelectionChangedEvent(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if(e.NewValue != null && Convert.ToBoolean(e.NewValue))
     {
         AutoCompleteTextBox actb = d as AutoCompleteTextBox;
         actb.Loaded += (ss, ee) => 
         {
             ListBox lb = actb.Template.FindName("PART_ListBox", actb) as ListBox;
             if (lb != null)
             {
                 lb.SelectionChanged += (sss, eee) =>
                 {
                     MainWindowViewModel vm = actb.DataContext as MainWindowViewModel;
                     //invoke a command of the view model or do whatever you want here...
                     var selectedItem = lb.SelectedItem;
                 };
             }
         };
     }
 }
Example #19
0
        protected override List <AutomationPeer> GetChildrenCore()
        {
            List <AutomationPeer> children = new List <AutomationPeer>();
            AutoCompleteTextBox   owner    = OwnerAutoCompleteBox;

            // TextBox part.
            TextBox textBox = owner.TextBox;

            if (textBox != null)
            {
                AutomationPeer peer = FrameworkElementAutomationPeer.CreatePeerForElement(textBox);
                if (peer != null)
                {
                    children.Insert(0, peer);
                }
            }

            // TODO: Consult UIA experts to determine whether the IsDropDownOpen
            // check should be present.

            // Include SelectionAdapter's children.
            if (owner.IsDropDownOpen && owner.SelectionAdapter != null)
            {
                AutomationPeer selectionAdapterPeer = owner.SelectionAdapter.CreateAutomationPeer();
                if (selectionAdapterPeer != null)
                {
                    List <AutomationPeer> listChildren = selectionAdapterPeer.GetChildren();
                    if (listChildren != null)
                    {
                        foreach (AutomationPeer child in listChildren)
                        {
                            children.Add(child);
                        }
                    }
                }
            }

            return(children);
        }
Example #20
0
        private void AddDosageCode(object sender, MouseButtonEventArgs e)
        {
            ComboBox            box    = Common.FindChild <ComboBox>(TransactionGrd, "DosageCodes");
            AutoCompleteTextBox dosage = Common.FindChild <AutoCompleteTextBox>(TransactionGrd, "AutoCompleteTextBox");

            if (box == null || dosage == null)
            {
                return;
            }
            using (var ctx = new RMSModel())
            {
                var m =
                    ctx.RxAbbrevations.FirstOrDefault(
                        x =>
                        x.Shortcut == box.Text) ?? new RxAbbrevation()
                {
                    Shortcut = box.Text, Sentence = dosage.Text
                };
                ctx.RxAbbrevations.AddOrUpdate(m);
                ctx.SaveChanges();
                SalesVM.Instance.LoadRxAbbrevations();
                MessageBox.Show("Dosage & Code Saved");
            }
        }
        protected void SearchProduct(object parameter)
        {
            AutoCompleteTextBox txt_searchBox = (AutoCompleteTextBox)parameter;

            Products = ProductServices.GetProductsByName(txt_searchBox.Text.Trim());
        }
Example #22
0
 public static void SetSelectionChangedCommand(AutoCompleteTextBox actb, ICommand value)
 {
     actb.SetValue(SelectionChangedCommandProperty, value);
 }
Example #23
0
 public static ICommand GetSelectionChangedCommand(AutoCompleteTextBox actb)
 {
     return (ICommand)actb.GetValue(SelectionChangedCommandProperty);
 }
        static TextTrimDialog()
        {
            UIHelper <TextTrimDialog> .Register();

            AutoCompleteTextBox.AddTagSuggestions("TextTrimDialog", WHITESPACE);
        }
 /// <summary>
 /// Initializes a new instance of the AutoCompleteBoxAutomationPeer
 /// class.
 /// </summary>
 /// <param name="owner">
 /// The AutoCompleteBox that is associated with this
 /// AutoCompleteBoxAutomationPeer.
 /// </param>
 public AutoCompleteBoxAutomationPeer(AutoCompleteTextBox owner)
     : base(owner)
 {
 }
        void TextBoxElement_TextChanged(object sender, EventArgs e)
        {
            try
            {
                IsPOI     = false;
                IsKeyword = false;
                timer1.Stop();
                //  IsExistData = false;
                aTxt = (AutoCompleteTextBox)sender;
                aTxt.ResetListBox();

                if (aTxt.Name == "txtFromAddress")
                {
                    txtToAddress.SendToBack();
                }
                else if (aTxt.Name == "txtToAddress")
                {
                    txtToAddress.BringToFront();
                }



                string text = aTxt.Text;
                if (text.Length > 2)
                {
                    if (aTxt.SelectedItem != null && aTxt.SelectedItem.ToLower() == aTxt.Text.ToLower())
                    {
                        aTxt.ListBoxElement.Items.Clear();
                        // aTxt.Values = null;
                        aTxt.ResetListBox();


                        string formerValue = aTxt.FormerValue.ToLower().Trim();

                        int?loctypeId = 0;
                        if (AppVars.keyLocations.Contains(formerValue))
                        {
                            Gen_Location loc = General.GetObject <Gen_Location>(c => c.ShortCutKey == formerValue);
                            if (loc != null)
                            {
                                loctypeId = loc.LocationTypeId;
                            }
                        }

                        if (loctypeId != 0)
                        {
                            if (aTxt.Name == "txtFromAddress")
                            {
                                ddlFromLocType.SelectedValue = loctypeId;
                                RadComboBoxItem item = (RadComboBoxItem)ddlFromLocation.Items.FirstOrDefault(b => b.Text.Equals(aTxt.SelectedItem));
                                if (item != null)
                                {
                                    ddlFromLocation.SelectedValue = item.Value;
                                }

                                if (loctypeId != Enums.LOCATION_TYPES.POSTCODE || loctypeId != Enums.LOCATION_TYPES.ADDRESS ||
                                    loctypeId != Enums.LOCATION_TYPES.AIRPORT || loctypeId != Enums.LOCATION_TYPES.BASE)
                                {
                                    txtToAddress.Focus();
                                }
                            }
                            else if (aTxt.Name == "txtToAddress")
                            {
                                ddlToLocType.SelectedValue = loctypeId;
                                RadComboBoxItem item = (RadComboBoxItem)ddlToLocation.Items.FirstOrDefault(b => b.Text.Equals(aTxt.SelectedItem));
                                if (item != null)
                                {
                                    ddlToLocation.SelectedValue = item.Value;
                                }

                                if (loctypeId == Enums.LOCATION_TYPES.POSTCODE || loctypeId == Enums.LOCATION_TYPES.ADDRESS)
                                {
                                    txtToFlightDoorNo.Focus();
                                }
                            }
                        }

                        return;
                    }



                    if (MapType == Enums.MAP_TYPE.GOOGLEMAPS)
                    {
                        if (UseGoogleMap)
                        {
                            wc.CancelAsync();
                            aTxt.Values = null;
                        }
                    }
                    text = text.ToLower();


                    if (AppVars.keyLocations.Contains(text))
                    {
                        aTxt.ListBoxElement.Items.Clear();
                        var res = (from a in General.GetQueryable <Gen_Location>(c => c.ShortCutKey == text)
                                   select(a.PostCode != string.Empty ? a.LocationName + ", " + a.PostCode : a.LocationName)
                                   ).ToArray <string>();


                        IsKeyword = true;

                        aTxt.ListBoxElement.Items.AddRange(res);
                        aTxt.ShowListBox();

                        if (this.Text != aTxt.FormerValue)
                        {
                            aTxt.FormerValue = aTxt.Text;
                        }
                    }


                    if (MapType == Enums.MAP_TYPE.NONE)
                    {
                        return;
                    }



                    StartAddressTimer(text);
                }
                else
                {
                    if (MapType == Enums.MAP_TYPE.NONE)
                    {
                        return;
                    }


                    if (UseGoogleMap)
                    {
                        wc.CancelAsync();
                        aTxt.Values = null;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #27
0
        public static List <string> AutoList(string input, AutoCompleteTextBox t)
        {
            List <string> res = (from x in list where x.StartsWith(input, StringComparison.InvariantCultureIgnoreCase) select x).ToList();

            return(res);
        }
        void TextBoxElement_TextChanged(object sender, EventArgs e)
        {
            try
            {
                aTxt = (AutoCompleteTextBox)sender;
                aTxt.ResetListBox();



                string text = aTxt.Text;
                if (text.Length > 2)
                {
                    if (aTxt.SelectedItem != null && aTxt.SelectedItem.ToLower() == aTxt.Text.ToLower())
                    {
                        aTxt.ListBoxElement.Items.Clear();
                        // aTxt.Values = null;
                        aTxt.ResetListBox();


                        string formerValue = aTxt.FormerValue.ToLower().Trim();

                        int?loctypeId = 0;
                        if (AppVars.keyLocations.Contains(formerValue))
                        {
                            Gen_Location loc = General.GetObject <Gen_Location>(c => c.ShortCutKey == formerValue);
                            if (loc != null)
                            {
                                loctypeId = loc.LocationTypeId;
                            }
                        }

                        if (loctypeId != 0)
                        {
                        }

                        aTxt.FormerValue = string.Empty;

                        return;
                    }



                    if (UseGoogleMap)
                    {
                        wc.CancelAsync();
                        aTxt.Values = null;
                    }
                    text = text.ToLower();


                    if (AppVars.keyLocations.Contains(text))
                    {
                        aTxt.ListBoxElement.Items.Clear();
                        var res = (from a in General.GetQueryable <Gen_Location>(c => c.ShortCutKey == text)
                                   select(a.PostCode != string.Empty ? a.LocationName + ", " + a.PostCode : a.LocationName)
                                   ).ToArray <string>();


                        aTxt.ListBoxElement.Items.AddRange(res);
                        aTxt.ShowListBox();


                        if (this.Text != aTxt.FormerValue)
                        {
                            aTxt.FormerValue = aTxt.Text;
                        }
                    }


                    if (MapType == Enums.MAP_TYPE.NONE)
                    {
                        return;
                    }

                    StartAddressTimer(text);
                }
                else
                {
                    if (MapType == Enums.MAP_TYPE.NONE)
                    {
                        return;
                    }


                    if (UseGoogleMap)
                    {
                        wc.CancelAsync();
                        aTxt.Values = null;
                    }
                }
                //txtAddress.Focus();
            }
            catch (Exception ex)
            {
            }
        }
Example #29
0
 /// <summary>
 /// Initializes a new instance of the AutoCompleteBoxAutomationPeer
 /// class.
 /// </summary>
 /// <param name="owner">
 /// The AutoCompleteBox that is associated with this
 /// AutoCompleteBoxAutomationPeer.
 /// </param>
 public AutoCompleteBoxAutomationPeer(AutoCompleteTextBox owner)
     : base(owner)
 {
 }
 public static bool GetHandleSelectionChangedEvent(AutoCompleteTextBox actb)
 {
     return (bool)actb.GetValue(HandleSelectionChangedEventProperty);
 }
Example #31
0
 public FileIO(AutoCompleteTextBox tbBuyItemSelect)
 {
     ThreadManager.threadRunner(loadAHResourcesXML);
     this.tbBuyItemSelect = tbBuyItemSelect;
 }
 public static void SetHandleSelectionChangedEvent(AutoCompleteTextBox actb, bool value)
 {
     actb.SetValue(HandleSelectionChangedEventProperty, value);
 }