当前位置: 首页>>代码示例>>C#>>正文


C# Station.AddTimetable方法代码示例

本文整理汇总了C#中Station.AddTimetable方法的典型用法代码示例。如果您正苦于以下问题:C# Station.AddTimetable方法的具体用法?C# Station.AddTimetable怎么用?C# Station.AddTimetable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Station的用法示例。


在下文中一共展示了Station.AddTimetable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            Station st1 = new Station("Минск", 6);
            Timetable table = new Timetable("Минск-Пассажирский", "Бобруйск", new TimeSpan(4, 6, 2), new TimeSpan(16, 4, 7), 0);
            Timetable table2 = new Timetable("Минск-Пассажирский", "Коханово", new TimeSpan(1, 54, 52), new TimeSpan(1, 51, 0), 1);
            Timetable table3 = new Timetable("Вильнюс", "Лида", new TimeSpan(16, 0, 0), new TimeSpan(5, 1, 9), 0);
            Timetable table4 = new Timetable("Лесная", "Борисов", new TimeSpan(0, 0, 0), new TimeSpan(1, 0, 0), 0);
            Timetable table5 = new Timetable("Пхов", "Брест", new TimeSpan(14, 35, 0), new TimeSpan(23, 53, 10), 1);
            st1.AddTimetable(table);
            st1.AddTimetable(table2);
            st1.AddTimetable(table3);
            st1.AddTimetable(table4);
            st1.AddTimetable(table5);

            new LINQHTML().SaveTimetables(@"D:\index.html", st1);
        }
开发者ID:alexssource,项目名称:Labs,代码行数:16,代码来源:Program.cs

示例2: LoadStation

        /// <summary>
        /// Load information about station from file
        /// </summary>
        /// <param name="stream">Stream, that contains path to the file</param>
        /// <returns>Station</returns>
        public Station LoadStation(Stream stream)
        {
            BinaryReader br = new BinaryReader(stream);

            string name = br.ReadString();
            int track = br.ReadInt32();
            Station station = new Station(name, track);

            int timetableCount = br.ReadInt32();
            for (int i = 0; i < timetableCount; i++)
            {
                station.AddTimetable(LoadTimetable(stream));
            }
            return station;
        }
开发者ID:alexssource,项目名称:Labs,代码行数:20,代码来源:TextFileWorking.cs

示例3: LoadStation

        /// <summary>
        /// Load information about station from xml element
        /// </summary>
        /// <param name="element">XML Element</param>
        /// <returns>Station</returns>
        public Station LoadStation(XmlElement element)
        {
            Station station = null;

            string Name = element.Attributes["Name"].Value;
            int Track = int.Parse(element.Attributes["Track"].Value);

            List<Timetable> list = new List<Timetable>();
            foreach (XmlElement elem in element.ChildNodes)
                list.Add(LoadTimetable(elem));

            station = new Station(Name, Track);

            foreach (Timetable tt in list)
                station.AddTimetable(tt);

            return station;
        }
开发者ID:alexssource,项目名称:Labs,代码行数:23,代码来源:DOMXML.cs

示例4: LoadStation

        /// <summary>
        /// Create station from xml element
        /// </summary>
        /// <param name="document">XElement</param>
        /// <returns>Station</returns>
        public Station LoadStation(XElement element)
        {
            Station station = null;

            string Name = element.Attribute("Name").Value;
            int Track = int.Parse(element.Attribute("Track").Value);

            List<XElement> list = new List<XElement>();
            foreach (XElement obj in element.Elements())
                 list.Add(obj);

            station = new Station(Name, Track);

            foreach (XElement tt in list)
            {
                string FirstStation = tt.Attribute("FirstStation").Value;
                string LastStation = tt.Attribute("LastStation").Value;
                TimeSpan TimeOfArrival = TimeSpan.Parse(tt.Attribute("TimeOfArrival").Value);
                TimeSpan TimeOfDeparture = TimeSpan.Parse(tt.Attribute("TimeOfDeparture").Value);
                string StringFreqType = tt.Attribute("FreqType").Value;
                int FreqType = 0;
                switch (StringFreqType)
                {
                    case "AllDays":
                        FreqType = 0;
                        break;
                    case "OnlyWeekend":
                        FreqType = 1;
                        break;
                    case "OnlySunday":
                        FreqType = 2;
                        break;
                }
                station.AddTimetable(new Timetable(FirstStation, LastStation, TimeOfArrival, TimeOfDeparture, FreqType));
            }

            return station;
        }
开发者ID:alexssource,项目名称:Labs,代码行数:43,代码来源:LINQXML.cs


注:本文中的Station.AddTimetable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。