Beispiel #1
0
        /// <summary>
        /// Sends the data UDP.
        /// </summary>
        private void SendDataUDP()
        {
            RFDeviceList devicelist = GetDeviceList();

            if (devicelist.Count == 0)
            {
                MB.Warning("No Selected RFDevice Avaible For Sending!");
                return;
            }

            SendDataUDP(devicelist);
        }
Beispiel #2
0
        /// <summary>
        /// Deletes from templates.
        /// </summary>
        /// <param name="dvm">The DVM.</param>
        private void DeleteFromTemplates(RFDeviceViewModel dvm = null)
        {
            if (this.CurrentSelectedTemplate == EMPTY_TEMPLATE)
            {
                MB.Warning("You Can't Not Delete The Default Template!");
                return;
            }

            this.RFDeviceTemplateCollection.Remove(this.CurrentSelectedTemplate);

            this.CurrentSelectedTemplate = EMPTY_TEMPLATE;
        }
Beispiel #3
0
        /// <summary>
        /// Exports the RFDevices.
        /// </summary>
        private void ExportRFDevices()
        {
            RFDeviceList devicelist = GetDeviceList();

            if (devicelist.Count == 0)
            {
                MB.Warning("No Selected RFDevice Avaible For Export!");
                return;
            }

            this.sfdExportSIGENCEScenario.FileName = this.CurrentFile != null ? new FileInfo(this.CurrentFile).GetFilenameWithoutExtension() : DateTime.Now.Fmt_YYYYMMDDHHMMSS();

            if (this.sfdExportSIGENCEScenario.ShowDialog() == true)
            {
                ExportRFDevices(devicelist, new FileInfo(this.sfdExportSIGENCEScenario.FileName));
            }
        }
Beispiel #4
0
        /// <summary>
        /// Exports the RFDevices.
        /// </summary>
        /// <param name="devicelist">The devicelist.</param>
        /// <param name="fiExportFile">The fi export file.</param>
        private void ExportRFDevices(RFDeviceList devicelist, FileInfo fiExportFile)
        {
            this.Cursor = Cursors.Wait;

            try
            {
                switch (fiExportFile.Extension.ToLower())
                {
                case ".csv":
                    devicelist.SaveAsCsv(fiExportFile.FullName);
                    MB.Information("File {0} successful created.", fiExportFile.Name);
                    break;

                case ".json":
                    devicelist.SaveAsJson(fiExportFile.FullName);
                    MB.Information("File {0} successful created.", fiExportFile.Name);
                    break;

                case ".xml":
                    devicelist.SaveAsXml(fiExportFile.FullName);
                    MB.Information("File {0} successful created.", fiExportFile.Name);
                    break;

                //case ".sqlite":
                //    devicelist.SaveAsSQLite( fiExportFile.FullName );
                //    MB.Information( "File {0} successful created." , fiExportFile.Name );
                //    break;

                case ".xlsx":
                    SaveAsExcel(devicelist, fiExportFile.FullName);
                    break;

                default:
                    MB.Warning("The FileType '{0}' Is Currently Not Supported For Export!", fiExportFile.Extension.ToLower());
                    break;
                }
            }
            catch (Exception ex)
            {
                MB.Error(ex);
            }

            this.Cursor = Cursors.Arrow;
        }
Beispiel #5
0
        /// <summary>
        /// Edits the template.
        /// </summary>
        private void EditTemplate()
        {
            if (this.CurrentSelectedTemplate == EMPTY_TEMPLATE)
            {
                MB.Warning("You Can't Not Edit The Default Template!");
                return;
            }

            RFDeviceEditDialog ded = new RFDeviceEditDialog(this.CurrentSelectedTemplate);

            if (ded.ShowDialog() ?? false == true)
            {
                this.RFDeviceTemplateCollection.Remove(this.CurrentSelectedTemplate);

                RFDeviceTemplate newtemplate = new RFDeviceTemplate(ded.Device);

                this.RFDeviceTemplateCollection.Add(newtemplate);
                this.CurrentSelectedTemplate = newtemplate;
            }

            ded = null;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            //-----------------------------------------------------------------

            if (this.settings.IsUpgraded == false)
            {
                this.settings.Upgrade();
                this.settings.IsUpgraded = true;
                this.settings.Save();
            }

            //if(string.IsNullOrEmpty( this.settings.UDPHost ))
            //{
            //    MB.Warning( "The value in the configuration file for the setting UDPHost is invalid!\nPlease correct the value and restart the application." );
            //    this.settings.UDPHost = "127.0.0.1";
            //}

            //if(this.settings.UDPPortSending < 1025 || this.settings.UDPPortSending > 65535)
            //{
            //    MB.Warning( "The value in the configuration file for the setting UDPPort is invalid!\nPlease correct the value and restart the application." );
            //    this.settings.UDPPortSending = 4242;
            //}

            //if(this.settings.UDPDelay < 0 || this.settings.UDPDelay > 10000)
            //{
            //    MB.Warning( "The value in the configuration file for the setting UDPDelay is invalid!\nPlease correct the value and restart the application." );
            //    this.settings.UDPDelay = 500;
            //}

            if (this.settings.MapZoomLevel < 1 || this.settings.MapZoomLevel > 20)
            {
                MB.Warning("The value in the configuration file for the setting MapZoomLevel is invalid!\nPlease correct the value and restart the application.");
                this.settings.MapZoomLevel = 18;
            }

            //-----------------------------------------------------------------

            this.DataContext = this;

            //-----------------------------------------------------------------

            if (Properties.Settings.Default.LastOpenFiles == null)
            {
                Properties.Settings.Default.LastOpenFiles = new StringCollection();
            }

            //-----------------------------------------------------------------

            InitMapControl();
            InitMapProvider();
            InitCommands();
            InitFileOpenSaveDialogs();
            InitTextEditorControls();

            //-----------------------------------------------------------------

            SetTitle();
            UpdateFileHistory();

            //-----------------------------------------------------------------

            this.lcvRFDevices = CollectionViewSource.GetDefaultView(this.RFDeviceViewModelCollection) as ListCollectionView;

            if (this.lcvRFDevices != null)
            {
                this.lcvRFDevices.IsLiveFiltering = true;
                this.lcvRFDevices.Filter          = IsWantedRFDevice;
            }

            //-----------------------------------------------------------------

            this.dgcbcRxTxType.ItemsSource = RxTxTypes.Values;

            List <RxTxType> lRxTxTypes = new List <RxTxType> {
                RxTxType.Empty
            };

            lRxTxTypes.AddRange(RxTxTypes.Values);
            this.cbRxTxType.ItemsSource = lRxTxTypes;

            this.cbAntennaType.ItemsSource = DisplayableEnumeration.GetCollection <AntennaType>();

            //-----------------------------------------------------------------

            this.RFDeviceTemplateCollection.Add(EMPTY_TEMPLATE);

            this.MetaInformation.PropertyChanged += MetaInformation_PropertyChanged;

            //-----------------------------------------------------------------

            using (XpsDocument xps = new XpsDocument("MarkdownCheatsheet.xps", FileAccess.Read))
            {
                this.dvMarkdownCheatsheet.Document = xps.GetFixedDocumentSequence();
            }
            this.dvMarkdownCheatsheet.FitToWidth();

            //-----------------------------------------------------------------

#if DEBUG
            //MessageMocker(@"O:\SIGENCE-ObiWanLansi-Tools\MessageHandler\java\messages\JammerDetection.xml");

            HelpConfigFactory.CreateTemplate(Properties.Settings.Default.HelpPath);

            this.RFDeviceTemplateCollection.Add(new RFDeviceTemplate(new RFDevice {
                Name = "GPS Jammer", Id = 1
            }));
            this.RFDeviceTemplateCollection.Add(new RFDeviceTemplate(new RFDevice {
                Name = "FMBroadcast", Id = 2
            }));
            this.RFDeviceTemplateCollection.Add(new RFDeviceTemplate(new RFDevice {
                Name = "NFMRadio", Id = 3
            }));
            this.RFDeviceTemplateCollection.Add(new RFDeviceTemplate(new RFDevice {
                Name = "AIS Sender", Id = 4
            }));

            this.RFDeviceTemplateCollection.Add(new RFDeviceTemplate(new RFDevice {
                Name = "B200 Mini", Id = -2
            }));
            this.RFDeviceTemplateCollection.Add(new RFDeviceTemplate(new RFDevice {
                Name = "HackRF", Id = -3
            }));
            this.RFDeviceTemplateCollection.Add(new RFDeviceTemplate(new RFDevice {
                Name = "TwinRx", Id = -4
            }));

            //LoadTemplates( @"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\Templates.stt" );
            //ImportSettings(@"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\mysettings.sts");

            //-----------------------------------------------------------------

            //try
            //{
            //    string strFilename = $"{Tool.StartupPath}\\tuebingen-regbez-latest.osm.sqlite";
            //    this.GeoNodeCollection = GeoNodeCollection.GetCollection(strFilename);
            //}
            //catch (Exception ex)
            //{
            //    MB.Error(ex);
            //}

            //this.lcvGeoNodes = CollectionViewSource.GetDefaultView(this.GeoNodeCollection) as ListCollectionView;

            //if (this.lcvGeoNodes != null)
            //{
            //    this.lcvGeoNodes.IsLiveFiltering = true;
            //    this.lcvGeoNodes.Filter = IsWantedGeoNode;
            //}

            //-----------------------------------------------------------------

            //CreateRandomizedRFDevices(10, true);

            //AddRFDevice( new RFDevice { PrimaryKey = Guid.Empty, Id = -1, Latitude = 1974, Longitude = 1974, StartTime = -1974 } );

            //AddRFDevice( new RFDevice
            //{
            //    Id = 42,
            //    DeviceSource = DeviceSource.User,
            //    Latitude = 47.666557,
            //    Longitude = 9.386941,
            //    AntennaType = AntennaType.HyperLOG60200,
            //    RxTxType = RxTxTypes.FMBroadcast,
            //    CenterFrequency_Hz = 90_000_000,
            //    Bandwidth_Hz = 30_000
            //} );

            //AddRFDevice( new RFDevice
            //{
            //    Id = -42,
            //    DeviceSource = DeviceSource.User,
            //    Latitude = 47.666100,
            //    Longitude = 9.172648,
            //    AntennaType = AntennaType.OmniDirectional,
            //    RxTxType = RxTxTypes.IdealSDR,
            //    CenterFrequency_Hz = 90_000_000,
            //    Bandwidth_Hz = 30_000
            //} );

            //CreateHeatmap();
            //CreateExampleRFDevices();

            //CreateRandomizedRFDevices(42);
            //OpenDeviceEditDialog(RFDevice.DUMMY);

            //-----------------------------------------------------------------

            RFDevice receiver = RFDevice.CreateDummy();
            receiver.Id        = -42;
            receiver.Longitude = 9.386941 + 0.1;
            receiver.Yaw       = 45;
            AddRFDevice(receiver);

            RFDevice refdevice = RFDevice.CreateDummy();
            refdevice.Id        = 0;
            refdevice.Longitude = 9.386941 + 0.2;
            refdevice.Yaw       = 45;
            AddRFDevice(refdevice);

            RFDevice sender = RFDevice.CreateDummy();
            sender.Id        = 42;
            sender.Longitude = 9.386941 + 0.3;
            sender.Yaw       = 45;
            AddRFDevice(sender);

            //-----------------------------------------------------------------

            //SaveFile( @"D:\BigData\GitHub\SIGENCE-Scenario-Tool\Examples\TestScenario.stf" );
            //LoadFile(@"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\TestScenario.stf");

            //SaveFile( @"C:\Transfer\TestScenario.stf" );
            //LoadFile( @"C:\Transfer\TestScenario.stf" );


            //Reset();
            //LoadFile(@"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\TestWrongAntennaType.stf");
            //LoadFile(@"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\LongLineForSimulationPlayer.stf");

            //-----------------------------------------------------------------

            //RFDeviceList devicelist = GetDeviceList();

            //ExportRFDevices( devicelist, new FileInfo( @"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\TestScenario.csv" ) );
            //ExportRFDevices( devicelist, new FileInfo( @"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\TestScenario.xml" ) );
            //ExportRFDevices( devicelist, new FileInfo( @"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\TestScenario.json" ) );
            //ExportRFDevices( devicelist, new FileInfo( @"D:\EigeneDateien\Entwicklung.GitHub\SIGENCE-Scenario-Tool\Examples\TestScenario.xlsx" ) );

            //-----------------------------------------------------------------

            this.QuickCommands.Add("new");
            this.QuickCommands.Add("rand 20");
            this.QuickCommands.Add("export csv");
            this.QuickCommands.Add("set rxtxtype unknown");
            this.QuickCommands.Add("set name nasenbär");
            this.QuickCommands.Add("remove");
            this.QuickCommands.Add("save");
            this.QuickCommands.Add("exit");

            //-----------------------------------------------------------------

            //OpenScenarioSimulationPlayer();

            //-----------------------------------------------------------------

            //InitMetaInformation();

            //this.tiEditDescription.IsSelected = true;
            //this.tiMetaInformation.IsSelected = true;


            //UpdateScenarioDescriptionMarkdown();

            ////string strMarkdown = $"{Tool.StartupPath}\\ExampleScenarioDescription.md";

            //this.MetaInformation.Version = "1.0";
            //this.MetaInformation.ApplicationContext = "Scenario Meta Information Test";
            //this.MetaInformation.ContactPerson = "Jörg Lanser";

            ////this.MetaInformation.Description = File.ReadAllText($"{Tool.StartupPath}\\ExampleScenarioDescription.md");
            ////this.MetaInformation.Stylesheet = "h1 { border: 1px solid red; }";
            //this.MetaInformation.SetDescriptionAndStylesheet(File.ReadAllText($"{Tool.StartupPath}\\ExampleScenarioDescription.md"), "h1 { border: 1px solid red; }");

            ////this.MetaInformation.Attachements.Add(new Attachement(new FileInfo($"{Tool.StartupPath}\\ExampleScenarioDescription.md"), AttachementType.Embedded));
            ////this.MetaInformation.Attachements.Add(new Attachement(new FileInfo($"{Tool.StartupPath}\\HelloWorld.py"), AttachementType.Embedded));
            ////this.MetaInformation.Attachements.Add(new Attachement(new FileInfo($"{Tool.StartupPath}\\CheatSheet.pdf"), AttachementType.Link));
            ////this.MetaInformation.Attachements.Add(new Attachement(new FileInfo($"{Tool.StartupPath}\\CheatSheet.xps"), AttachementType.Link));
            ////this.MetaInformation.Attachements.Add(new Attachement(new FileInfo($"{Tool.StartupPath}\\streets_bw.sqlite"), AttachementType.Link));

            //this.tecDescription.Text = this.MetaInformation.Description;
            //this.tecStyleSheet.Text = this.MetaInformation.Stylesheet;

            //this.tiMetaInformation.IsSelected = true;

            //-----------------------------------------------------------------

            //RFDevice device = new RFDevice().WithId(0).WithName("Hello").WithStartTime(5);
            //MB.Information(device.ToXml().ToString());
#else
            this.mMainMenu.Items.Remove(this.miTest);
            //this.tcTabControl.Items.Remove(this.tiGeoNodes);
            //this.tcTabControl.Items.Remove(this.tiMetaInformation);
#endif
        }