Beispiel #1
0
        public PassCalculator(SatellitesController satellites, SqLiteDb database)
        {
            _satellites = satellites;
            _db         = database;

            InitializeComponent();
            FormClosing += PassCalcHider;

            var location = _db.GetPosition();

            nbxLocLat.Value = location.lat;
            nbxLocLng.Value = location.lng;


            lviewPasses.View          = View.Details;
            lviewPasses.GridLines     = true;
            lviewPasses.FullRowSelect = true;

            lviewPasses.Columns.Add("Start", 120);
            lviewPasses.Columns.Add("Name", 60);
            lviewPasses.Columns.Add("Duration", 55);
            lviewPasses.Columns.Add("Elevation", 60);

            lviewPasses.Click += PassSelected;
        }
Beispiel #2
0
 public SatChooser(SatellitesController satellites, SqLiteDb db)
 {
     StartPosition = FormStartPosition.CenterParent;
     InitializeComponent();
     Satellites   = satellites;
     Db           = db;
     FormClosing += SatChooserHider;
     UpdateAllLists();
     lbxStoredSats.DoubleClick += btnAddToShown_Click;
 }
Beispiel #3
0
        protected override void RunDbSchemaUpdates(SqLiteDb db, SqliteDbInterface moduleInterface)
        {
            DbInterface localInterface = (DbInterface)moduleInterface;

            long version = db.GetVersion();

            if (version < CurrentVersion)
            {
                db.DropTables(localInterface.GetAllModules());
                db.CreateTables(localInterface.GetAllModules());
            }
        }
Beispiel #4
0
        public BufferedScreenController(Panel panel, SatellitesController satellitesController, SqLiteDb db)
        {
            _panel      = panel;
            _satellites = satellitesController;
            _db         = db;

            SetupGraphics();

            // Setup Timer
            _timer          = new Timer();
            _timer.Interval = 1000;
            _timer.Tick    += Redraw;
            _timer.Start();

            _panel.SizeChanged           += PanelResizeEvent;
            _satellites.SelectionChanged += Redraw;
        }
Beispiel #5
0
        public SimulationScreen()
        {
            InitializeComponent();
            var satController = new SatellitesController();
            var database      = new SqLiteDb();

            foreach (var sat in database.GetAllSatellites())
            {
                var newTles = TLEApi.GetCurrentTleData(sat);
                if (newTles.IsSuccess)
                {
                    database.UpdateTle(newTles.Value);
                }
            }

            Controller     = new BufferedScreenController(pnlSimulation, satController, database);
            SatChooser     = new SatChooser(satController, database);
            TimeTravel     = new TimeTravel();
            PassCalculator = new PassCalculator(satController, database);
        }
Beispiel #6
0
 protected override void InitModules(SqLiteDb db)
 {
     HexContent = new DbHexContent(this, db);
 }
Beispiel #7
0
 public DbHexContent(SqliteDbInterface dbInterface, SqLiteDb db) : base(dbInterface, db)
 {
 }
Beispiel #8
0
        /// <summary>Initializes a new instance of the <see cref="MainViewModel" /> class.</summary>
        public MainViewModel()
        {
            this.logger.Info("Запуск приложения Alisa");

            try
            {
                this.FilteredTEPCmd = new Command(arg => this.ApplyFilter());

                // Сервисные
                this.WriteTEPCmd      = new Command(arg => this.WriteTEP());
                this.DBCreateCmd      = new Command(arg => this.DBCreate());
                this.LogMailCmd       = new Command(arg => this.LogMail());
                this.FilterAndSaveCmd = new Command(arg => this.FilterAndSave());

                this.TEP  = new TEPModel {
                };
                this.Misc = new Misc {
                };

                // Вычитывание параметров из XML
                // Инициализация модели настроек
                var settingsXml = new SettingsXml <RootElement>(SettingsPath);
                this.settings.MSSQL  = new MSSQL();
                this.settings.SQLite = new SQLite();
                this.settings.Mail   = new Mail
                {
                    To = new List <string>()
                };

                this.settings.Reserv = new Reserv();

                if (File.Exists(SettingsPath))
                {
                    this.settings = settingsXml.ReadXml(this.settings);
                }
                else
                {
                    this.settings = this.SetDefaultValue(this.settings); // Значения по умолчанию
                    settingsXml.WriteXml(this.settings);
                }

                this.rDB = new RuntimeDb(this.settings.MSSQL);

                Misc.Master = this.settings.Reserv.Master ? "Master" : "Slave";

                // Вычитывание списка тегов из файла
                this.tags = this.rf.ReadFile(TagPath);

                // Коэффициенты
                this.CoeffModels = new ObservableCollection <CoeffModel> {
                };
                this.CoeffModels = this.rf.ReadCoeff(CoeffPath);

                this.sqliteDb = new SqLiteDb(this.settings.SQLite);
                if (!File.Exists(DataBaseName))
                {
                    this.sqliteDb.CreateBase();
                    this.sqliteDb.TEPCreateTable();
                }

                // Таймер вычитывания значений из БД
                this.readTEPTimer.Interval = new TimeSpan(0, 0, 2);
                this.readTEPTimer.Tick    += this.ReadTEP;
                this.readTEPTimer.Start();

                // Расчет ТЭП
                this.calculateTEPTimer.Interval = new TimeSpan(0, 0, 6);
                this.calculateTEPTimer.Tick    += this.CalculateTEP;
                this.calculateTEPTimer.Start();

                // Таймер на вызов метода записи 2-х часовок
                this.write2HourTEPTimer.Interval = new TimeSpan(0, 1, 0);
                this.write2HourTEPTimer.Tick    += new EventHandler(this.Write2HourTEP);
                this.write2HourTEPTimer.Start();

                // Таймер на отправку писем
                this.sendMailTimer.Interval = new TimeSpan(0, 1, 0);
                this.sendMailTimer.Tick    += this.SendMail;
                this.sendMailTimer.Start();

                // Таймер проверки связи с БД MSSQL
                this.checkConnectionTimer.Interval = new TimeSpan(0, 0, 10);
                this.checkConnectionTimer.Tick    += this.CheckConnection;
                this.checkConnectionTimer.Start();

                // Таймер на доступ к записи отчета
                this.accessReportTimer.Interval = new TimeSpan(0, 2, 0);
                this.accessReportTimer.Tick    += this.AccessReport;
                this.accessReportTimer.Start();

                this.LiveTEP   = new LiveTEP {
                };
                this.TEPtoBase = new LiveTEP {
                };
                this.Filters   = new Filters {
                };

                this.Filters.StartDate = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0));
                this.Filters.EndDate   = DateTime.Now;

                this.HistTEP = new ObservableCollection <HistTEP> {
                };

                this.Filters.OnCount += this.Filter;
                this.Filters.Day      = true;
                this.ApplyFilter();
            }
            catch (Exception ex)
            {
                this.logger.Error(ex.Message);
            }
        }
Beispiel #9
0
 public void Init(SqLiteDb db, SqliteDbInterface moduleInterface)
 {
     _db = db;
     _moduleInterface = moduleInterface;
 }
Beispiel #10
0
 protected abstract void RunDbSchemaUpdates(SqLiteDb db, SqliteDbInterface moduleInterface);