示例#1
0
        private void LoadRouteData_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName   = "NewRoute";                    // Default file name
            dlg.DefaultExt = ".txt";                        // Default file extension
            dlg.Filter     = "Text documents (.txt)|*.txt"; // Filter files by extension

            // Show open file dialog box
            Nullable <bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string filename = dlg.FileName;

                for (int i = 0; i < BusLineBase.BusLineTable.Count; i++)
                {
                    BusLineBase.BusLineTable.Values.ElementAt <Bus>(i).Dispose();
                }

                BusLineBase.InitBus(filename, Carrier);
                StopBase.InitStopInfoControl("stopconfig.txt", Carrier);

                busLineList.DataContext = null;
                busLineList.DataContext = BusLineBase.BusLineTable.Keys;
                stopsList.DataContext   = null;
                stopsList.DataContext   = StopBase.StopTable.Keys;
            }
        }
示例#2
0
        public Window1()
        {
            InitializeComponent();
            InitMap();
            BusLineBase.InitBus("buslineconfig.txt", Carrier);
            StopBase.InitStopInfoControl("stopconfig.txt", Carrier);
            InitCombobox();
            this.PAT = new PATService();

            Server.Start();
        }