Exemple #1
0
        public async override Task ExecuteRequestAsync()
        {
            try
            {
                // Clear current UI
                listView.Items.Clear();
                queryEditor.ReadOnly = false;
                queryEditor.Text     = null;
                queryEditor.ReadOnly = true;

                if (string.IsNullOrEmpty(Database))
                {
                    return;
                }

                listView.BeginUpdate();

                var cqList = await InfluxDbClient.GetContinousQueriesAsync(Database);

                foreach (var cq in cqList)
                {
                    listView.Items.Add(new ListViewItem(new string[] { cq.Name })
                    {
                        Tag = cq
                    });
                }

                listView.EndUpdate();

                // If this is/was a currently selected query, restore it
                if (SelectedCq != null)
                {
                    foreach (ListViewItem li in listView.Items)
                    {
                        if (li.Text == SelectedCq.Name)
                        {
                            li.Selected = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                AppForm.DisplayException(ex);
            }
        }