private void UpdateUndeleteMenu(List <SavedRouteClass> routes = null)
        {
            var delrts = (routes ?? SavedRouteClass.GetAllSavedRoutes()).Where(r => r.Name.StartsWith(DEL)).OrderBy(r => r.Name);

            if (ctxMenuItemUndelete.HasDropDownItems)
            {
                for (int i = ctxMenuItemUndelete.DropDownItems.Count - 1; i >= 0; i--)
                {
                    ctxMenuItemUndelete.DropDownItems[i].Dispose();
                }
                ctxMenuItemUndelete.DropDownItems.Clear();
            }

            foreach (var drt in delrts)
            {
                string rtnm     = drt.Name.TrimStart(DEL.ToCharArray());
                var    menuitem = new ToolStripMenuItem(rtnm)
                {
                    Name = "UndeleteRouteSubMenuItem_" + rtnm.Replace(" ", string.Empty),
                    Tag  = drt
                };
                menuitem.Click += UndeleteRouteSubMenuItem_Click;
                ctxMenuItemUndelete.DropDownItems.Add(menuitem);
            }
        }
Example #2
0
        private void setRouteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            var routes     = SavedRouteClass.GetAllSavedRoutes();
            var routenames = (from x in routes select x.Name).ToList();

            f.Add(new ExtendedControls.ConfigurableForm.Entry("Route", "", new Point(10, 40), new Size(400, 24), "Select route", routenames, new Size(400, 400)));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Cancel", typeof(ExtendedControls.ButtonExt), "Cancel", new Point(410 - 100, 80), new Size(100, 24), "Press to Cancel"));
            f.Trigger += (dialogname, controlname, tag) =>
            {
                if (controlname != "Route")
                {
                    f.DialogResult = DialogResult.Cancel;
                }
                else
                {
                    f.DialogResult = DialogResult.OK;
                }
                f.Close();
            };
            if (f.ShowDialog(this.FindForm(), this.FindForm().Icon, new Size(430, 120), new Point(-999, -999), "Enter route") == DialogResult.OK)
            {
                string routename = f.Get("Route");
                currentRoute = routes.Find(x => x.Name.Equals(routename));       // not going to be null, but consider the upset.

                // currentRoute.TestHarness(); // enable for debug

                if (currentRoute != null)
                {
                    SQLiteDBClass.PutSettingString(DbSave + "SelectedRoute", currentRoute.Id.ToStringInvariant());        // write ID back
                }
                Display();
            }
        }
        public override void Init()
        {
            DBBaseName = "RouteTracker";

            displayfont = discoveryform.theme.GetFont;

            showJumpsToolStripMenuItem.Checked               = GetSetting("showjumps", true);
            autoCopyWPToolStripMenuItem.Checked              = GetSetting("autoCopyWP", false);
            autoSetTargetToolStripMenuItem.Checked           = GetSetting("autoSetTarget", false);
            showWaypointCoordinatesToolStripMenuItem.Checked = GetSetting("coords", true);
            showDeviationFromRouteToolStripMenuItem.Checked  = GetSetting("dev", true);
            showBookmarkNotesToolStripMenuItem.Checked       = GetSetting("bookmarkNotes", true);

            string ids = GetSetting("SelectedRoute", "-1");        // for some reason, it was saved as a string.. so keep for backwards compat
            int?   id  = ids.InvariantParseIntNull();

            if (id != null)
            {
                currentRoute = SavedRouteClass.GetAllSavedRoutes().Find(r => r.Id.Equals(id.Value));  // may be null
            }
            Display();

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry      += NewEntry;
            GlobalBookMarkList.Instance.OnBookmarkChange += GlobalBookMarkList_OnBookmarkChange;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(contextMenuStrip, this);
        }
Example #4
0
        private void setRouteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExtendedControls.ConfigurableForm f = new ExtendedControls.ConfigurableForm();

            var routes     = SavedRouteClass.GetAllSavedRoutes();
            var routenames = (from x in routes select x.Name).ToList();

            f.Add(new ExtendedControls.ConfigurableForm.Entry("Route", "", new Point(10, 40), new Size(400, 24), "Select route".T(EDTx.UserControlRouteTracker_Selectroute), routenames));
            f.Add(new ExtendedControls.ConfigurableForm.Entry("Cancel", typeof(ExtendedControls.ExtButton), "Cancel".T(EDTx.Cancel), new Point(410 - 100, 80), new Size(100, 24), "Press to Cancel".T(EDTx.UserControlRouteTracker_PresstoCancel)));
            f.Trigger += (dialogname, controlname, tag) =>
            {
                if (controlname != "Route")
                {
                    f.ReturnResult(DialogResult.Cancel);
                }
                else
                {
                    f.ReturnResult(DialogResult.OK);
                }
            };
            if (f.ShowDialogCentred(this.FindForm(), this.FindForm().Icon, "Enter route".T(EDTx.UserControlRouteTracker_Enterroute)) == DialogResult.OK)
            {
                string routename = f.Get("Route");
                currentRoute = routes.Find(x => x.Name.Equals(routename)); // not going to be null, but consider the upset.

                currentRoute.TestHarness();                                // enable for debug

                if (currentRoute != null)
                {
                    EliteDangerousCore.DB.UserDatabase.Instance.PutSettingString(DbSave + "SelectedRoute", currentRoute.Id.ToStringInvariant());        // write ID back
                }
                Display();
            }
        }
Example #5
0
 private void UpdateRoutes()
 {
     savedroute = SavedRouteClass.GetAllSavedRoutes();                             // all including deleted
     savedroute = savedroute.Where(r => !r.Deleted).OrderBy(r => r.Name).ToList(); // don't list deleted
     UpdateUndeleteMenu();
     UpdateComboBox();
 }
        public override void Init()
        {
            displayfont = discoveryform.theme.GetFont;

            showJumpsToolStripMenuItem.Checked               = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbSave + "showjumps", true);
            autoCopyWPToolStripMenuItem.Checked              = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbSave + "autoCopyWP", false);
            autoSetTargetToolStripMenuItem.Checked           = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbSave + "autoSetTarget", false);
            showWaypointCoordinatesToolStripMenuItem.Checked = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbSave + "coords", true);
            showDeviationFromRouteToolStripMenuItem.Checked  = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingBool(DbSave + "dev", true);

            string ids = EliteDangerousCore.DB.UserDatabase.Instance.GetSettingString(DbSave + "SelectedRoute", "-1");        // for some reason, it was saved as a string.. so keep for backwards compat
            int?   id  = ids.InvariantParseIntNull();

            if (id != null)
            {
                currentRoute = SavedRouteClass.GetAllSavedRoutes().Find(r => r.Id.Equals(id.Value));  // may be null
            }
            Display();

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry      += NewEntry;

            BaseUtils.Translator.Instance.Translate(this);
            BaseUtils.Translator.Instance.Translate(contextMenuStrip, this);
        }
Example #7
0
        private void UndeleteRouteSubMenuItem_Click(object sender, EventArgs e)
        {
            var tmi = sender as ToolStripMenuItem;
            var rte = tmi.Tag as SavedRouteClass;

            rte.Name = tmi.Text;    // .Text already had the DEL prefix removed, so let's use that.
            rte.Update();

            _savedRoutes = SavedRouteClass.GetAllSavedRoutes().Where(r => !r.Name.StartsWith("\x7F")).OrderBy(r => r.Name).ToList();
            UpdateComboBox();

            tmi.Dispose();  // Gets removed automatically.
        }
Example #8
0
        private void setRouteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SavedRouteClass selectedRoute;

            if (Prompt.ShowDialog(discoveryform, SavedRouteClass.GetAllSavedRoutes(),
                                  _currentRoute != null? _currentRoute.Name:"", "Select route", out selectedRoute))
            {
                if (selectedRoute == null)
                {
                    return;
                }
                _currentRoute = selectedRoute;
                SQLiteDBClass.PutSettingString(DbSave + "SelectedRoute", selectedRoute.Id.ToString());
                updateScreen();
            }
        }
Example #9
0
        private void setRouteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SavedRouteClass selectedRoute;

            if (Prompt.ShowDialog(discoveryform, SavedRouteClass.GetAllSavedRoutes().Where(r => !r.Name.StartsWith("\x7F")).OrderBy(r => r.Name).ToList(),
                                  _currentRoute?.Name ?? string.Empty, "Select route", out selectedRoute))
            {
                if (selectedRoute == null)
                {
                    return;
                }
                _currentRoute = selectedRoute;
                SQLiteDBClass.PutSettingString(DbSave + "SelectedRoute", selectedRoute.Id.ToString());
                updateScreen();
            }
        }
Example #10
0
        public override void LoadLayout()
        {
            savedroute = SavedRouteClass.GetAllSavedRoutes();

            foreach (var initroute in EDSMClass.Expeditions)
            {
                if (!savedroute.Any(r => r.Name == initroute.Name || r.Name == "\x7F" + initroute.Name))
                {
                    initroute.Add();
                    savedroute.Add(initroute);
                }
            }

            savedroute = savedroute.Where(r => !r.Name.StartsWith("\x7F")).OrderBy(r => r.Name).ToList();

            UpdateComboBox();
        }
        public void LoadControl()
        {
            _savedRoutes = SavedRouteClass.GetAllSavedRoutes();

            foreach (var initroute in InitialRoutes)
            {
                if (!_savedRoutes.Any(r => r.Name == initroute.Name || r.Name == "\x7F" + initroute.Name))
                {
                    initroute.Add();
                    _savedRoutes.Add(initroute);
                }
            }

            _savedRoutes = _savedRoutes.Where(r => !r.Name.StartsWith("\x7F")).ToList();

            UpdateComboBox();
        }
        public override void Init()
        {
            displayfont = discoveryform.theme.GetFont;

            autoCopyWPToolStripMenuItem.Checked    = SQLiteDBClass.GetSettingBool(DbSave + "autoCopyWP", false);
            autoSetTargetToolStripMenuItem.Checked = SQLiteDBClass.GetSettingBool(DbSave + "autoSetTarget", false);

            String selRoute = SQLiteDBClass.GetSettingString(DbSave + "SelectedRoute", "-1");
            long   id       = long.Parse(selRoute);

            _currentRoute = SavedRouteClass.GetAllSavedRoutes().Find(r => r.Id.Equals(id));
            updateScreen();

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry      += NewEntry;
            discoveryform.OnNewTarget     += NewTarget;
        }
Example #13
0
        public override void Init()
        {
            displayfont = discoveryform.theme.GetFont;

            autoCopyWPToolStripMenuItem.Checked    = SQLiteDBClass.GetSettingBool(DbSave + "autoCopyWP", false);
            autoSetTargetToolStripMenuItem.Checked = SQLiteDBClass.GetSettingBool(DbSave + "autoSetTarget", false);
            string ids = SQLiteDBClass.GetSettingString(DbSave + "SelectedRoute", "-1");        // for some reason, it was saved as a string.. so keep for backwards compat
            int?   id  = ids.InvariantParseIntNull();

            if (id != null)
            {
                currentRoute = SavedRouteClass.GetAllSavedRoutes().Find(r => r.Id.Equals(id.Value));  // may be null
            }
            Display();

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry      += NewEntry;
        }
        public void InitControl(EDDiscoveryForm discoveryForm)
        {
            _discoveryForm = discoveryForm;
            _savedRoutes   = SavedRouteClass.GetAllSavedRoutes();

            foreach (var initroute in InitialRoutes)
            {
                if (!_savedRoutes.Any(r => r.Name == initroute.Name))
                {
                    initroute.Add();
                    _savedRoutes.Add(initroute);
                }
            }

            UpdateComboBox();
            _currentRoute = new SavedRouteClass("");
            edsm          = new EDSMClass();
        }
Example #15
0
        public void InitControl(EDDiscoveryForm discoveryForm)
        {
            _discoveryForm = discoveryForm;
            _savedRoutes   = SavedRouteClass.GetAllSavedRoutes();

            foreach (var initroute in InitialRoutes)
            {
                if (!_savedRoutes.Any(r => r.Name == initroute.Name || r.Name == "\x7F" + initroute.Name))
                {
                    initroute.Add();
                    _savedRoutes.Add(initroute);
                }
            }

            _savedRoutes = _savedRoutes.Where(r => !r.Name.StartsWith("\x7F")).ToList();

            UpdateComboBox();
            _currentRoute = new SavedRouteClass("");
            edsm          = new EDSMClass();
        }
Example #16
0
        public override void Init(EDDiscoveryForm ed, int vn) //0=primary, 1 = first windowed version, etc
        {
            discoveryform = ed;
            displaynumber = vn;

            discoveryform.OnHistoryChange += Display;
            discoveryform.OnNewEntry      += NewEntry;
            discoveryform.OnNewTarget     += NewTarget;

            displayfont = discoveryform.theme.GetFont;

            autoCopyWPToolStripMenuItem.Checked    = SQLiteDBClass.GetSettingBool(DbSave + "autoCopyWP", false);
            autoSetTargetToolStripMenuItem.Checked = SQLiteDBClass.GetSettingBool(DbSave + "autoSetTarget", false);

            String selRoute = SQLiteDBClass.GetSettingString(DbSave + "SelectedRoute", "-1");
            long   id       = long.Parse(selRoute);

            _currentRoute = SavedRouteClass.GetAllSavedRoutes().Find(r => r.Id.Equals(id));
            updateScreen();
        }
Example #17
0
        private void UpdateUndeleteMenu()
        {
            var delrts = SavedRouteClass.GetAllSavedRoutes().Where(r => r.Name.StartsWith("\x7F")).OrderBy(r => r.Name);

            if (ctxMenuItemUndelete.HasDropDownItems)
            {
                for (int i = ctxMenuItemUndelete.DropDownItems.Count - 1; i >= 0; i--)
                {
                    ctxMenuItemUndelete.DropDownItems[i].Dispose();
                }
                ctxMenuItemUndelete.DropDownItems.Clear();
            }

            foreach (var drt in delrts)
            {
                var menuitem = new ToolStripMenuItem(drt.Name.TrimStart("\x7F".ToCharArray()));
                menuitem.Tag    = drt;
                menuitem.Click += UndeleteRouteSubMenuItem_Click;
                ctxMenuItemUndelete.DropDownItems.Add(menuitem);
            }
        }
Example #18
0
        private void UpdateUndeleteMenu()
        {
            var delrts = SavedRouteClass.GetAllSavedRoutes().Where(r => r.Deleted).OrderBy(r => r.Name);

            if (ctxMenuItemUndelete.HasDropDownItems)
            {
                for (int i = ctxMenuItemUndelete.DropDownItems.Count - 1; i >= 0; i--)
                {
                    ctxMenuItemUndelete.DropDownItems[i].Dispose();
                }
                ctxMenuItemUndelete.DropDownItems.Clear();
            }

            foreach (var drt in delrts)
            {
                var menuitem = new ToolStripMenuItem(drt.Name)
                {
                    Name = "UndeleteRouteSubMenuItem_" + drt.Name.Replace(" ", string.Empty),
                    Tag  = drt
                };
                menuitem.Click += UndeleteRouteSubMenuItem_Click;
                ctxMenuItemUndelete.DropDownItems.Add(menuitem);
            }
        }
        public override void LoadLayout()
        {
            if (displaynumber >= 0)
            {
                DGVLoadColumnLayout(dataGridViewRouteSystems, DbColumnSave);
            }

            savedroute = SavedRouteClass.GetAllSavedRoutes();

            if (!LoadedOnce)
            {
                foreach (var initroute in EDSMClass.Expeditions)
                {
                    var rt = savedroute.Find(r => initroute.Name.Equals(r.Name.TrimStart(DEL.ToCharArray()), StringComparison.InvariantCultureIgnoreCase));
                    if (rt == null)
                    {
                        initroute.Add();
                        savedroute.Add(initroute);
                    }
                    // Ensure that hard-coded expeditions are kept up-to-date, even if they've been "deleted" (also means that `a.Equals(b)` can't be used here).
                    else if (initroute.StartDate != rt.StartDate || initroute.EndDate != rt.EndDate || !initroute.Systems.SequenceEqual(rt.Systems))
                    {
                        rt.Systems.Clear();
                        rt.Systems.AddRange(initroute.Systems);
                        rt.StartDate = initroute.StartDate;
                        rt.EndDate   = initroute.EndDate;
                        rt.Update();
                    }
                }
                LoadedOnce = true;
            }

            UpdateUndeleteMenu(savedroute);
            savedroute = savedroute.Where(r => !r.Name.StartsWith(DEL)).OrderBy(r => r.Name).ToList();
            UpdateComboBox();
        }