Beispiel #1
0
        public QueryEditorView()
        {
            InitializeComponent();

            _suggestionView = new SuggestionView(QueryTextBox)
            {
                DefaultSelectedIndex = 0
            };

            ViewerForm.Theme.ApplyTo(EditorToolStrip);

            // initialize highlighting
            QueryTextBox.StyleResetDefault();
            QueryTextBox.Styles[Style.Default].Font = "Consolas";
            QueryTextBox.Styles[Style.Default].Size = 11;
            QueryTextBox.StyleClearAll();

            QueryTextBox.Styles[Style.LineNumber].ForeColor = Color.FromArgb(0x888888);
            QueryTextBox.Styles[Style.LineNumber].BackColor = Color.White;

            QueryTextBox.Styles[Style.Sql.String].ForeColor   = Color.FromArgb(0xa31515);
            QueryTextBox.Styles[Style.Sql.Word].ForeColor     = Color.FromArgb(0x0000ff);
            QueryTextBox.Styles[Style.Sql.Operator].ForeColor = Color.FromArgb(0x444444);
            QueryTextBox.Styles[Style.Sql.Number].ForeColor   = Color.FromArgb(0x09885a);

            QueryTextBox.Lexer = Lexer.Sql;
            QueryTextBox.SetKeywords(0, "select where order group by desc asc and or not union except intersect");

            QueryTextBox.Margins[0].Type  = MarginType.Number;
            QueryTextBox.Margins[0].Width = 20;

            QueryTextBox.ClearCmdKey(Keys.Control | Keys.S);
            QueryTextBox.ClearCmdKey(Keys.Control | Keys.O);
        }
Beispiel #2
0
        public void OnSuggestions(Suggestion[] suggestions)
        {
            foreach (UIView view in Subviews)
            {
                if (view is SuggestionView)
                {
                    view.RemoveFromSuperview();
                }
            }

            suggestionHeight = TraitCollection.HorizontalSizeClass == UIUserInterfaceSizeClass.Regular
                               ? suggestionHeightRegular
                               : suggestionHeightCompact;

            for (int i = 0; i < suggestions.Length; i++)
            {
                var suggestionView = SuggestionView.Create();
                suggestionView.Suggestion = suggestions[i];
                AddSubview(suggestionView);
                suggestionView.TranslatesAutoresizingMaskIntoConstraints = false;
                suggestionView.HeightAnchor.ConstraintEqualTo(suggestionHeight).Active         = true;
                suggestionView.CenterXAnchor.ConstraintEqualTo(Superview.CenterXAnchor).Active = true;
                suggestionView.WidthAnchor.ConstraintEqualTo(Superview.WidthAnchor, 1, -2 * sideMargin).Active        = true;
                suggestionView.TopAnchor.ConstraintEqualTo(titleLabel.BottomAnchor, distanceFromTitleLabel(i)).Active = true;

                suggestionView.AddGestureRecognizer(new UITapGestureRecognizer(() =>
                {
                    SuggestionTapped.OnNext(suggestionView.Suggestion);
                }));
            }
            heightConstraint.Constant = heightForSuggestionCount(suggestions.Length);
            heightConstraint.Active   = true;
            SetNeedsLayout();
        }
Beispiel #3
0
 public SuggestionRes(SuggestionView view)
 {
     id       = view.id;
     userId   = view.userId;
     content  = view.content;
     sTime    = Convert.ToDateTime(view.sTime).ToString("yyyy-MM-dd HH:mm:ss");
     userName = view.userName;
     userName = string.IsNullOrEmpty(userName) ? "默认用户" : userName;
     phone    = view.userPhone;
 }
Beispiel #4
0
        public SuggestionsView()
        {
            TranslatesAutoresizingMaskIntoConstraints = false;
            BackgroundColor = UIColor.White;
            ClipsToBounds   = true;

            for (int i = 0; i < suggestionCount; i++)
            {
                suggestionViews.Add(SuggestionView.Create());
            }
        }
Beispiel #5
0
        private LayoutChoice_Set makeLayout(ActivitiesSuggestion suggestion, bool doNowButton, Dictionary <ActivitySuggestion, bool> repeatingDeclinedSuggestion)
        {
            SuggestionView suggestionView = new SuggestionView(suggestion, doNowButton, repeatingDeclinedSuggestion, this.layoutStack);

            suggestionView.Dismissed               += SuggestionView_Dismissed;
            suggestionView.JustifySuggestion       += SuggestionView_JustifySuggestion;
            suggestionView.AcceptedSuggestion      += SuggestionView_VisitParticipationScreen;
            suggestionView.VisitActivitiesScreen   += SuggestionView_VisitActivitiesScreen;
            suggestionView.Request_MakeNewActivity += SuggestionView_Request_MakeNewActivity;
            return(new LayoutCache(suggestionView));
        }