示例#1
0
        internal void CreateNewFile(string fileToOpen)
        {
            if (fileToOpen != null)
            {
                string     arg0 = _fileToOpen.Trim();
                LoksimFile file = null;
                switch (arg0.ToLower())
                {
                case "-l3dsky":
                    file = new SkyFile();
                    break;

                case "-l3dwth":
                    file = WeatherFile.CreateNewDefaultFile();
                    break;

                case "-l3dfst":
                    file = new DrivingCabFile();
                    break;

                default:
                    file = LoadFile(new L3dFilePath(arg0));
                    break;
                }
                if (file != null)
                {
                    SetCtrlAndViewModel(file);
                }
            }
#if DEBUG
            //TODO Just for driving cab dev

            /*
             * else
             * {
             *  LoksimFile f = new DrivingCabFile();
             *  SetCtrlAndViewModel(f);
             * }
             */
#endif
        }
        private void ButtonOK_Click(object sender, RoutedEventArgs e)
        {
            ListViewItem it = listView.SelectedItem as ListViewItem;

            if (it != null && it.Tag != null)
            {
                switch (it.Tag.ToString())
                {
                case "l3dsky":
                    SelectedFile = new SkyFile();
                    break;

                case "l3dwth":
                    SelectedFile = WeatherFile.CreateNewDefaultFile();
                    break;

                case "l3dfst":
                    SelectedFile = new DrivingCabFile();
                    break;
                }
                DialogResult = true;
                Close();
            }
        }