Exemplo n.º 1
0
 public HistoryList<LinkClass> GetLinkListe()
 {
     Status(this, new RequestActionEventArgs("Reading Xml"));
     linkliste = new HistoryList<LinkClass>();
     //needs if a request fails and returns empty xml
     if (xmldoc != null && xmldoc.InnerXml != "")
     {
         XmlElement xe = xmldoc.DocumentElement;
         if (xe.FirstChild.Name == "browse")
         {
             readHome();
         }
         if (xe.FirstChild.Name == "search")
         {
             XmlNodeList lookup = xe.GetElementsByTagName("nodes");
             if (lookup[0].InnerText != "")
             {
                 readGenrenOrAlbum();
             }
             lookup = xe.GetElementsByTagName("tracks");
             if (lookup[0].InnerText != "")
             {
                 readTracks();
             }
         }
     }
     Status(this, new RequestActionEventArgs("Reading Xml Completed"));
     return linkliste;
 }
        public void Data_age_filter_removes_data_older_than_the_limit_and_keeps_data_more_recent_than_the_limit()
        {
            var now = new HistoryEntry { EventTimeUTC = DateTime.UtcNow };
            var fourDaysAgo = new HistoryEntry { EventTimeUTC = DateTime.UtcNow.Subtract(TimeSpan.FromDays(4))};
            var input = new HistoryList { fourDaysAgo, now };

            Check.That(TravelHistoryFilter.FromDays(2).Filter(input)).ContainsExactly(now);
        }
        public void Last_2_items_filter_returns_the_2_most_recent_items_sorted_by_most_recent_and_removes_the_older_items()
        {
            var twentyDaysAgo = new HistoryEntry { EventTimeUTC = DateTime.UtcNow.Subtract(TimeSpan.FromDays(20)) };
            var tenDaysAgo = new HistoryEntry { EventTimeUTC = DateTime.UtcNow.Subtract(TimeSpan.FromDays(10)) };
            var thirtyDaysAgo = new HistoryEntry { EventTimeUTC = DateTime.UtcNow.Subtract(TimeSpan.FromDays(30)) };
            var input = new HistoryList { twentyDaysAgo, tenDaysAgo, thirtyDaysAgo };

            Check.That(TravelHistoryFilter.Last(2).Filter(input)).ContainsExactly(tenDaysAgo, twentyDaysAgo);
        }
Exemplo n.º 4
0
        // when user clicks around..
        public void Display(HistoryEntry he, HistoryList hl)
        {
            StarScan.SystemNode newnode = (he != null) ? hl.starscan.FindSystem(he.System) : null;

            if (newnode != last_sn)
            {
                last_sn = newnode;
                DrawSystem(last_sn);
            }
        }
Exemplo n.º 5
0
        public DirPanel(string directory)
        {
            DirectoryListing = new ObservableCollection<ExtFileSystemInfo>();
            fsw = new FileSystemWatcher();
            fsw.Created += fsw_Event;
            fsw.Deleted += fsw_Event;
            fsw.Changed += fsw_Event;
            fsw.Renamed += new RenamedEventHandler(fsw_Renamed);

            _historyInternal = new HistoryList(FileManager.Properties.Settings.Default.HistoryElementsCount);

            OpenedDirectory = directory;
        }
Exemplo n.º 6
0
        private void AddHistory(HistoryList list)
        {
            if (_history.Count == _numHistory)
                _history.Dequeue();

            _history.Enqueue(list);

            // Remove the oldest item
            if (History.Items.Count == _numHistory)
                History.Items.RemoveAt(0);

            History.Items.Add(list.vmNames);
        }
Exemplo n.º 7
0
        private void AddHistory()
        {
            HistoryList list = new HistoryList
            {
                host         = Host.Text,
                hostAccount  = HostAccount.Text,
                hostPwd      = HostPassword.Text,
                guestAccount = GuestAccount.Text,
                guestPwd     = GuestPassword.Text,
                vmNames      = VmNames.Text,
                storage      = Storage.Text,
                pathInGuest  = PathInGuest.Text,
                snapshot     = SnapshotName.Text
            };

            AddHistory(list);
        }
Exemplo n.º 8
0
 protected override void getPageType(string htmlpage)
 {
     linkListe = new HistoryList<LinkClass>();
     _dicLinkliste = new Dictionary<string, LinkClass>();
     readTables(htmlpage);
     //allToString();
     parseGenerenOrInterpret();
     if (pagefound == false)
     {
         parseAlbum();
     }
     if (pagefound == false)
     {
         parseTracks();
     }
     if (pagefound == false)
     {
         parseSearchPage();
     }
 }
        public void Display(HistoryList hl )
        {
            if (hl == null)     // just for safety
                return;

            current_historylist = hl;

            Tuple<long, int> pos = CurrentGridPosByJID();

            var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            List<HistoryEntry> result = filter.Filter(hl);

            int ftotal;
            result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"), out ftotal);
            toolTip1.SetToolTip(buttonFilter, (ftotal > 0) ? ("Total filtered out " + ftotal) : "Filter out entries based on event type");

            result = fieldfilter.FilterHistory(result, out ftotal);
            toolTip1.SetToolTip(buttonField, (ftotal > 0) ? ("Total filtered out " + ftotal) : "Filter out entries matching the field selection");

            dataGridViewJournal.Rows.Clear();

            for (int ii = 0; ii < result.Count; ii++) //foreach (var item in result)
            {
                AddNewJournalRow(false, result[ii]);      // for every one in filter, add a row.
            }

            StaticFilters.FilterGridView(dataGridViewJournal, textBoxFilter.Text);

            int rowno = FindGridPosByJID(pos.Item1);

            if (rowno > 0)
            {
                dataGridViewJournal.CurrentCell = dataGridViewJournal.Rows[rowno].Cells[pos.Item2];       // its the current cell which needs to be set, moves the row marker as well            currentGridRow = (rowno!=-1) ?
            }

            dataGridViewJournal.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.DisplayUTC ? "Game Time" : "Time";
        }
Exemplo n.º 10
0
 public HistoryList<LinkClass> GetPageList(string htmlpage)
 {
     try
     {
         if (htmlpage.Contains("uri = \"ajax_request.php?frontend=netjuke"))
         {
             throw new Exception("No support for netjuke interface");
         }
         if (htmlpage.Contains("uri = \"ajax_request.php?frontend=slick"))
         {
             DoStatus(new RequestActionEventArgs("Parsing HTML..."));
             SlickParser slickparser = new SlickParser();
             linkListe = slickparser.ParsePage(htmlpage);
             currentPageType = slickparser.returnPageType();
             DoStatus(new RequestActionEventArgs("Parsing HTML... Completed"));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return linkListe;
 }
 public void Display(HistoryEntry he, HistoryList hl)
 {
     Display(he?.MaterialCommodity.Sort(!materials));
 }
Exemplo n.º 12
0
 // DEBUGGING ONLY.. click on a scan and it will trigger it
 private void Travelhistorycontrol_OnTravelSelectionChanged(HistoryEntry he, HistoryList hl)
 {
     if (he.journalEntry.EventTypeID == EliteDangerous.JournalTypeEnum.Scan)       // if scan, see if it needs to be displayed
     {
         ShowScanData(he.journalEntry as EliteDangerous.JournalEvents.JournalScan);
     }
     else
         HideScanData(null,null);
 }
Exemplo n.º 13
0
        // when user clicks around..  HE may be null here
        public void Display(HistoryList hl)
        {
            pictureBox.ClearImageList();

            current_historylist = hl;

            if (hl != null && hl.Count > 0)     // just for safety
            {
                int ftotal;         // event filter
                List<HistoryEntry> result = current_historylist.LastFirst;      // Standard filtering

                result = HistoryList.FilterByJournalEvent(result, SQLiteDBClass.GetSettingString(DbFilterSave, "All"), out ftotal);

                result = fieldfilter.FilterHistory(result, out ftotal); // and the field filter..

                RevertToNormalSize();                                           // ensure size is back to normal..
                scanpostextoffset = new Point(0, 0);                            // left/ top used by scan display

                Color textcolour = IsTransparent ? discoveryform.theme.SPanelColor : discoveryform.theme.LabelColor;
                Color backcolour = IsTransparent ? (Config(Configuration.showBlackBoxAroundText) ? Color.Black : Color.Transparent) : this.BackColor;

                bool drawnnootherstuff = DrawScanText(true, textcolour, backcolour);                    // go 1 for some of the scan positions

                if (!drawnnootherstuff)                                         // and it may indicate its overwriting all stuff, which is fine
                {
                    int rowpos = scanpostextoffset.Y;

                    if (Config(Configuration.showNothingWhenDocked) && (hl.GetLast.IsDocked || hl.GetLast.IsLanded))
                    {
                        AddColText(0, 1, rowpos, (hl.GetLast.IsDocked) ? "Docked" : "Landed", textcolour, backcolour, null);
                    }
                    else
                    {
                        string name;
                        Point3D tpos;
                        bool targetpresent = TargetClass.GetTargetPosition(out name, out tpos);

                        if (targetpresent && Config(Configuration.showTargetLine) && hl.GetLast != null)
                        {
                            AddColText(0, 1, rowpos, "Target", textcolour, backcolour, null);
                            AddColText(1, 2, rowpos, name, textcolour, backcolour, null);
                            string dist = (hl.GetLast.System.HasCoordinate) ? SystemClass.Distance(hl.GetLast.System, tpos.X, tpos.Y, tpos.Z).ToString("0.00") : "Unknown";
                            AddColText(2, 3, rowpos, dist, textcolour, backcolour, null);
                            rowpos += rowheight;
                        }

                        foreach (HistoryEntry rhe in result)
                        {
                            DrawHistoryEntry(rhe, rowpos, tpos, textcolour, backcolour);
                            rowpos += rowheight;

                            if (rowpos > ClientRectangle.Height)                // stop when off of screen
                                break;
                        }
                    }
                }

                DrawScanText(false, textcolour, backcolour);     // go 2
            }

            pictureBox.Render();
        }
Exemplo n.º 14
0
        // main travel grid calls after getting a new entry
        public void UpdatedWithAddNewEntry(HistoryEntry he, HistoryList hl, bool accepted)
        {
            try
            {   // try is a bit old, probably do not need it.
                if (he.IsFSDJump)
                {
                    int count = _discoveryForm.history.GetVisitsCount(he.System.name, he.System.id_edsm);
                    _discoveryForm.LogLine(string.Format("Arrived at system {0} Visit No. {1}", he.System.name, count));

                    System.Diagnostics.Trace.WriteLine("Arrived at system: " + he.System.name + " " + count + ":th visit.");

                    if (EDDiscoveryForm.EDDConfig.CurrentCommander.SyncToEdsm == true)
                        EDSMSync.SendTravelLog(he);
                }
                if (he.IsFuelScoop)
                {
                    HistoryEntry lastFSD = hl.GetLastFSD;
                    if(lastFSD!=null)
                        lastFSD.FuelLevel= he.FuelTotal;
                }

                if (he.ISEDDNMessage)
                {
                    if (EDDiscoveryForm.EDDConfig.CurrentCommander.SyncToEddn == true)
                    {
                        EDDNSync.SendEDDNEvents(_discoveryForm, he);
                    }
                }

                if (he.IsFSDJump || he.EntryType == JournalTypeEnum.Location)
                    _discoveryForm.Map.UpdateSystemList(_discoveryForm.history.FilterByTravel);           // update map - only cares about FSD changes

                if ( accepted )                                                 // if accepted it on main grid..
                {
                    RefreshTargetDisplay();                                     // tell the target system its changed the latest system

                    if (EDDiscoveryForm.EDDConfig.FocusOnNewSystem)   // Move focus to new row
                    {
                        userControlTravelGrid.SelectTopRow();
                        ShowSystemInformation(userControlTravelGrid.GetCurrentRow);
                        UpdateDependentsWithSelection();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine("Exception NewPosition: " + ex.Message);
                System.Diagnostics.Trace.WriteLine("Trace: " + ex.StackTrace);
            }
        }
Exemplo n.º 15
0
 // add if in event filter, and not in field filter..
 private void AddNewEntry(HistoryEntry he, HistoryList hl)
 {
     if (he.IsJournalEventInEventFilter(SQLiteDBClass.GetSettingString(DbFilterSave, "All")) && fieldfilter.FilterHistory(he) )
     {
         AddNewJournalRow(true, he);
     }
 }
Exemplo n.º 16
0
 public LineEdittingTest()
 {
     _commandHistoryList = VimData.CommandHistory;
 }
 private void Display(HistoryEntry he, HistoryList hl, bool selectedEntry)
 {
     Display(he?.MaterialCommodity);
 }
Exemplo n.º 18
0
 private void Discoveryform_OnHistoryChange(HistoryList obj)
 {
     systemlist = HistoryList.FilterByFSDCarrierJumpAndPosition(discoveryform.history.EntryOrder());
     Display();
 }
Exemplo n.º 19
0
 private void Display(HistoryEntry he, HistoryList hl)
 {
     last_he = he;
     Display();
 }
 public void NewEntry(HistoryEntry he, HistoryList hl)               // called when a new entry is made..
 {
     Display(hl);
 }
Exemplo n.º 21
0
        private void AddNewEntry(HistoryEntry he, HistoryList hl)           // on new entry from discovery system
        {
            if (!loadcomplete)
            {
                todo.Enqueue(new Action(() => AddNewEntry(he, hl)));
                return;
            }

            if (he.IsFSDJump || he.journalEntry is JournalScan || he.journalEntry is JournalFSSDiscoveryScan)
            {
                DataGridViewRow rowpresent = null;
                foreach (DataGridViewRow rowf in dataGridViewStarList.Rows)
                {
                    var list = (List <HistoryEntry>)rowf.Tag;
                    if (list != null && list[0].System.Name.Equals(he.System.Name))
                    {
                        rowpresent = rowf;
                        break;
                    }
                }

                if (he.IsFSDJump)
                {
                    if (rowpresent != null) // if its in the list, move to top and increment he's
                    {
                        dataGridViewStarList.Rows.Remove(rowpresent);
                        List <HistoryEntry> syslist = (List <HistoryEntry>)rowpresent.Tag;
                        syslist.Insert(0, he);                                // add onto list
                        rowpresent.Cells[2].Value = syslist.Count.ToString(); // update count
                        dataGridViewStarList.Rows.Insert(0, rowpresent);      // move to top..
                    }
                    else
                    {
                        // process thru normal filter to see if its displayable

                        var filter = (TravelHistoryFilter)comboBoxHistoryWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;
                        List <HistoryEntry> result = filter.Filter(hl);     // last entry, first in list
                        result = HistoryList.FilterHLByTravel(result);      // keep only travel entries (location after death, FSD jumps)
                        List <List <HistoryEntry> > syslists = HistoryList.SystemAggregateList(result);

                        if (syslists.Count > 0 && syslists[0][0].System.Name == he.System.Name) // if the filtered result has our system in (which must be the first, since its newest), its inside the filter, add
                        {
                            string filtertext = textBoxFilter.Text;
                            var    row        = CreateHistoryRow(syslists[0], filtertext);
                            if (row != null)    // text may have filtered it out
                            {
                                dataGridViewStarList.Rows.Insert(0, row);
                            }
                        }
                    }

                    if (checkBoxCursorToTop.Checked && dataGridViewStarList.DisplayedRowCount(false) > 0)   // Move focus to new row
                    {
                        //System.Diagnostics.Debug.WriteLine("Auto Sel");
                        dataGridViewStarList.ClearSelection();
                        int rowno = dataGridViewStarList.Rows.GetFirstRow(DataGridViewElementStates.Visible);
                        if (rowno != -1)
                        {
                            dataGridViewStarList.CurrentCell = dataGridViewStarList.Rows[rowno].Cells[1];       // its the current cell which needs to be set, moves the row marker as well
                        }
                        FireChangeSelection();
                    }
                }
                else
                {
                    if (rowpresent != null)         // only need to do something if its displayed
                    {
                        List <HistoryEntry> syslist = (List <HistoryEntry>)rowpresent.Tag;
                        var    node = discoveryform.history.starscan?.FindSystem(syslist[0].System, false); // may be null
                        string info = Infoline(syslist, node);                                              // lookup node, using star name, no EDSM lookup.
                        rowpresent.Cells[3].Value = info;                                                   // update info
                        rowpresent.Cells[4].Value = node?.ScanValue(true).ToString("N0") ?? "0";            // update scan value
                    }
                }
            }
        }
Exemplo n.º 22
0
        public void HistoryChanged(HistoryList hl, bool disablesorting) // on History change
        {
            if (hl == null)                                             // just for safety
            {
                return;
            }

            loadcomplete = false;

            autoupdateedsm.Stop();

            Tuple <long, int> pos = CurrentGridPosByJID();

            current_historylist = hl;

            SortOrder sortorder = dataGridViewStarList.SortOrder;
            int       sortcol   = dataGridViewStarList.SortedColumn?.Index ?? -1;

            if (sortcol >= 0 && disablesorting)
            {
                dataGridViewStarList.Columns[sortcol].HeaderCell.SortGlyphDirection = SortOrder.None;
                sortcol = -1;
            }

            System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCountLap(this, true) + " SL " + displaynumber + " Load start");

            rowsbyjournalid.Clear();
            dataGridViewStarList.Rows.Clear();

            dataGridViewStarList.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.GetTimeTitle();

            var filter = (TravelHistoryFilter)comboBoxHistoryWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            List <HistoryEntry> result = filter.Filter(hl);     // last entry, first in list

            result = HistoryList.FilterHLByTravel(result);      // keep only travel entries (location after death, FSD jumps)
            List <List <HistoryEntry> >  syslists      = HistoryList.SystemAggregateList(result);
            List <List <HistoryEntry>[]> syslistchunks = new List <List <HistoryEntry>[]>();

            for (int i = 0; i < syslists.Count; i += 1000)
            {
                int totake = Math.Min(1000, syslists.Count - i);
                List <HistoryEntry>[] syslistchunk = new List <HistoryEntry> [totake];
                syslists.CopyTo(i, syslistchunk, 0, totake);
                syslistchunks.Add(syslistchunk);
            }

            todo.Clear();

            string filtertext = textBoxFilter.Text;

            foreach (var syslistchunk in syslistchunks)
            {
                todo.Enqueue(() =>
                {
                    dataViewScrollerPanel.Suspend();
                    foreach (var syslist in syslistchunk)
                    {
                        var row = CreateHistoryRow(syslist, filtertext);
                        if (row != null)
                        {
                            dataGridViewStarList.Rows.Add(row);
                        }
                    }

                    dataViewScrollerPanel.Resume();
                });
            }

            todo.Enqueue(() =>
            {
                dataGridViewStarList.FilterGridView(filtertext);

                int rowno = FindGridPosByJID(pos.Item1, true);     // find row.. must be visible..  -1 if not found/not visible

                if (rowno >= 0)
                {
                    dataGridViewStarList.CurrentCell = dataGridViewStarList.Rows[rowno].Cells[pos.Item2];       // its the current cell which needs to be set, moves the row marker as well currentGridRow = (rowno!=-1) ?
                }
                else if (dataGridViewStarList.Rows.GetRowCount(DataGridViewElementStates.Visible) > 0)
                {
                    rowno = dataGridViewStarList.Rows.GetFirstRow(DataGridViewElementStates.Visible);
                    dataGridViewStarList.CurrentCell = dataGridViewStarList.Rows[rowno].Cells[StarHistoryColumns.StarName];
                }
                else
                {
                    rowno = -1;
                }

                System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCountLap(this) + " SL " + displaynumber + " Load Finish");

                if (sortcol >= 0)
                {
                    dataGridViewStarList.Sort(dataGridViewStarList.Columns[sortcol], (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                    dataGridViewStarList.Columns[sortcol].HeaderCell.SortGlyphDirection = sortorder;
                }

                //System.Diagnostics.Debug.WriteLine("Fire HC");

                autoupdaterowoffset = autoupdaterowstart = 0;
                autoupdateedsm.Start();

                FireChangeSelection();      // and since we repainted, we should fire selection, as we in effect may have selected a new one

                loadcomplete = true;
            });

            todotimer.Start();
        }
Exemplo n.º 23
0
 public void HistoryChanged(HistoryList hl)           // on History change
 {
     HistoryChanged(hl, false);
 }
Exemplo n.º 24
0
 private void AddNewEntry(HistoryEntry he, HistoryList hl)
 {
     Stats(he,hl);
 }
Exemplo n.º 25
0
 private void Refresh()
 {
     _back.SetEnabled(HistoryList.CanMoveBack());
     _forward.SetEnabled(HistoryList.CanMoveForward());
     _listView.Refresh();
 }
Exemplo n.º 26
0
        static public void SystemVarsFurtherInfo(ActionLanguage.ActionProgramRun vars, HistoryList hl, ISystem s, string prefix)
        {
            System.Globalization.CultureInfo ct = System.Globalization.CultureInfo.InvariantCulture;

            vars[prefix + "VisitCount"]    = hl.GetVisitsCount(s.name).ToString(ct);
            vars[prefix + "ScanCount"]     = hl.GetScans(s.name).Count.ToString(ct);
            vars[prefix + "FSDJumpsTotal"] = hl.GetFSDJumps(new TimeSpan(100000, 0, 0, 0)).ToString(ct);
        }
Exemplo n.º 27
0
        static public void HistoryEventFurtherInfo(ActionLanguage.ActionProgramRun vars, HistoryList hl, HistoryEntry he, string prefix)
        {
            if (he != null)
            {
                System.Globalization.CultureInfo ct = System.Globalization.CultureInfo.InvariantCulture;

                int fsd = hl.GetFSDJumps(new DateTime(1980, 1, 1), he.EventTimeUTC); // total before
                if (he.IsFSDJump)                                                    // if on an fsd, count this in
                {
                    fsd++;
                }
                vars[prefix + "FSDJump"] = fsd.ToString(ct);
            }
        }
Exemplo n.º 28
0
 public override void Display(HistoryEntry current, HistoryList history)
 {
     Display(history);
 }
Exemplo n.º 29
0
 private void Discoveryform_OnHistoryChange(HistoryList obj)
 {
     Display();
 }
Exemplo n.º 30
0
 public void Display(HistoryList hl)            // when user clicks around..  HE may be null here
 {
     currentSystem = hl.GetLastFSD;
     updateScreen();
 }
 private void Uctg_OnTravelSelectionChanged(HistoryEntry he, HistoryList hl, bool selectedEntry)
 {
     Display(he);
 }
Exemplo n.º 32
0
 private void NewEntry(HistoryEntry l, HistoryList hl)
 {
     currentSystem = hl.GetLastFSD;
     updateScreen();
 }
Exemplo n.º 33
0
 void RedrawTripPanel(HistoryList hl)
 {
     if (IsTripPanelPopOutReady)
     {
         tripPanelPopOut.displayLastFSDOrFuel();
     }
 }
Exemplo n.º 34
0
 private void Discoveryform_OnNewEntry(HistoryEntry he, HistoryList hl)
 {
     Discoveryform_OnHistoryChange(hl);
 }
Exemplo n.º 35
0
        // called when a new entry is made..
        public void NewEntry(HistoryEntry he, HistoryList hl)
        {
            bool add = WouldAddEntry(he);

            if (add)
                Display(hl);

            if (he.journalEntry.EventTypeID == EliteDangerous.JournalTypeEnum.Scan)       // if scan, see if it needs to be displayed
            {
                ShowScanData(he.journalEntry as EliteDangerous.JournalEvents.JournalScan);
            }
        }
Exemplo n.º 36
0
 private void Discoveryform_OnHistoryChange(HistoryList hl)
 {
     UpdateComboBox(hl);
 }
Exemplo n.º 37
0
        private void bindSettings()
        {
            var settings = Settings.Default;

            log.Debug("binding form size to settings with height={0}, width={1}...", settings.FormWidth, settings.FormHeight);
            this.Width = settings.FormWidth;
            this.Height = settings.FormHeight;
            log.Debug("form size is now bound with height={0}, width={1}", this.Width, this.Height);

            splitterMain.Orientation = Settings.Default.SplitterOrientation;
            updateSplitterDistance(); //must come after width and height and orientation updates
            (rbGrpResponseBodyOutputs.FirstOrDefault(x => (ResponseBodyOutput)x.Tag == Settings.Default.ResponseBodyOutput) ?? rbResponseBodyOutputPretty).Checked = true;

            if (!launchFilePath.IsBlank())
                openRequestFile(launchFilePath);
            else if (!settings.DefaultRequestFilePath.IsBlank())
                openRequestFile(settings.DefaultRequestFilePath);

            snapshots = new HistoryList<RequestResponseSnapshot>(Settings.Default.MaxSnapshots);

            updateSSLValidationHandler();
        }
Exemplo n.º 38
0
 private void Discoveryform_OnHistoryChange(HistoryList hl)
 {
     last_sys = hl.GetLast?.System;        // may be null
     DrawSystem(last_sys, last_sys?.Name); // may be null
 }
Exemplo n.º 39
0
 public void SelectionChanged(HistoryEntry he, HistoryList hl)
 {
     Stats(he, hl);
 }
Exemplo n.º 40
0
        public override bool ExecuteAction(ActionProgramRun ap)
        {
            string res;

            if (ap.functions.ExpandString(UserData, out res) != ConditionFunctions.ExpandResult.Failed)
            {
                HistoryList  hl     = (ap.actioncontroller as ActionController).HistoryList;
                StringParser sp     = new StringParser(res);
                string       prefix = "EC_";

                string cmdname = sp.NextWord(" ", true);

                if (cmdname != null && cmdname.Equals("prefix"))
                {
                    prefix = sp.NextWord();

                    if (prefix == null)
                    {
                        ap.ReportError("Missing name after Prefix in Event");
                        return(true);
                    }

                    cmdname = sp.NextWord(" ", true);
                }

                int jidindex = -1;

                if (cmdname != null && (cmdname.Equals("from") || cmdname.Equals("thpos")))
                {
                    long?jid;

                    if (cmdname.Equals("thpos"))
                    {
                        HistoryEntry he = (ap.actioncontroller as ActionController).DiscoveryForm.TravelControl.GetTravelHistoryCurrent;

                        if (he == null)
                        {
                            ReportEntry(ap, null, 0, prefix);
                            return(true);
                        }

                        jid = he.Journalid;
                    }
                    else
                    {
                        jid = sp.NextWord().InvariantParseLongNull();
                        if (!jid.HasValue)
                        {
                            ap.ReportError("Non integer JID after FROM in Event");
                            return(true);
                        }
                    }

                    jidindex = hl.GetIndex(jid.Value);

                    if (jidindex == -1)
                    {
                        ReportEntry(ap, null, 0, prefix);
                        return(true);
                    }

                    cmdname = sp.NextWord(" ", true);
                }

                if (cmdname == null)
                {
                    if (jidindex != -1)
                    {
                        ReportEntry(ap, hl.EntryOrder, jidindex, prefix);
                    }
                    else
                    {
                        ap.ReportError("No commands in Event");
                    }

                    return(true);
                }

                bool fwd  = cmdname.Equals("forward") || cmdname.Equals("first");
                bool back = cmdname.Equals("backward") || cmdname.Equals("last");

                if (fwd || back)
                {
                    List <string> eventnames   = sp.NextOptionallyBracketedList();
                    bool          whereasfirst = eventnames.Count == 1 && eventnames[0].Equals("WHERE", StringComparison.InvariantCultureIgnoreCase);

                    ConditionLists cond = new ConditionLists();
                    string         nextword;

                    if (whereasfirst || ((nextword = sp.NextWord()) != null && nextword.Equals("WHERE", StringComparison.InvariantCultureIgnoreCase)))
                    {
                        if (whereasfirst)       // clear out event names if it was WHERE cond..
                        {
                            eventnames.Clear();
                        }

                        string resc = cond.Read(sp.LineLeft);       // rest of it is the condition..
                        if (resc != null)
                        {
                            ap.ReportError(resc + " in Where of Event");
                            return(true);
                        }
                    }

                    List <HistoryEntry> hltest;

                    if (jidindex == -1)         // if no JID given..
                    {
                        hltest = hl.EntryOrder; // the whole list
                    }
                    else if (fwd)
                    {
                        hltest = hl.EntryOrder.GetRange(jidindex + 1, hl.Count - (jidindex + 1));       // cut down list, excluding this entry
                    }
                    else
                    {
                        hltest = hl.EntryOrder.GetRange(0, jidindex);
                    }

                    if (eventnames.Count > 0)
                    {
                        hltest = (from h in hltest where eventnames.Contains(h.journalEntry.EventTypeStr, StringComparer.OrdinalIgnoreCase) select h).ToList();
                    }

                    if (cond.Count > 0)                                                                              // if we have filters, apply, filter out, true only stays
                    {
                        hltest = UserControls.FilterHelpers.CheckFilterTrue(hltest, cond, new ConditionVariables()); // apply filter..
                    }
                    if (fwd)
                    {
                        ReportEntry(ap, hltest, 0, prefix);
                    }
                    else
                    {
                        ReportEntry(ap, hltest, hltest.Count - 1, prefix);
                    }

                    return(true);
                }
                else
                {
                    if (jidindex == -1)
                    {
                        ap.ReportError("Valid JID must be given for command " + cmdname + " in Event");
                    }
                    else if (cmdname.Equals("action"))
                    {
                        int count = (ap.actioncontroller as ActionController).ActionRunOnEntry(hl.EntryOrder[jidindex], Actions.ActionEventEDList.EventCmd(hl.EntryOrder[jidindex]), now: true);
                        ap[prefix + "Count"] = count.ToString(System.Globalization.CultureInfo.InvariantCulture);
                    }
                    else if (cmdname.Equals("edsm"))
                    {
                        HistoryEntry he = hl.EntryOrder[jidindex];
                        (ap.actioncontroller as ActionController).HistoryList.FillEDSM(he);

                        long?id_edsm = he.System.EDSMID;
                        if (id_edsm <= 0)
                        {
                            id_edsm = null;
                        }

                        EliteDangerousCore.EDSM.EDSMClass edsm = new EliteDangerousCore.EDSM.EDSMClass();
                        string url = edsm.GetUrlToEDSMSystem(he.System.Name, id_edsm);

                        ap[prefix + "URL"] = url;

                        if (url.Length > 0)         // may pass back empty string if not known, this solves another exception
                        {
                            System.Diagnostics.Process.Start(url);
                        }
                    }
                    else if (cmdname.Equals("ross"))
                    {
                        HistoryEntry he = hl.EntryOrder[jidindex];
                        (ap.actioncontroller as ActionController).HistoryList.FillEDSM(he);

                        string url = "";

                        if (he.System.EDDBID > 0)
                        {
                            url = "http://ross.eddb.io/system/update/" + he.System.EDDBID.ToString();
                            System.Diagnostics.Process.Start(url);
                        }

                        ap[prefix + "URL"] = url;
                    }
                    else if (cmdname.Equals("info"))
                    {
                        HistoryEntry he = hl.EntryOrder[jidindex];
                        ActionVars.HistoryEventFurtherInfo(ap, hl, he, prefix);
                        ActionVars.SystemVarsFurtherInfo(ap, hl, he.System, prefix);
                        ActionVars.ShipModuleInformation(ap, he.ShipInformation, prefix);
                    }
                    else if (cmdname.Equals("missions"))
                    {
                        HistoryEntry he = hl.EntryOrder[jidindex];
                        ActionVars.MissionInformation(ap, he.MissionList, prefix);
                    }
                    else
                    {
                        ap.ReportError("Unknown command " + cmdname + " in Event");
                    }
                }
            }
            else
            {
                ap.ReportError(res);
            }

            return(true);
        }
Exemplo n.º 41
0
        private void Stats(HistoryEntry he, HistoryList hl)
        {
            dataGridViewStats.Rows.Clear();

            if (he != null)
            {
                StatToDGV("Visits", hl.GetVisitsCount(he.System.name, he.System.id_edsm) + " to system " + he.System.name);
                StatToDGV("Jumps Before System", hl.GetFSDJumpsBeforeUTC(he.EventTimeUTC));
            }

            int totaljumps = hl.GetFSDJumps(new TimeSpan(10000, 0, 0, 0));
            StatToDGV("Total No of jumps: ", totaljumps);
            if (totaljumps > 0)
            {
                StatToDGV("Jump History", "24 Hours: " + hl.GetFSDJumps(new TimeSpan(1, 0, 0, 0)) +
                                      ", One Week: " + hl.GetFSDJumps(new TimeSpan(7, 0, 0, 0)) +
                                      ", 30 Days: " + hl.GetFSDJumps(new TimeSpan(30, 0, 0, 0)) +
                                      ", One Year: " + hl.GetFSDJumps(new TimeSpan(365, 0, 0, 0))
                                      );

                HistoryEntry north = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.z > l; if (v) l = s.System.z; return v; });

                HistoryEntry south = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.z < l; if (v) l = s.System.z; return v; });

                HistoryEntry east = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.x > l; if (v) l = s.System.x; return v; });

                HistoryEntry west = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.x < l; if (v) l = s.System.x; return v; });

                HistoryEntry up = hl.GetConditionally(Double.MinValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.y > l; if (v) l = s.System.y; return v; });

                HistoryEntry down = hl.GetConditionally(Double.MaxValue, (HistoryEntry s, ref double l) =>
                { bool v = s.IsFSDJump && s.System.HasCoordinate && s.System.y < l; if (v) l = s.System.y; return v; });

                StatToDGV("Most North", north.System.name + " @ " + north.System.x.ToString("0.0") + "," + north.System.y.ToString("0.0") + "," + north.System.z.ToString("0.0"));
                StatToDGV("Most South", south.System.name + " @ " + south.System.x.ToString("0.0") + "," + south.System.y.ToString("0.0") + "," + south.System.z.ToString("0.0"));
                StatToDGV("Most East", east.System.name + " @ " + east.System.x.ToString("0.0") + "," + east.System.y.ToString("0.0") + "," + east.System.z.ToString("0.0"));
                StatToDGV("Most West", west.System.name + " @ " + west.System.x.ToString("0.0") + "," + west.System.y.ToString("0.0") + "," + west.System.z.ToString("0.0"));
                StatToDGV("Most Highest", up.System.name + " @ " + up.System.x.ToString("0.0") + "," + up.System.y.ToString("0.0") + "," + up.System.z.ToString("0.0"));
                StatToDGV("Most Lowest", down.System.name + " @ " + down.System.x.ToString("0.0") + "," + down.System.y.ToString("0.0") + "," + down.System.z.ToString("0.0"));

                var groupeddata = from data in hl.OrderByDate
                                  where data.IsFSDJump
                                  group data by data.System.name
                                      into grouped
                                  select new
                                  {
                                      Title = grouped.Key,
                                      Count = grouped.Count()
                                  };

                mostVisited.Visible = true;

                Color GridC = discoveryform.theme.GridCellText;
                Color TextC = discoveryform.theme.VisitedSystemColor;
                mostVisited.Titles.Clear();
                mostVisited.Titles.Add(new Title("Most Visited", Docking.Top, discoveryform.theme.GetFont, TextC));
                mostVisited.Series[0].Points.Clear();

                mostVisited.ChartAreas[0].AxisX.LabelStyle.ForeColor = TextC;
                mostVisited.ChartAreas[0].AxisY.LabelStyle.ForeColor = TextC;
                mostVisited.ChartAreas[0].AxisX.MajorGrid.LineColor = GridC;
                mostVisited.ChartAreas[0].AxisX.MinorGrid.LineColor = GridC;
                mostVisited.ChartAreas[0].AxisY.MajorGrid.LineColor = GridC;
                mostVisited.ChartAreas[0].AxisY.MinorGrid.LineColor = GridC;
                mostVisited.ChartAreas[0].BorderColor = GridC;
                mostVisited.ChartAreas[0].BorderDashStyle = ChartDashStyle.Solid;
                mostVisited.ChartAreas[0].BorderWidth = 2;

                mostVisited.ChartAreas[0].BackColor = Color.Transparent;
                mostVisited.Series[0].Color = GridC;
                mostVisited.BorderlineColor = Color.Transparent;

                int i = 0;
                foreach (var data in from a in groupeddata orderby a.Count descending select a)
                {
                    if (data.Count <= 1 || i == 10)
                        break;

                    mostVisited.Series[0].Points.Add(new DataPoint(i, data.Count));
                    mostVisited.Series[0].Points[i].AxisLabel = data.Title;
                    mostVisited.Series[0].Points[i].LabelForeColor = TextC;
                    i++;
                }
            }
            else
                mostVisited.Visible = false;

            SizeControls();
        }
Exemplo n.º 42
0
 /// <summary>
 /// called when a new entry is made.. check to see if its a scan update
 /// </summary>
 /// <param name="he">HistoryEntry</param>
 /// <param name="hl">HistoryList</param>
 private void NewEntry(HistoryEntry he, HistoryList hl)
 {
     DrawSystem(he, he.EntryType == JournalTypeEnum.Scan);
 }
Exemplo n.º 43
0
        // called when a new entry is made.. check to see if its a scan update
        public void NewEntry(HistoryEntry he, HistoryList hl)
        {
            // affecting our system
            StarScan.SystemNode newnode = (he != null) ? hl.starscan.FindSystem(he.System) : null;  // find node..

            if ( newnode == last_sn && he.EntryType == EliteDangerous.JournalTypeEnum.Scan )  // if on same star system, and its a scan, it may have been updated..
            {
                DrawSystem(last_sn);
            }
        }
 private void Discoveryform_OnHistoryChange(HistoryList hl)
 {
     Display(hl.GetLast);
 }
		internal void SetParentList (HistoryList list)
		{
			this.list = list;
		}
Exemplo n.º 46
0
 internal void GoBack()
 {
     if (historyList.Count != 0)
     {
         historyList.RemoveAt(historyList.Count - 1);
         if (historyList.Count != 0)
         {
             _linkliste = new HistoryList<LinkClass>();
             _linkliste = historyList[historyList.Count - 1];
             setWindowViewMode(_linkliste.GetPageType);
         }
         else
         {
             setWindowViewMode(PageType.ServerList);
         }
     }
     else
     {
         setWindowViewMode(PageType.ServerList);
     }
     setLogToActiveWindow();
 }
 public RequestActionEventArgs(bool showWaitCursor, HistoryList<LinkClass> linkliste, PageType currentPageType)
     : this(showWaitCursor)
 {
     LinkListe = linkliste;
     CurrentPageType = currentPageType;
 }
Exemplo n.º 48
0
        private void FetcherThreadProc()
        {
            bool jupdate = false;

            LastEventTime  = DateTime.UtcNow;
            FirstEventTime = LastEventTime;

            int waittime = 2000; // Max 1 request every 2 seconds, with a backoff if the rate limit is hit

            if (EDSMRequestBackoffTime > DateTime.UtcNow)
            {
                waittime = (int)Math.Min(EDSMMaxLogAgeMinutes * 60000, Math.Min(BackoffInterval.TotalSeconds * 1000, EDSMRequestBackoffTime.Subtract(DateTime.UtcNow).TotalSeconds * 1000));
            }

            while (!ExitRequested.WaitOne(waittime))
            {
                EDSMClass edsm = new EDSMClass {
                    apiKey = Commander.APIKey, commanderName = Commander.EdsmName
                };
                List <HistoryEntry> edsmlogs     = null;
                DateTime            logstarttime = DateTime.MinValue;
                DateTime            logendtime   = DateTime.MinValue;
                int res = -1;

                if (edsm.IsApiKeySet && Commander.SyncFromEdsm && DateTime.UtcNow > EDSMRequestBackoffTime)
                {
                    if (DateTime.UtcNow.Subtract(LastEventTime).TotalMinutes >= EDSMMaxLogAgeMinutes)
                    {
                        Trace.WriteLine($"Retrieving logs starting {LastEventTime}");
                        res = edsm.GetLogs(LastEventTime, null, out edsmlogs, out logstarttime, out logendtime);
                    }
                    else if (FirstEventTime > GammaStart)
                    {
                        Trace.WriteLine($"Retrieving logs ending {FirstEventTime}");
                        res = edsm.GetLogs(null, FirstEventTime, out edsmlogs, out logstarttime, out logendtime);
                    }
                }

                if (ExitRequested.WaitOne(0))
                {
                    return;
                }

                if (res == 429) // Rate Limit Exceeded
                {
                    Trace.WriteLine($"EDSM Log request rate limit hit - backing off for {BackoffInterval.TotalSeconds}s");
                    EDSMRequestBackoffTime = DateTime.UtcNow + BackoffInterval;
                    BackoffInterval        = BackoffInterval + TimeSpan.FromSeconds(60);
                }
                else if (logstarttime > LastEventTime && logendtime < FirstEventTime)
                {
                    Trace.WriteLine($"Bad start and/or end times returned by EDSM - backing off for {BackoffInterval.TotalSeconds}s");
                    EDSMRequestBackoffTime = DateTime.UtcNow + BackoffInterval;
                    BackoffInterval        = BackoffInterval + TimeSpan.FromSeconds(60);
                }
                else if (res == 100 && edsmlogs != null)
                {
                    BackoffInterval = TimeSpan.FromSeconds(60);

                    if (logendtime > DateTime.UtcNow)
                    {
                        logendtime = DateTime.UtcNow;
                    }

                    List <HistoryEntry> hlfsdlist  = JournalEntry.GetAll(Commander.Nr).OfType <JournalLocOrJump>().OrderBy(je => je.EventTimeUTC).Select(je => HistoryEntry.FromJournalEntry(je, null, false, out jupdate)).ToList();
                    HistoryList         hl         = new HistoryList(hlfsdlist);
                    List <DateTime>     hlfsdtimes = hlfsdlist.Select(he => he.EventTimeUTC).ToList();

                    List <HistoryEntry> toadd = new List <HistoryEntry>();

                    int previdx = -1;
                    foreach (HistoryEntry he in edsmlogs)      // find out list of ones not present
                    {
                        int index = hlfsdlist.FindIndex(x => x.System.name.Equals(he.System.name, StringComparison.InvariantCultureIgnoreCase) && x.EventTimeUTC.Ticks == he.EventTimeUTC.Ticks);

                        if (index < 0)
                        {
                            // Look for any entries where DST may have thrown off the time
                            foreach (var vi in hlfsdlist.Select((v, i) => new { v = v, i = i }).Where(vi => vi.v.System.name.Equals(he.System.name, StringComparison.InvariantCultureIgnoreCase)))
                            {
                                if (vi.i > previdx)
                                {
                                    double hdiff = vi.v.EventTimeUTC.Subtract(he.EventTimeUTC).TotalHours;
                                    if (hdiff >= -2 && hdiff <= 2 && hdiff == Math.Floor(hdiff))
                                    {
                                        if (vi.v.System.id_edsm <= 0)
                                        {
                                            vi.v.System.id_edsm = 0;
                                            hl.FillEDSM(vi.v);
                                        }

                                        if (vi.v.System.id_edsm <= 0 || vi.v.System.id_edsm == he.System.id_edsm)
                                        {
                                            index = vi.i;
                                            break;
                                        }
                                    }
                                }
                            }
                        }

                        if (index < 0)
                        {
                            toadd.Add(he);
                        }
                        else
                        {
                            HistoryEntry lhe = hlfsdlist[index];

                            if (he.IsEDSMFirstDiscover && !lhe.IsEDSMFirstDiscover)
                            {
                                lhe.SetFirstDiscover();
                            }

                            previdx = index;
                        }
                    }

                    if (toadd.Count > 0)                         // if we have any, we can add
                    {
                        TravelLogUnit tlu = new TravelLogUnit(); // need a tlu for it
                        tlu.type        = 2;                     // EDSM
                        tlu.Name        = "EDSM-" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
                        tlu.Size        = 0;
                        tlu.Path        = "EDSM";
                        tlu.CommanderId = EDCommander.CurrentCmdrID;
                        tlu.Add();  // Add to Database

                        using (SQLiteConnectionUser cn = new SQLiteConnectionUser(utc: true))
                        {
                            foreach (HistoryEntry he in toadd)
                            {
                                JObject jo = EDDiscovery.EliteDangerous.JournalEntry.CreateFSDJournalEntryJson(he.EventTimeUTC,
                                                                                                               he.System.name, he.System.x, he.System.y, he.System.z,
                                                                                                               EDDConfig.Instance.DefaultMapColour);
                                EDDiscovery.EliteDangerous.JournalEntry je =
                                    EDDiscovery.EliteDangerous.JournalEntry.CreateFSDJournalEntry(tlu.id, tlu.CommanderId.Value,
                                                                                                  (int)EDDiscovery.EliteDangerous.SyncFlags.EDSM, jo);

                                System.Diagnostics.Trace.WriteLine(string.Format("Add {0} {1}", je.EventTimeUTC, he.System.name));
                                je.Add(jo, cn);
                            }
                        }

                        LogLine($"Retrieved {toadd.Count} log entries from EDSM, from {logstarttime.ToLocalTime().ToString()} to {logendtime.ToLocalTime().ToString()}");

                        if (logendtime > LastEventTime || logstarttime <= GammaStart)
                        {
                            if (OnDownloadedSystems != null)
                            {
                                OnDownloadedSystems();
                            }
                        }
                    }

                    if (logstarttime < FirstEventTime)
                    {
                        FirstEventTime = logstarttime;
                    }

                    if (logendtime > LastEventTime)
                    {
                        LastEventTime = logendtime;
                    }
                }
            }
        }
        public void No_filter_does_not_filter_anything()
        {
            var veryOldData = new HistoryEntry { EventTimeUTC = DateTime.UtcNow.Subtract(TimeSpan.FromDays(500000)) };
            var input = new HistoryList { veryOldData };

            Check.That(TravelHistoryFilter.NoFilter.Filter(input)).ContainsExactly(veryOldData);
        }
Exemplo n.º 50
0
        private void Display(HistoryList hl, bool disablesorting)
        {
            if (hl == null)     // just for safety
            {
                return;
            }

            loadcomplete = false;
            this.Cursor  = Cursors.WaitCursor;

            current_historylist = hl;

            Tuple <long, int> pos = CurrentGridPosByJID();

            SortOrder sortorder = dataGridViewJournal.SortOrder;
            int       sortcol   = dataGridViewJournal.SortedColumn?.Index ?? -1;

            if (sortcol >= 0 && disablesorting)
            {
                dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = SortOrder.None;
                sortcol = -1;
            }

            var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

            System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCountLap(this, true) + " JG " + displaynumber + " Load start");

            List <HistoryEntry> result = filter.Filter(hl);

            fdropdown = hl.Count() - result.Count();

            result = HistoryList.FilterByJournalEvent(result, EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbFilterSave, "All"), out ftotalevents);
            result = FilterHelpers.FilterHistory(result, fieldfilter, discoveryform.Globals, out ftotalfilters);

            dataGridViewJournal.Rows.Clear();
            rowsbyjournalid.Clear();

            dataGridViewJournal.Columns[0].HeaderText = EDDiscoveryForm.EDDConfig.GetTimeTitle();

            List <HistoryEntry[]> chunks = new List <HistoryEntry[]>();

            for (int i = 0; i < result.Count; i += 1000)
            {
                HistoryEntry[] chunk = new HistoryEntry[i + 1000 > result.Count ? result.Count - i : 1000];

                result.CopyTo(i, chunk, 0, chunk.Length);
                chunks.Add(chunk);
            }

            todo.Clear();
            string filtertext = textBoxFilter.Text;

            foreach (var chunk in chunks)
            {
                todo.Enqueue(() =>
                {
                    dataViewScrollerPanel.Suspend();
                    foreach (var item in chunk)
                    {
                        var row = CreateHistoryRow(item, filtertext);
                        if (row != null)
                        {
                            dataGridViewJournal.Rows.Add(row);
                        }
                    }
                    dataViewScrollerPanel.Resume();
                });
            }

            todo.Enqueue(() =>
            {
                UpdateToolTipsForFilter();

                int rowno = FindGridPosByJID(pos.Item1, true);

                if (rowno >= 0)
                {
                    dataGridViewJournal.CurrentCell = dataGridViewJournal.Rows[rowno].Cells[pos.Item2];       // its the current cell which needs to be set, moves the row marker as well            currentGridRow = (rowno!=-1) ?
                }

                System.Diagnostics.Trace.WriteLine(BaseUtils.AppTicks.TickCountLap(this) + " JG " + displaynumber + " Load Finish");

                if (sortcol >= 0)
                {
                    dataGridViewJournal.Sort(dataGridViewJournal.Columns[sortcol], (sortorder == SortOrder.Descending) ? ListSortDirection.Descending : ListSortDirection.Ascending);
                    dataGridViewJournal.Columns[sortcol].HeaderCell.SortGlyphDirection = sortorder;
                }

                FireChangeSelection();

                this.Cursor = Cursors.Default;

                loadcomplete = true;
            });

            todotimer.Start();
        }
Exemplo n.º 51
0
        private void AddNewEntry(HistoryEntry he, HistoryList hl)               // add if in event filter, and not in field filter..
        {
            if (!loadcomplete)
            {
                todo.Enqueue(() => AddNewEntry(he, hl));
                return;
            }

            bool add = he.IsJournalEventInEventFilter(EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbFilterSave, "All"));

            if (!add)
            {
                ftotalevents++;
                UpdateToolTipsForFilter();
            }

            if (add && !FilterHelpers.FilterHistory(he, fieldfilter, discoveryform.Globals))
            {
                add = false;
                ftotalfilters++;
                UpdateToolTipsForFilter();
            }

            if (add)
            {
                var row = CreateHistoryRow(he, textBoxFilter.Text);
                if (row != null)
                {
                    dataGridViewJournal.Rows.Insert(0, row);
                }

                var filter = (TravelHistoryFilter)comboBoxJournalWindow.SelectedItem ?? TravelHistoryFilter.NoFilter;

                if (filter.MaximumNumberOfItems != null)
                {
                    for (int r = dataGridViewJournal.Rows.Count - 1; r >= dataGridViewJournal.Rows.Count; r--)
                    {
                        dataGridViewJournal.Rows.RemoveAt(r);
                    }
                }

                if (filter.MaximumDataAge != null)
                {
                    for (int r = dataGridViewJournal.Rows.Count - 1; r > 0; r--)
                    {
                        var rhe = dataGridViewJournal.Rows[r].Tag as HistoryEntry;
                        if (rhe != null && rhe.AgeOfEntry() > filter.MaximumDataAge)
                        {
                            dataGridViewJournal.Rows.RemoveAt(r);
                        }
                        else
                        {
                            break;
                        }
                    }
                }

                if (checkBoxCursorToTop.Checked && dataGridViewJournal.DisplayedRowCount(false) > 0)   // Move focus to new row
                {
                    dataGridViewJournal.ClearSelection();
                    int rowno = dataGridViewJournal.Rows.GetFirstRow(DataGridViewElementStates.Visible);
                    if (rowno != -1)
                    {
                        dataGridViewJournal.CurrentCell = dataGridViewJournal.Rows[rowno].Cells[1];       // its the current cell which needs to be set, moves the row marker as well
                    }
                    FireChangeSelection();
                }
            }
        }
Exemplo n.º 52
0
 /// <summary>
 /// Called at first start or hooked to change cursor
 /// </summary>
 /// <param name="he">HistoryEntry</param>
 /// <param name="hl">HistoryList</param>
 private void Display(HistoryEntry he, HistoryList hl)
 {
     DrawSystem(he, false);
 }
Exemplo n.º 53
0
 /// <summary>
 /// Called at first start or hooked to change cursor
 /// </summary>
 /// <param name="he">HistoryEntry</param>
 /// <param name="hl">HistoryList</param>
 private void Display(HistoryEntry he, HistoryList hl, bool selectedEntry)
 {
     ResetDefaults();
     DrawSystem(he, false);
 }
 private void Discoveryform_OnNewEntry(HistoryEntry he, HistoryList hl)
 {
     Display(he);
 }
Exemplo n.º 55
0
 /// <summary>
 /// Clear all Lists
 /// </summary>
 public void Reset()
 {
     _manager = null;
     _linkliste = new HistoryList<LinkClass>();
     historyList = new List<HistoryList<LinkClass>>();
     _linklisteDic = new Dictionary<GUIListItem, LinkClass>();
 }
Exemplo n.º 56
0
 private void Discoveryform_OnNewEntry(HistoryEntry he, HistoryList hl)
 {
     last_he = he;
     Display();
 }
Exemplo n.º 57
0
        private void _manager_RequestAction(object sender, EventArgs e)
        {
            if (e is RequestActionEventArgs)
            {
                RequestActionEventArgs args = e as RequestActionEventArgs;

                if (args.Status == null)
                {
                    if (args.LinkListe != null)
                    {
                        _linkliste = new HistoryList<LinkClass>();
                        _linkliste = args.LinkListe;
                        _linkliste.GetPageType = args.CurrentPageType;
                        setWindowViewMode(args.CurrentPageType);
                        lastPage = args.CurrentPageType;
                        historyList.Add(_linkliste);
                        setLogToActiveWindow();
                    }
                    showWaitCursor(args.ShowWaitCursor);
                }
                else
                {
                    addToLog(args.Status);
                    setLogToActiveWindow();
                }
            }
            if (e is PicDownloadEventArgs)
            {
                PicDownloadEventArgs args = e as PicDownloadEventArgs;
                var key = (from k in _linklisteDic
                           where string.Compare(k.Value.Name, args.item, true) == 0
                           select k.Key).FirstOrDefault();

                GUIListItem item = key as GUIListItem;
                if (item != null)
                {
                    item.IconImage = args.ImagePath;
                    item.IconImageBig = args.ImagePath;
                    item.ThumbnailImage = args.ImagePath;
                }
            }
            if (e is MyErrorEventArgs)
            {
                MyErrorEventArgs ex = e as MyErrorEventArgs;
                addToLog("Error: " + ex.Error);
                setLogToActiveWindow();
                showWaitCursor(false);
            }
        }
Exemplo n.º 58
0
 private void Display(HistoryEntry he, HistoryList hl) =>
 Display(he, hl, true);
Exemplo n.º 59
0
        private void Initialize()
        {
            m_engine.Reset();
            m_lastState = 0;
            m_lexemeValueBuilder.Clear();

            m_fullHistory = new List<Lexeme>();
            m_valuableHistory = new List<int>();
            m_historyList = new HistoryList(m_fullHistory, m_valuableHistory);

            m_valuableCursor = 0;
            m_lastNotSkippedLexemeIndex = 0;
        }
Exemplo n.º 60
0
        int fdropdown, ftotalevents, ftotalfilters;     // filter totals

        private void Display(HistoryList hl)
        {
            Display(hl, false);
        }