Пример #1
0
        static public bool FilterHistory(HistoryEntry he, BaseUtils.ConditionLists cond, BaseUtils.Variables othervars)                // true if it should be included
        {
            string er;

            return(cond.CheckFilterFalse(he.journalEntry, he.journalEntry.EventTypeStr,
                                         new BaseUtils.Variables[] { othervars, new BaseUtils.Variables("Note", he.SNC?.Note ?? "") }, out er, null)); // true it should be included
        }
Пример #2
0
        private async void buttonFind_Click(object sender, EventArgs e)
        {
            BaseUtils.ConditionLists cond = Valid();
            if (cond != null)
            {
                this.Cursor = Cursors.WaitCursor;
                dataGridView.Rows.Clear();

                DataGridViewColumn sortcol   = dataGridView.SortedColumn != null ? dataGridView.SortedColumn : dataGridView.Columns[0];
                SortOrder          sortorder = dataGridView.SortedColumn != null ? dataGridView.SortOrder : SortOrder.Descending;

                ISystem cursystem = discoveryform.history.CurrentSystem(); // could be null

                var varusedincondition = cond.VariablesUsed();             // what variables are in use, so we don't enumerate the lots.

                var helist = discoveryform.history.FilterByScanFSSBodySAASignals();

                var sw = new System.Diagnostics.Stopwatch(); sw.Start();

                var results = await Find(helist, cond, varusedincondition, cursystem);

                foreach (var r in results)
                {
                    dataGridView.Rows.Add(r.Item2);
                    dataGridView.Rows[dataGridView.Rows.Count - 1].Tag = r.Item1;
                }

                System.Diagnostics.Debug.Write($"Search took {sw.ElapsedMilliseconds}");
                dataGridView.Sort(sortcol, (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                dataGridView.Columns[sortcol.Index].HeaderCell.SortGlyphDirection = sortorder;
                this.Cursor = Cursors.Default;
            }
        }
Пример #3
0
 private void buttonField_Click(object sender, EventArgs e)
 {
     BaseUtils.ConditionLists res = FilterHelpers.ShowDialog(FindForm(), fieldfilter, discoveryform, "Journal: Filter out fields".T(EDTx.UserControlJournalGrid_JHF));
     if (res != null)
     {
         fieldfilter = res;
         EliteDangerousCore.DB.UserDatabase.Instance.PutSettingString(DbFieldFilter, fieldfilter.GetJSON());
         Display(current_historylist);
     }
 }
Пример #4
0
 private void buttonField_Click(object sender, EventArgs e)
 {
     BaseUtils.ConditionLists res = FilterHelpers.ShowDialog(FindForm(), fieldfilter, discoveryform, "Journal: Filter out fields".T(EDTx.UserControlJournalGrid_JHF));
     if (res != null)
     {
         fieldfilter = res;
         PutSetting(dbFieldFilter, fieldfilter.GetJSON());
         HistoryChanged(current_historylist);
     }
 }
Пример #5
0
 private void buttonField_Click(object sender, EventArgs e)
 {
     BaseUtils.ConditionLists res = FilterHelpers.ShowDialog(FindForm(), fieldfilter, discoveryform, "Journal: Filter out fields".Tx(this, "JHF"));
     if (res != null)
     {
         fieldfilter = res;
         SQLiteDBClass.PutSettingString(DbFieldFilter, fieldfilter.GetJSON());
         Display(current_historylist);
     }
 }
Пример #6
0
 static public List<HistoryEntry> CheckFilterTrue(List<HistoryEntry> he, BaseUtils.ConditionLists cond, BaseUtils.Variables othervars)    // conditions match for item to stay
 {
     if (cond.Count == 0)       // no filters, all in
         return he;
     else
     {
         string er;
         List<HistoryEntry> ret = (from s in he where cond.CheckFilterTrue(s.journalEntry, new BaseUtils.Variables[] { othervars, new BaseUtils.Variables("Note", s.snc?.Note ?? "") }, out er, null) select s).ToList();
         return ret;
     }
 }
Пример #7
0
        private void buttonFind_Click(object sender, EventArgs e)
        {
            BaseUtils.ConditionLists cond = Valid();
            if (cond != null)
            {
                this.Cursor = Cursors.WaitCursor;
                dataGridView.Rows.Clear();

                DataGridViewColumn sortcol   = dataGridView.SortedColumn != null ? dataGridView.SortedColumn : dataGridView.Columns[0];
                SortOrder          sortorder = dataGridView.SortedColumn != null ? dataGridView.SortOrder : SortOrder.Descending;

                ISystem cursystem = discoveryform.history.CurrentSystem();        // could be null

                foreach (var he in discoveryform.history.FilterByScan())
                {
                    JournalScan js = he.journalEntry as JournalScan;

                    BaseUtils.Variables scandata = new BaseUtils.Variables();
                    scandata.AddPropertiesFieldsOfClass(js, "", new Type[] { typeof(System.Drawing.Icon), typeof(System.Drawing.Image), typeof(System.Drawing.Bitmap), typeof(BaseUtils.JSON.JObject) }, 5);

                    bool?res = cond.CheckAll(scandata, out string errlist, out BaseUtils.ConditionLists.ErrorClass errclass);    // need function handler..

                    if (res.HasValue && res.Value == true)
                    {
                        ISystem  sys    = he.System;
                        string   sep    = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator + " ";
                        object[] rowobj =
                        {
                            EDDConfig.Instance.ConvertTimeToSelectedFromUTC(he.EventTimeUTC).ToString(),
                            js.BodyName,
                            js.DisplayString(0),
                            (cursystem != null ? cursystem.Distance(sys).ToString("0.#") : ""),
                            sys.X.ToString("0.#") + sep + sys.Y.ToString("0.#") + sep + sys.Z.ToString("0.#")
                        };

                        dataGridView.Rows.Add(rowobj);
                        dataGridView.Rows[dataGridView.Rows.Count - 1].Tag = sys;
                    }

                    if (errclass == BaseUtils.ConditionLists.ErrorClass.LeftSideVarUndefined || errclass == BaseUtils.ConditionLists.ErrorClass.RightSideBadFormat)
                    {
                        ExtendedControls.MessageBoxTheme.Show(errlist, "Warning".T(EDTx.Warning), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        break;
                    }
                }

                dataGridView.Sort(sortcol, (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                dataGridView.Columns[sortcol.Index].HeaderCell.SortGlyphDirection = sortorder;
                this.Cursor = Cursors.Default;
            }
        }
Пример #8
0
        static public List<HistoryEntry> FilterHistory(List<HistoryEntry> he, BaseUtils.ConditionLists cond, BaseUtils.Variables othervars, out int count)    // filter in all entries
        {
            count = 0;
            if (cond.Count == 0)       // no filters, all in
                return he;
            else
            {
                string er;
                List<HistoryEntry> ret = (from s in he where cond.CheckFilterFalse(s.journalEntry, s.journalEntry.EventTypeStr,
                            new BaseUtils.Variables[] { othervars, new BaseUtils.Variables("Note", s.snc?.Note ?? "") }, 
                            out er, null) select s).ToList();

                count = he.Count - ret.Count;
                return ret;
            }
        }
Пример #9
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     BaseUtils.ConditionLists cond = Valid();
     if (cond != null)
     {
         string name = ExtendedControls.PromptSingleLine.ShowDialog(this.FindForm(), "Name:".Tx(this), "", "Enter Search Name:".Tx(this, "SN"), this.FindForm().Icon);
         if (name != null)
         {
             Queries.Instance.Update(name, cond.ToString());
             comboBoxSearches.Items.Clear();
             comboBoxSearches.Items.AddRange(Queries.Instance.Searches.Select(x => x.Item1));
             comboBoxSearches.SelectedIndexChanged -= ComboBoxSearches_SelectedIndexChanged;
             comboBoxSearches.SelectedItem          = name;
             comboBoxSearches.SelectedIndexChanged += ComboBoxSearches_SelectedIndexChanged;
         }
     }
 }
Пример #10
0
        private void buttonFind_Click(object sender, EventArgs e)
        {
            BaseUtils.ConditionLists cond = Valid();
            if (cond != null)
            {
                this.Cursor = Cursors.WaitCursor;
                dataGridView.Rows.Clear();

                DataGridViewColumn sortcol   = dataGridView.SortedColumn != null ? dataGridView.SortedColumn : dataGridView.Columns[0];
                SortOrder          sortorder = dataGridView.SortedColumn != null ? dataGridView.SortOrder : SortOrder.Descending;

                ISystem cursystem = discoveryform.history.CurrentSystem;        // could be null

                foreach (var he in discoveryform.history.FilterByScan)
                {
                    JournalScan js = he.journalEntry as JournalScan;

                    BaseUtils.Variables scandata = new BaseUtils.Variables();
                    scandata.AddPropertiesFieldsOfClass(js, "", new Type[] { typeof(System.Drawing.Icon), typeof(System.Drawing.Image), typeof(System.Drawing.Bitmap), typeof(Newtonsoft.Json.Linq.JObject) }, 5);

                    bool?res = cond.CheckAll(scandata, out string errlist);   // need function handler..

                    if (res.HasValue && res.Value == true)
                    {
                        ISystem  sys    = he.System;
                        string   sep    = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator + " ";
                        object[] rowobj =
                        {
                            (EDDConfig.Instance.DisplayUTC ? he.EventTimeUTC : he.EventTimeLocal).ToString(),
                            js.BodyName,
                            js.DisplayString(0,                                                              true),
                            (cursystem != null ? cursystem.Distance(sys).ToString("0.#") : ""),
                            sys.X.ToString("0.#") + sep + sys.Y.ToString("0.#") + sep + sys.Z.ToString("0.#")
                        };

                        dataGridView.Rows.Add(rowobj);
                        dataGridView.Rows[dataGridView.Rows.Count - 1].Tag = sys;
                    }
                }

                dataGridView.Sort(sortcol, (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                dataGridView.Columns[sortcol.Index].HeaderCell.SortGlyphDirection = sortorder;
                this.Cursor = Cursors.Default;
            }
        }
Пример #11
0
        private void buttonField_Click(object sender, EventArgs e)
        {
            ExtendedConditionsForms.ConditionFilterForm frm = new ExtendedConditionsForms.ConditionFilterForm();
            List <string> namelist = new List <string>()
            {
                "Note"
            };

            namelist.AddRange(discoveryform.Globals.NameList);
            frm.InitFilter("Journal: Filter out fields",
                           Icon.ExtractAssociatedIcon(System.Reflection.Assembly.GetExecutingAssembly().Location),
                           JournalEntry.GetNameOfEvents(),
                           (s) => { return(BaseUtils.TypeHelpers.GetPropertyFieldNames(JournalEntry.TypeOfJournalEntry(s))); },
                           namelist, fieldfilter);
            if (frm.ShowDialog(this.FindForm()) == DialogResult.OK)
            {
                fieldfilter = frm.Result;
                SQLiteDBClass.PutSettingString(DbFieldFilter, fieldfilter.GetJSON());
                Display(current_historylist);
            }
        }
Пример #12
0
        static public BaseUtils.ConditionLists ShowDialog(System.Windows.Forms.Form parent, BaseUtils.ConditionLists fieldfilter, EDDiscoveryForm discoveryform, string title)
        {
            ExtendedConditionsForms.ConditionFilterForm frm = new ExtendedConditionsForms.ConditionFilterForm();

            frm.VariableNamesEvents += (s) => { return(BaseUtils.TypeHelpers.GetPropertyFieldNames(JournalEntry.TypeOfJournalEntry(s))); };
            frm.VariableNames        = (from x in discoveryform.Globals.NameList select new BaseUtils.TypeHelpers.PropertyNameInfo(x, "Global Variable String or Number" + Environment.NewLine + "Not part of the event, set up by either EDD or one of the action packs")).ToList();
            frm.VariableNames.Add(new BaseUtils.TypeHelpers.PropertyNameInfo("Note", "String"));

            frm.InitFilter(title,
                           parent.Icon,
                           JournalEntry.GetNameOfEvents(),
                           fieldfilter);

            if (frm.ShowDialog(parent) == System.Windows.Forms.DialogResult.OK)
            {
                return(frm.Result);
            }
            else
            {
                return(null);
            }
        }
Пример #13
0
        // Async task to find results given cond in helist, using only vars specified.

        private System.Threading.Tasks.Task <List <Tuple <ISystem, object[]> > > Find(List <HistoryEntry> helist, BaseUtils.ConditionLists cond, HashSet <string> varsusedincondition, ISystem cursystem)
        {
            return(System.Threading.Tasks.Task.Run(() =>
            {
                List <Tuple <ISystem, object[]> > rows = new List <Tuple <ISystem, object[]> >();
                foreach (var he in helist)
                {
                    BaseUtils.Variables scandata = new BaseUtils.Variables();
                    scandata.AddPropertiesFieldsOfClass(he.journalEntry, "",
                                                        new Type[] { typeof(System.Drawing.Icon), typeof(System.Drawing.Image), typeof(System.Drawing.Bitmap), typeof(QuickJSON.JObject) }, 5,
                                                        varsusedincondition);

                    bool?res = cond.CheckAll(scandata, out string errlist, out BaseUtils.ConditionLists.ErrorClass errclass);   // need function handler..

                    if (res.HasValue && res.Value == true)
                    {
                        ISystem sys = he.System;
                        string sep = System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator + " ";

                        JournalScan js = he.journalEntry as JournalScan;
                        JournalFSSBodySignals jb = he.journalEntry as JournalFSSBodySignals;
                        JournalSAASignalsFound jbs = he.journalEntry as JournalSAASignalsFound;

                        string name, info;
                        if (js != null)
                        {
                            name = js.BodyName;
                            info = js.DisplayString(0);
                        }
                        else if (jb != null)
                        {
                            name = jb.BodyName;
                            jb.FillInformation(he.System, "", out info, out string d);
                        }
                        else
                        {
                            name = jbs.BodyName;
                            jbs.FillInformation(he.System, "", out info, out string d);
                        }

                        object[] rowobj = { EDDConfig.Instance.ConvertTimeToSelectedFromUTC(he.EventTimeUTC).ToString(),
                                            name,
                                            info,
                                            (cursystem != null ? cursystem.Distance(sys).ToString("0.#") : ""),
                                            sys.X.ToString("0.#") + sep + sys.Y.ToString("0.#") + sep + sys.Z.ToString("0.#") };
                        rows.Add(new Tuple <ISystem, object[]>(sys, rowobj));
                    }
                }

                return rows;
            }));
        }