コード例 #1
0
 public void Should_work_correctly()
 {
     using (var temporaryFile = new TemporaryFile(TestCase.Xml))
     {
         var source = new XmlFileSource(temporaryFile.FileName);
         source.Observe()
         .WaitFirstValue(5.Seconds())
         .Should()
         .BeEquivalentTo((TestCase.SettingsTree, null as Exception));
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: nthdeveloper/MultiLanguage
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //XML file sample
            string _xmlLangugeFilesFolder = Path.GetFullPath(@"..\..\SampleData\XML");

            XmlFileSource         _xmlFileSource    = new XmlFileSource(_xmlLangugeFilesFolder);
            MultiLanguageProvider _languageProvider = new MultiLanguageProvider(_xmlFileSource);

            //Text file sample

            /*
             * string _txtLangugeFilesFolder = Path.GetFullPath(@"..\..\SampleData\Text");
             *
             * TextFileSource _textFileSource = new TextFileSource(_txtLangugeFilesFolder);
             * MultiLanguageProvider _languageProvider = new MultiLanguageProvider(_textFileSource);
             */

            _languageProvider.SetCurrentLanguage("en-US");

            Application.Run(new FrmMain(_languageProvider));
        }
コード例 #3
0
        /// <summary>
        /// Saves the route to a gpx file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="route"></param>
        internal static void Save(FileInfo file, OsmSharpRoute route)
        {
            XmlFileSource source          = new XmlFileSource(file);
            GpxDocument   output_document = new GpxDocument(source);
            gpxType       output_gpx      = new gpxType();

            output_gpx.trk = new trkType[1];

            // initialize all objects.
            List <wptType> segments = new List <wptType>();
            trkType        track    = new trkType();
            List <wptType> poi_gpx  = new List <wptType>();

            track.trkseg = new trksegType[1];

            // ============= CONSTRUCT TRACK SEGMENT ==============
            trksegType track_segment = new trksegType();

            // loop over all points.
            for (int idx = 0; idx < route.Entries.Length; idx++)
            {
                // get the current entry.
                RoutePointEntry entry = route.Entries[idx];

                // ================== INITIALIZE A NEW SEGMENT IF NEEDED! ========
                wptType waypoint;
                if (entry.Points != null)
                { // loop over all points and create a waypoint for each.
                    for (int p_idx = 0; p_idx < entry.Points.Length; p_idx++)
                    {
                        RoutePoint point = entry.Points[p_idx];

                        waypoint      = new wptType();
                        waypoint.lat  = (decimal)point.Latitude;
                        waypoint.lon  = (decimal)point.Longitude;
                        waypoint.name = point.Name;
                        poi_gpx.Add(waypoint);
                    }
                }

                // insert poi's.
                double longitde = entry.Longitude;
                double latitude = entry.Latitude;

                waypoint     = new wptType();
                waypoint.lat = (decimal)entry.Latitude;
                waypoint.lon = (decimal)entry.Longitude;

                segments.Add(waypoint);
            }

            // put the segment in the track.
            track_segment.trkpt = segments.ToArray();
            track.trkseg[0]     = track_segment;

            // set the track to the output.
            output_gpx.trk[0] = track;
            output_gpx.wpt    = poi_gpx.ToArray();

            // save the ouput.
            output_document.Gpx = output_gpx;
            output_document.Save();
        }