Exemplo n.º 1
0
        // Configure functionality, style, and display of the search bar
        // If not configured, defaults will be used
        internal void Configure(SearchMode mode, InterfaceOption options, UsageOption option, List <Document> boundDocuments = null)
        {
            // Save in case later use
            searchMode      = mode;
            interfaceOption = options;
            usageOption     = option;
            // Interface Configurations
            if ((options & InterfaceOption.ExtendedFunctions) == InterfaceOption.ExtendedFunctions)
            {
                SearchModeComboBox.Visibility = Visibility.Visible;
            }
            if ((options & InterfaceOption.RoudCornerGemBlue) == InterfaceOption.RoudCornerGemBlue)
            {
                SearchTextBox.Style = (Style)FindResource("RoundCornerTextboxStyle");
            }
            if ((options & InterfaceOption.ShowValidationSymbol) == InterfaceOption.ShowValidationSymbol)
            {
                ValidationSymbol.Visibility = Visibility.Visible;
            }
            if ((options & InterfaceOption.ShowEnterTextHere) == InterfaceOption.ShowEnterTextHere)
            {
                SearchTextBox.Text = App.DefaultTextboxText;
            }
            if ((options & InterfaceOption.MultilineEditing) == InterfaceOption.MultilineEditing)
            {
                SearchTextBox.AcceptsReturn = true;
            }

            Bind(boundDocuments);
        }
Exemplo n.º 2
0
 public Usage()
 {
     Optimize       = new UsageOption <bool>();
     DebugConstants = new UsageOption <string>();
     DebugInfo      = new UsageOption <string>();
 }
        // Interaction functions: Attach first, then interact within, disable automatically upon losing focus
        internal void Attach(TextBox parentSearchTextBox, SearchMode searchMode, InterfaceOption interfaceOption, List <Document> boundDocuments, SearchComboBoxEnum comboBoxSelection = SearchComboBoxEnum.Local, UsageOption usage = UsageOption.Searcher)  // 0 for local, 1 for web
        {
            // Bookkeping
            ParentSearchTextBox    = parentSearchTextBox;
            this.SearchMode        = searchMode;
            this.InterfaceOption   = interfaceOption;
            this.ComboBoxSelection = comboBoxSelection;
            BoundDocuments         = boundDocuments;

            // Adjust text display
            Configure(searchMode, interfaceOption);
            SearchTextBox.Height = parentSearchTextBox.ActualHeight;
            SearchTextBox.Text   = ParentSearchTextBox.Text;
            //SearchTextBox.CaretIndex = ParentSearchTextBox.CaretIndex;

            // Adjust width
            Width = parentSearchTextBox.ActualWidth;
            // Adjust display location: https://stackoverflow.com/questions/386731/get-absolute-position-of-element-within-the-window-in-wpf
            Point position = parentSearchTextBox.PointToScreen(new Point(0d, 0d));

            Show(position); /* + parentSearchTextBox.ActualHeight*/

            // More bookkeeping
            if (comboBoxSelection == SearchComboBoxEnum.Local && searchMode == SearchMode.Clues)
            {
                oldClues = Clue.CreateCluesFromText(SearchTextBox.Text);
            }
            else
            {
                oldClues = null;
            }
        }