Пример #1
0
        public EDDLiteForm()
        {
            InitializeComponent();

            string logpath = EDDOptions.Instance.LogAppDirectory();

            BaseUtils.LogClean.DeleteOldLogFiles(logpath, "*.hlog", 2, 256);        // Remove hlogs faster
            BaseUtils.LogClean.DeleteOldLogFiles(logpath, "*.log", 10, 256);

            if (!System.Diagnostics.Debugger.IsAttached || EDDOptions.Instance.TraceLog != null)
            {
                BaseUtils.TraceLog.RedirectTrace(logpath, EDDOptions.Instance.TraceLog);
            }

            if (!System.Diagnostics.Debugger.IsAttached || EDDOptions.Instance.LogExceptions)
            {
                BaseUtils.ExceptionCatcher.RedirectExceptions(Properties.Resources.URLProjectFeedback);
            }

            if (EDDOptions.Instance.LogExceptions)
            {
                BaseUtils.FirstChanceExceptionCatcher.RegisterFirstChanceExceptionHandler();
            }

            // verify its first so its on top
            System.Diagnostics.Debug.Assert(extPanelScrollStatus.Controls[0] is ExtendedControls.ExtScrollBar);

            var appdata = EDDOptions.Instance.AppDataDirectory;     // FORCE ED options to Instance - do not remove.

            System.Diagnostics.Debug.WriteLine("App data " + appdata);

            UserDatabase.Instance.Start("UserDB");
            UserDatabase.Instance.Initialize();

            BaseUtils.Icons.IconSet.CreateSingleton();
            BaseUtils.Icons.IconSet.Instance.Add("Default", Properties.Resources.Logo);     // to satisfy the journal, add the backup Default in

            EDDConfig.Instance.Update();

            EDDLiteTheme.Init();
            EDDLiteTheme.Instance.SetThemeByName(UserDatabase.Instance.GetSettingString("Theme", "EDSM"));
            ApplyTheme();

            RestoreFormPositionRegKey = "MainForm";

            extStatusStrip.Font    = this.Font;
            label_version.Text     = EDDOptions.Instance.VersionDisplayString;
            labelGameDateTime.Text = "";
            labelInfoBoxTop.Text   = "";

            extButtonEDSMSystem.Enabled   = extButtonInaraSystem.Enabled = extButtonEDDBSystem.Enabled = false;
            extButtonInaraStation.Enabled = extButtonEDDBStation.Enabled = false;
            extButtonEDSY.Enabled         = extButtonCoriolis.Enabled = false;

            dataGridViewCommanders.RowsDefaultCellStyle.SelectionBackColor = EDDLiteTheme.Instance.GridCellBack;    // hide selection
            dataGridViewCommanders.RowsDefaultCellStyle.SelectionForeColor = EDDLiteTheme.Instance.GridCellText;


            gameTimeToolStripMenuItem.Checked  = false;
            utcToolStripMenuItem.Checked       =
                localToolStripMenuItem.Checked = false;

            UpdateGameTimeTick();

            screenshot = new ScreenShotConverter();
            extButtonScreenshotDisabled.Visible = !screenshot.AutoConvert;

            controller = new EDDLiteController();
            controller.ProgressEvent   += (s) => { toolStripStatus.Text = s; };
            controller.RefreshFinished += RefreshFinished;
            controller.NewEntry        += HistoryEvent;
            controller.LogLine         += LogLine;
            controller.NewUI           += UIEvent;

            if (!EDDOptions.Instance.DisableTimeDisplay)
            {
                datetimetimer          = new Timer();
                datetimetimer.Interval = 1000;
                datetimetimer.Tick    += (sv, ev) => { DateTime gameutc = DateTime.UtcNow.AddYears(1286); labelGameDateTime.Text = gameutc.ToShortDateString() + " " + gameutc.ToShortTimeString(); };
                datetimetimer.Start();

                timeToolStripMenuItem.Checked = labelGameDateTime.Visible = UserDatabase.Instance.GetSettingBool("TimeDisplay", true);

                this.timeToolStripMenuItem.CheckStateChanged += new System.EventHandler(this.timeToolStripMenuItem_CheckStateChanged);
            }

            splitContainerCmdrDataLogs.SplitterDistance(UserDatabase.Instance.GetSettingDouble("CmdrDataLogSplitter", 0.1));
            splitContainerDataLogs.SplitterDistance(UserDatabase.Instance.GetSettingDouble("DataLogSplitter", 0.8));
            splitContainerNamesButtonsScreenshot.SplitterDistance(UserDatabase.Instance.GetSettingDouble("NamesButtonsScreenshotSplitter", 0.8));
            EliteDangerousCore.IGAU.IGAUClass.SoftwareName           =
                EliteDangerousCore.EDDN.EDDNClass.SoftwareName       =
                    EliteDangerousCore.Inara.InaraClass.SoftwareName =
                        EDSMClass.SoftwareName = "EDDLite";

            splitContainerNamesButtonsScreenshot.Panel2.Resize += SplitContainerNamesButtonsScreenshot_Resize;
        }
Пример #2
0
        public EDDLiteForm()
        {
            InitializeComponent();

            var appdata = EDDOptions.Instance.AppDataDirectory;     // FORCE ED options to Instance - do not remove.

            System.Diagnostics.Debug.WriteLine("App data " + appdata);

            UserDatabase.Instance.Start("UserDB");
            UserDatabase.Instance.Initialize();

            BaseUtils.Icons.IconSet.CreateSingleton();
            BaseUtils.Icons.IconSet.Instance.Add("Default", Properties.Resources.Logo);     // to satisfy the journal, add the backup Default in

            EDDConfig.Instance.Update();

            EDDLiteTheme.Init();
            EDDLiteTheme.Instance.SetThemeByName(UserDatabase.Instance.GetSettingString("Theme", "EDSM"));
            ApplyTheme();

            RestoreFormPositionRegKey = "MainForm";

            extStatusStrip.Font    = this.Font;
            label_version.Text     = EDDOptions.Instance.VersionDisplayString;
            labelGameDateTime.Text = "";
            labelInfoBoxTop.Text   = "";
            extButtonEDSM.Enabled  = extButtonEDSY.Enabled = extButtonCoriolis.Enabled = false;
            dataGridViewCommanders.RowsDefaultCellStyle.SelectionBackColor = EDDLiteTheme.Instance.GridCellBack;    // hide selection
            dataGridViewCommanders.RowsDefaultCellStyle.SelectionForeColor = EDDLiteTheme.Instance.GridCellText;

            screenshot = new ScreenShotConverter();
            screenshotenableToolStripMenuItem.Checked         = screenshot.AutoConvert;
            screenshotenableToolStripMenuItem.CheckedChanged += new System.EventHandler(this.enableToolStripMenuItem_CheckedChanged);

            controller = new EDDLiteController();
            controller.ProgressEvent += (s) => { toolStripStatus.Text = s; };
            controller.Refresh       += ReadJournals;
            controller.NewEntry      += HistoryEvent;
            controller.LogLine       += LogLine;

            if (!EDDOptions.Instance.DisableTimeDisplay)
            {
                datetimetimer          = new Timer();
                datetimetimer.Interval = 1000;
                datetimetimer.Tick    += (sv, ev) => { DateTime gameutc = DateTime.UtcNow.AddYears(1286); labelGameDateTime.Text = gameutc.ToShortDateString() + " " + gameutc.ToShortTimeString(); };
                datetimetimer.Start();

                timeToolStripMenuItem.Checked = labelGameDateTime.Visible = UserDatabase.Instance.GetSettingBool("TimeDisplay", true);

                this.timeToolStripMenuItem.CheckStateChanged += new System.EventHandler(this.timeToolStripMenuItem_CheckStateChanged);
            }

            splitContainerCmdrDataLogs.SplitterDistance(UserDatabase.Instance.GetSettingDouble("CmdrDataLogSplitter", 0.1));
            splitContainerDataLogs.SplitterDistance(UserDatabase.Instance.GetSettingDouble("DataLogSplitter", 0.8));

            EliteDangerousCore.IGAU.IGAUClass.SoftwareName           =
                EliteDangerousCore.EDDN.EDDNClass.SoftwareName       =
                    EliteDangerousCore.Inara.InaraClass.SoftwareName =
                        EDSMClass.SoftwareName = "EDDLite";

            DLLManager   = new EDDDLLManager();
            DLLCallBacks = new EDDDLLIF.EDDCallBacks(1, DLLRequestHistory, (s1, s2) => { return(false); }, null);
        }