示例#1
0
        private void listViewFiles_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewFiles.SelectedItems.Count > 0)
            {
                m_isAddMode = false;

                btnSaveUpdate.Text = "Update";
                Text = "Filter Manager [Edit]";

                m_currentFilterItem = (FilterItem)listViewFiles.SelectedItems[0].Tag;

                SetUiUsingFilterString(m_currentFilterItem);
            }
        }
示例#2
0
        private void SetUiUsingFilterString(FilterItem filterItem)
        {
            tbName.Text = filterItem.Name;

            string _filterString = filterItem.Filter;

            m_timeRangeFilter = null;
            m_timeStampFilter = null;

            //Hack
            try
            {
                JsonSerializerSettings _settings = new JsonSerializerSettings();
                _settings.MissingMemberHandling = MissingMemberHandling.Error;
                m_timeRangeFilter = JsonConvert.DeserializeObject <TimeRangeFilter>(_filterString, _settings);

                rbTimeRange.Checked = true;

                datePicker_TR_From.Value = DateTimeHelp.ISO8601ToDateTime(m_timeRangeFilter.time[0]);
                datePicker_TR_To.Value   = DateTimeHelp.ISO8601ToDateTime(m_timeRangeFilter.time[1]);
                cmbType.SelectedIndex    = getIndexFromTypeString(m_timeRangeFilter.type);
            }
            catch
            {
                try
                {
                    m_timeStampFilter = JsonConvert.DeserializeObject <TimeStampFilter>(_filterString);

                    rbTimeStamp.Checked = true;

                    comboBox_TS_PN.SelectedIndex = (m_timeStampFilter.limit < 0) ? 0 : 1;
                    datePicker_TS_Time.Value     = DateTimeHelp.ISO8601ToDateTime(m_timeStampFilter.timestamp);
                    numericUpDown_TS_Limit.Value = Math.Abs(m_timeStampFilter.limit);
                    cmbType.SelectedIndex        = getIndexFromTypeString(m_timeStampFilter.type);
                }
                catch
                {
                }
            }
        }
示例#3
0
        private void FillFilterListview()
        {
            listViewFiles.Items.Clear();

            List <Fetch_Filter> _filters = FilterHelper.GetList();

            if (_filters != null)
            {
                foreach (Fetch_Filter _f in _filters)
                {
                    FilterItem _item = new FilterItem();
                    _item.Name            = _f.filter_name;
                    _item.Filter          = _f.filter_entity.ToString();
                    _item.searchfilter_id = _f.filter_id;

                    ListViewItem _lvi = new ListViewItem(_f.filter_name, 0);
                    _lvi.Tag = _item;

                    listViewFiles.Items.Add(_lvi);
                }
            }
        }
示例#4
0
        private void Reset()
        {
            m_isAddMode = true;

            m_currentFilterItem = null;

            m_timeRangeFilter = null;
            m_timeStampFilter = null;

            btnSaveUpdate.Text = "Save";
            Text = "Filter Manager [New]";

            rbTimeRange.Checked          = true;
            tbName.Text                  = "";
            cmbType.SelectedIndex        = 0;
            datePicker_TR_From.Value     = DateTime.Today;
            datePicker_TR_To.Value       = DateTime.Today;
            comboBox_TS_PN.SelectedIndex = 0;
            datePicker_TS_Time.Value     = DateTime.Today;
            numericUpDown_TS_Limit.Value = 20;

            tbName.Focus();
        }