Exemplo n.º 1
0
        void AddButton_Activated(object sender, EventArgs e)
        {
            var isValid = ValidateFilter();

            if (isValid)
            {
                FilterColumn col            = new FilterColumn();
                Operator     oper           = new Operator();
                var          selColumnValue = ColumnComboBox.SelectedValue as NSString;
                var          column         = (FilterColumn)col.GetByDescription(selColumnValue.ToString());
                var          selOpValue     = OperatorComboBox.SelectedValue as NSString;
                var          op             = (Operator)oper.GetByDescription(selOpValue.ToString());
                var          criteria       = new FilterCriteriaDto
                {
                    Column   = column,
                    Operator = op,
                    Value    = ValueTextField.StringValue
                };

                var isDuplicate = IsDuplicate(criteria);

                if (!isDuplicate)
                {
                    Filters.Add(criteria);
                    RefreshGrid(Filters);
                    ValueTextField.StringValue = (NSString)string.Empty;
                }
                else
                {
                    UIErrorHelper.ShowAlert(null, "You are trying to add a duplicate filter.");
                }
            }
            SetDeleteButtonStatus();
            SetUpdateButtonStatus();
        }
Exemplo n.º 2
0
        void ColumnComboBox_SelectionChanged(object sender, EventArgs e)
        {
            var rowId = ((int)ColumnComboBox.SelectedIndex);

            if (rowId > -1)
            {
                FilterColumn column         = new FilterColumn();
                var          selColumnValue = ColumnComboBox.SelectedValue as NSString;
                var          col            = (FilterColumn)column.GetByDescription(selColumnValue.ToString());
                var          operators      = GetDataSource(col);
                var          ops            = operators.Select(x => NSObject.FromObject(x)).ToArray();
                OperatorComboBox.StringValue = (NSString)string.Empty;
                OperatorComboBox.RemoveAll();
                OperatorComboBox.Add(ops);
                SetAddButtonStatus();
                SetUpdateButtonStatus();
            }
        }